Ethernet

Install one or more ethernet cards according to the directions in the ethernet HowTo. Hack the following:

/etc/modules.conf:
/etc/modprobe.conf (later versions of RedHat/CentOS):

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 four cards:

     alias eth0 ne                         # Novell NE2000 compatible
     alias eth1 ne2k-pci                   # A Realtek PCI NE2000 compatible
     alias eth2 rtl8139                    # A Realtek PCI 10/100BaseT
     alias eth3 e1000                      # An Intel Pro 1000
     options eth0 io=0x300 irq=10          # NE2000 ISA bus card sets addr/irq

or

     options eth0 io=0x200 irq=5           # NE2000 ISA bus card sets addr/irq

Here's another example with three cards, two of which are handled by the same driver:

     alias eth0 e1000                      # An Intel Pro 1000
     alias eth1 e1000                      # Another Intel Pro 1000
     alias eth2 8139too                    # A Realtek 8139-based card

Incidentally, if you do have multiple cards aliased to the same driver, it is solely up to the driver to assign the cards device names, in whatever order it sees fit. Often this depending on the slot order in which the cards are installed but sometimes it can be timing-dependant. This can result in different cards being assigned a device name, each time the system is booted.

If you don't wish to play device name roulette and you have one of the later versions of Linux that support udev, you can take care of this situation so that device name assignment is fully deterministic (for earlier versions of Linux, without udev, you can just cross your fingers).

Fire up your favorite text editor and take a look at the "/var/log/messages" file. Do a search for "eth". You should see the place in the boot sequence where the network driver or drivers bring up your network interfaces. This will list the MAC address of each card and its ethernet device name (e.g. "eth0"). Remember these two pieces of information for each NIC.

Continue searching from that point forward. You may see where udev is remapping your NIC to some other device name (e.g. "udev: renamed network interface eth0 to eth1"). If you don't want this to happen or if you want to assign specific device names to particular NICs, you should find where udev compares each NIC's MAC address in its rules and map the NIC to whatever name you want. For example:

/etc/udev/rules.d/70-persistent-net.rules:

     Find the spot in this file that maps MAC addresses to device names.  Using
     each NIC's MAC address, change the rules to map each NIC to the device
     name you want:
     # The line will look something like this
     SUBSYSTEM=="net", ACTION=="add", DRIVERS="?", \
       ATTR{address}=="00:19:66:17:ea:ff", ATTR{type}=="1", KERNEL=="eth", \
       NAME="eth0"

Change "eth0" to whatever name you really want. Duplicate the line for each of your NICs.

Under the SuSE Linux variant, you are likely to see something that looks like this:

/etc/udev/rules.d/30-net-persistent-names.rules:

     Find the spot in this file that maps MAC addresses to device names.  Using
     each NIC's MAC address, change the rules to map each NIC to the device
     name you want:
     # The line will look something like this
     SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:19:66:17:ea:ff", \
       IMPORT="/lib/udev/rename_netiface %k eth0"

Again, change "eth0" to whatever name you really want and duplicate the line for each of your NICs.

Once you've got all the cards aliased to the appropriate drivers and assigned the right device names, reboot the system and then, from Gnome, run /usr/bin/netcfg (you should see this program under the menu tree "Programs/System/Network Configuration" or "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.

Note that later versions of Redhat or CentOS may also include a fabulous little package for managing the network called Network Manager. You can see the discussion in "Networking Your Way" for our thoughts on why this package is a bad idea. In the mean time, you should uninstall the Network Manager package, using the Package Manager, before you proceed with the next steps. This is by far and away the easiest way to disable it, since it will yield nothing but grief, if left installed. Pick the "Networking" section and then do a search for "network-manager". You should see the package at the head of the list. Uninstall it.

Using netcfg, 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     stargate.homeworld      stargate    (packet shoveller)
  192.168.1.2     gabriella.homeworld     gabriella
  192.168.1.3     clara-bow.homeworld     clara-bow
  192.168.1.4     phoebe.homeworld        phoebe
  192.168.1.5     laboratory.homeworld    laboratory
  192.168.1.6     scada.homeworld         scada
  192.168.1.61    tivo2.homeworld         tivo2
  192.168.1.62    tivo1.homeworld         tivo1
  192.168.1.63    kinkos.homeworld        kinkos

