Networking Your Way

It would seem that the fabulous little package for managing the network, called Network Manager, has made its way from those user-oriented versions of Linux, such as Ubuntu, over to CentOS. While this gem may be a good idea for someone's laptop (where the network address is acquired automagically by DHCP, and/or networking is done via multiple connections), its probably going to be a real pain in the butt if you want your machine to have a single, static IP address. Basically, this package is a piece of scrap that does not work. Sure, as we said, it will configure your network for use by DHCP but, if you want to change one of the interfaces to a static IP address, you'll waste a lot of time before you figure out what a piece of junk it is. Sure, it looks like it is configuring your interfaces the way you want them but in reality it is leading you down the garden path. After you carefully configure the interface just the way you want it, nothing happens. And, when you reboot, all your changes are gone and you're back to DHCP. Who needs this kind of bulls**t?

So, if you don't want to bother with all of the b.s. caused by trying to set up static IP addresses via the Network Manager, begin by uninstalling the Network Manager using the Package Manager (yeah, we know that we told you to install the Gnome Network Manager package, above, but now we're telling you to uninstall it). This is by far and away the easiest way to disable it. Do a search for "network-manager" and you should see the package and related packages in the list. Uninstall them.

By now, you've probably installed one or more ethernet cards, according to the directions in the ethernet HowTo, when you set up your hardware. If you are lucky, the system install will have set up the proper device driver(s) for the cards and they should be working OK. If not, hack the following:

/etc/modprobe.conf:

Alias the ethernet device name to the proper module for the card. If the card is an ISA card, you might need to set the options to use for that card. Here's an example of three cards:

     alias eth0 rtl8139                    # A Realtek PCI 10/100BaseT
     alias eth1 rtl8169                    # A Realtek PCI 10/100/1000BaseT
     alias eth2 e1000                      # An Intel Pro 1000

Then, from Gnome, run /usr/bin/netcfg (you should see this program under the menu tree "System/Network". This program will allow you to configure the machine's host and domain names, DNS lookup servers, /etc/hosts data, the network adapter information and the routing information. The following information should be added to the sections noted:

Names (or DNS)

     Hostname: mysys
     Domain: leave blank
     Search for hostnames in additional domains: leave blank
     Nameservers: DNS server1
                  DNS server2
                       .
                       .
                       .

Hosts

      IP                Name              Nickname
  127.0.0.1       localhost.homeworld     localhost
  192.168.1.1     jump-gate.homeworld     jump-gate    (packet shoveller)
  192.168.1.5     laboratory.homeworld    laboratory
  192.168.1.6     phones.homeworld        phones

Note that it is very important that the name and IP address of the local machine be set here, as well as localhost, because the Asterisk Voicemail application will try to send email using the local host name, which will not be resolved if it is missing from hosts. The send will fail, the email will go bouncing all over the place and it will be a real mess.

Interfaces

     Interface        IP         Proto  Atboot   Active
        lo         127.0.0.1     none    yes     active
       eth0       192.168.1.x    none    yes     active
       eth1       192.168.1.y    none    yes     active
         .
         .
         .

When setting up IP local addresses, you should use Netmask: 255.255.255.0.

Routing

     Default Gateway: 192.168.1.1

/etc/sysconfig/network-scripts/ifcfg-ethx:

If the above setup doesn't give you what you want or you need to hack the definition of your ethernet cards directly, you can look in /etc/sysconfig/network-scripts/ifcfg-ethx, (where "x" is your network adapter's number) for the NIC setup. Note that you must not use uppercase letters in the hexadecimal MAC address set by the HWADDR parameter. If you do, the brain dead code in /sbin/ifup and /sbin/ifdown will not work properly. Here's a few samples:

/etc/sysconfig/network-scripts/ifcfg-eth0 (regular NIC):

     USERCTL=no
     PEERDNS=no
     TYPE=Ethernet
     [IPV6INIT=no]        # Optional for systems that support IPV6
     DEVICE=eth0
     HWADDR=00:50:ba:52:5b:8d
     BOOTPROTO=none
     ONBOOT=yes
     IPADDR=192.168.1.6
     NETMASK=255.255.255.0
     BROADCAST=192.168.1.255

/etc/sysconfig/network-scripts/ifcfg-eth1 (gig-o-bit NIC):

     USERCTL=no
     PEERDNS=no
     TYPE=Ethernet
     [IPV6INIT=no]        # Optional for systems that support IPV6
     DEVICE=eth1
     HWADDR=00:1b:21:20:f3:e3
     BOOTPROTO=none
     ONBOOT=yes
     IPADDR=192.168.11.6
     NETMASK=255.255.255.0
     BROADCAST=192.168.11.255

/etc/resolv.conf:

You'll also need to put your DNS servers in the resolv.conf file so that they look something like this:

     nameserver 151.203.0.84
     nameserver 151.203.0.85
     nameserver 204.122.16.8
     nameserver 216.231.41.2

Once you're done, a reboot should prove that everything is working OK. Make sure that you can ping other systems on your local network, that hostnames are resolved properly (if you care), and that you can reach systems on the Internet (i.e. that DNS and routing are working). Verify that you can ping the system from elsewhere on your local network and that you can telnet into it from elsewhere.

As a final check, make sure the system boots without a keyboard and display and that you can still get to it via telnet. You should now be prepared to run headless.