Network tips

Configuring network adapters for the school server

Posted on March 20, 2012

Quick summary:


  • ifconfig — use this to see which interfaces are recognized, and whether they have correct ip addresses, error packets
  • “ip addr” — gives a shortened form of ifconfig
  • “netstat -nr” — to see if there is a default gateway set
  • contents of the /etc/resolv.conf — tells where  tcp  will look for a name server to resolve names to addresses
  • “service network restart” — to see if the config file changes you may have made are having the desired affect (do a full reboot, and look at ifconfig, before you conclude that everything is set properly
  • “xs-swapnics” — olpc provided script in /usr/bin to swap eth1 and eth0 so that wan and lan wires can be reversed. (I plan make the changes by hand if there are a lot of USB network dongles involved).
  • “dmesg | less” — allows you to see whether the network adapters were discovered by the kernel during the boot process (search for “net” or “eth”)


  1. /etc/udev/rules.d/70-persistent-net.rules — during start up, when the kernel finds a network adapter, it uses the unique hardware address of the adapter, to try to give it the same eth<number> it had last time. If the hardware is not in the list, (perhaps a new usb dongle), it makes a new entry in the list and assigns the next available number. the comment at the head of the file says that this rules file is machine generated, but that it is ok to change the value of the name key. You often will need to do this to point to the correct “ifcfg-eth<X>” file (number 2).
  2. /etc/sysconfig/network-scripts/<ifcfg-eth0, ifcfg-eth1> — these files specify whether the interface should use dhcp or static ip address. Any errors in these files will silently keep an adapter from showing up correctly in ifconfig.


Having more than one network adapter on a linux machine has always been confusing. 10 years ago, as the kernel was booting up, it would “find” one of the network adapters first. Whichever one it found first it assigned the device name eth0. Any additional network interfaces became eth1, eth2, etc.  But it didn’t always find the adapters in the same order. Or a new network card, or usb stick, could change the order in which they were found.

To solve this problem, developers created the /etc/udev/rules.d/ system where hardware is recorded the first time it is seen by the kernel so that consistent device naming is possible.

So the /etc/udev/rules.d/70-persistent-net.rules file is really aa lookup file where the hardware address of the adapter is used  to look up the the eth device name and therefore the config file that it will use to try to bring up the interface.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.