Networking Problems, Setting IP Ranges

With the advent of a number of GUI configuration tools, the basic networking tools are being further abstracted from the everyday user. Here are a number of "back to basics" troubleshooting tips to help you identify where problems could be originating.

How Can You Quickly Isolate Networking Problems?

With the advent of a number of GUI configuration tools, the basic networking tools are being further abstracted from the everyday user. Here are a number of “back to basics” troubleshooting tips to help you identify where problems could be originating.

Make sure you’re running as the root user. Otherwise, very few of the following commands will work. More detailed information can be found in the Linux Network Administrator’s Guide (http://www.linuxdoc.org/LDP/nag2).

First, see what the primary networking card in the system is doing:

# /sbin/ifconfig -a

If your network card (eth0 means Ethernet port 0) is properly configured, you will see something like Figure One. If not, you’ll see an error, as in Figure Two. If you see this kind of error, it means that the hardware is not properly installed on the system. To correct this, you may need to use a tool that will load a software module to control the card (this will likely be specific to your distro). Worst-case scenario, you might have to recompile the kernel to support your specific network card. Recompiling is actually outside the scope of this column, but you can check out the HOWTO at http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html.

Figure One: Sample ifconfig Output

eth0 Link encap:Ethernet HWaddr 00:10:A4:A1:E2:37
inet addr: Bcast: Mask:
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:240 (240.0 b)
Interrupt:3 Base address:0×300

lo Link encap:Local Loopback
inet addr: Mask:
RX packets:35906 errors:0 dropped:0 overruns:0 frame:0
TX packets:35906 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

Figure Two: Error Reported by ifconfig

SIOCSIFADDR: No such device
eth0: unknown interface: No such device

It’s also quite possible that the network card software module you’re using may be loading, but it’s not the driver you need. If you have a certain card installed but are loading the driver for another, the kernel might not complain. This is most likely to have occurred if you relied upon an automated network card detection tool in your distribution.

If a problem like this does occur, the kernel may have been generating messages left, right, and center. To look at this output, type:

# /sbin/dmesg

The output from this will give you other kinds of information about your network. For example, you may see a message like:

eth0: autonegotiation failed;
using 10mbs

This indicates that your 10/100 Mbps network card hasn’t been able to successfully negotiate with its hub for the speed it should operate at. In such a case, you may know the machine is attached to a 100 Mbps network, which cannot also handle the network packets that the 10 Mbps device is attempting to send. You will need to consult the documentation for this specific network card to force it to 100 Mbps.

How Do I Configure My Machine to Use a Private IP Address Range?

If you’re running a local area network, using a private IP address range might be a good idea. There are ranges of IP addresses that have been specifically reserved for this purpose. Any router on the Internet is supposed to drop any packets using these addresses. One of the most popular private address range runs from to To configure your networking card to use this range, you might run the command shown in Figure Three.

Figure Three: Setting an IP Range

# /sbin/ifconfig eth0 \
netmask \
broadcast up

This configures the primary network device (eth0) to use as its IP address. The netmask argument means that this system is on a subnet with up to 254 other machines (the final number cannot be 0 nor 255, as they are reserved for special purposes).

If we assumed our gateway’s IP address is, we’d use the following command to properly route packets along to their destination:

# /sbin/route add default gw

A gateway must be on the same subnet as the machine (192.168.0 in this case). If you attempt to route packets to a gateway on another subnet, route will return the following error:

SIOCADDRT: Network is

How Do I Test Network Connectivity From a LAN?

The broadcast address allows you to send a particular message to a number of machines at once. For example, the following command would send a ping to all of the machines on the 192.168.0 subnet:

# /bin/ping -b

As a general rule, Linux machines will respond to broadcast pings, while most Microsoft Windows machines won’t. If you receive ping results, your network is up and running. If broadcast pings fail, try pinging a specific machine using its IP address:

# /bin/ping

A successful ping result looks like Figure Four. If there’s a problem, the output you get might look like Figure Five. In that case, you should make sure that the network cable is attached and the hub has power, and you should verify that the IP address you’re pinging are correct.

Figure Four: Successful ping

PING ( from : 56(84) bytes of data.
64 bytes from icmp_seq=0 ttl=255 time=778 usec
64 bytes from icmp_seq=1 ttl=255 time=44 usec

Figure Five: Unsuccessful ping

PING ( from : 56(84) bytes of data
From Destination Host Unreachable
From Destination Host Unreachable
From Destination Host Unreachable

The next step is to check your route to the Internet:

# /sbin/route -n

This command will give you a description of your current routing table. If you’ve followed the steps above, your table should look like Figure Six.

Figure Six: Typical Routing Table

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface U 0 0 0 eth0 U 0 0 0 lo UG 0 0 0 eth0 UG 1 0 0 eth0

It is most important to make sure that at least one entry in the “Gateway” column corresponds to your gateway’s IP address. If you don’t see any, you will need to add a routing table entry.

Finally, make sure your system is configured to use DNS (Domain Name Service) correctly. You should check your system’s /etc/resolv.conf file. It might look something like this:

search foobar.com

The “nameserver” directives tell your system what IP address it should send DNS queries to, and the order in which they should be sent. Each entry is only queried if all the proceeding entries do not answer the query. There is no practical limit to the number of nameservers you can list, so having some fallbacks is always a good idea.

The search suffix is a useful tool for lazy typists. In most cases, you will find that if you’re often dealing with a number of machines on the same network — say, “foobar.com” — it might be easier to use the foobar.com search suffix. Say, for example, there is a machine “titan.foobar.com”. To get to titan, provided the above search suffix is defined, all that would be required is that the hostname “titan” be entered as in the following:

# telnet titan

The system will look up titan. foobar.com and connect you.

Quentin Cregan is a tech and security consultant and some-time student hailing from Australia. He can be reached at qc@sensed.com.

Comments are closed.