Interfaces

     Interface        IP         Proto  Atboot   Active
        lo         127.0.0.1     none    yes     active
       eth0       192.168.1.x    none    yes     active
       eth1                      none    no     inactive  (only for DSL/cable)

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

Routing

On the main packet shoveller, don't use anything (unless you have an always on connection, in which case, route out through eth1 to wherever).

On local machines, set:

     Default Gateway: 192.168.1.1
     Default Gateway Device: eth0

/etc/sysconfig/network-scripts/ifcfg-ethx or ifcfg.ethx:
/etc/sysconfig/networking/devices/ifcfg-ethx or ifcfg.ethx:
/etc/sysconfig/networking/profiles/default/ifcfg-ethx or 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, on RedHat/CentOS you can look in /etc/sysconfig/network-scripts/ifcfg-ethx, /etc/sysconfig/networking/devices/ifcfg-ethx and /etc/sysconfig/networking/profiles/default/ifcfg-ethx (where "x" is your network adapter's number) for the NIC setup. Just bear in mind that, when you're hacking these files, 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 or 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.1
     NETMASK=255.255.255.0
     BROADCAST=192.168.1.255

/etc/sysconfig/network-scripts/ifcfg-eth1 or 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.1
     NETMASK=255.255.255.0
     BROADCAST=192.168.11.255

/etc/sysconfig/network-scripts/ifcfg-eth2 or ifcfg.eth2 (PPPoE):

The NIC is used for PPPoE with a modem or DSL/Cable modem. Note that the interface is not brought up at boot time, since it is left to the PPPoE daemon to start:

     USERCTL=no
     TYPE=Ethernet
     [IPV6INIT=no]        # Optional for systems that support IPV6
     DEVICE=eth2
     HWADDR=00:40:33:d3:02:d0
     BOOTPROTO=none
     ONBOOT=no

Once you have hacked the appropriate module in /etc/sysconfig/network-scripts, you should copy it to /etc/sysconfig/networking/devices with the same name:

     cp /etc/sysconfig/network-scripts/ifcfg-ethx
       /etc/sysconfig/networking/devices

or

     cp /etc/sysconfig/network-scripts/ifcfg.ethx
       /etc/sysconfig/networking/devices

After that, make a hard link to the just copied module in the remaining directory:

     cd /etc/sysconfig/networking/profiles/default
     ln /etc/sysconfig/networking/devices/ifcfg-ethx

or

     ln /etc/sysconfig/networking/devices/ifcfg.ethx

Be sure to replace the 'x' above with the NIC's actual number.

/etc/sysconfig/network/ifcfg-eth-id-*:

On SuSE, there is only one file to hack and it is named after the MAC address of the NIC. Here is an example of how to assign an IP address to the NIC at 00:40:F4:1D:37:46:

/etc/sysconfig/network/ifcfg-eth-id-00:40:f4:1d:37:46:

     BOOTPROTO='static'
     BROADCAST=''
     ETHTOOL_OPTIONS=''
     IPADDR='192.168.1.99'
     MTU=''
     NAME='Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+'
     NETMASK='255.255.255.0'
     NETWORK=''
     REMOTE_IPADDR=''
     STARTMODE='auto'
     USERCONTROL='no'

/etc/network/interfaces:

On Debian/Ubuntu-based sytems, there is literally only a single file to hack for all of the NICs. You assign IP addresses (or choose DHCP, for that matter) by editing the "/etc/network/interfaces" file. If you want a static IP address, your file should look something like this:

     auto lo
     iface lo inet loopback
     auto eth0
     iface eth0 inet static
          address 192.168.1.8
          netmask 255.255.255.0
          gateway 192.168.1.1

If you wish to be certain that you always assign your chosen IP address to the same MAC address, you can force the issue by including the actual MAC address in the "/etc/network/interfaces" file, in which case you'll get an error in the log, when you try to bring up networking, if the MAC address ever changes. This may be preferrable to udev just remapping your NIC to eth5 (or whatever), when you install a new one, and having DHCP take over. In that case, networking will appear to be working but when you try to reach the system with its supposed static IP address, you'll get a huge surprise. To force the MAC address to be checked, do this:

     auto eth0
     iface eth0 inet static
          hwaddress ether 00:19:66:17:ea:ff
          address 192.168.1.8
          netmask 255.255.255.0
          gateway 192.168.1.1