View the Most Wanted LQ Wiki articles.
LinuxQuestions.org > Linux Wiki > Network Troubleshooting

From LQWiki

Jump to: navigation, search

So you have a network problem. This means your source host cannot reach a target host via the network. It can be that you cannot reach a website with your browser or anything else, no matter what it is, it is important to ask the right questions:

Do you have an IP address

Most probably, you are using the IP protocol stack. For this, you need an IP address, otherwise, you need to fix this first. Find it out e.g. like this:

$ ifconfig
eth1      Link encap:Ethernet  HWaddr 00:1C:F0:BB:06:C8
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:f0ff:febb:6c8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:107889950 errors:0 dropped:0 overruns:0 frame:0
          TX packets:273562838 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9617038808 (9171.5 Mb)  TX bytes:369837330592 (352704.3 Mb)
          Interrupt:21 Base address:0xc000 

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:98106539 errors:0 dropped:0 overruns:0 frame:0
          TX packets:98106539 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:355210630999 (338755.2 Mb)  TX bytes:355210630999 (338755.2 Mb)

In this example, your network card eth1 has the IP address 192.168.0.5. The interface "lo" is quite useless, you need another one (typically called ethn, wlann or bondn where n is a number) you will need to have this fixed first. If you have it, proceed with the next chapter.

Can you ping

You need to be able to reach another computer in your subnet, so try to ping another computer in your subnet. Broadcast pings can show you which computers are online.

Can you route

If you try to connect to another subnet, your computer must be able to route your IP packAges. So, try

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.0.0     *               255.255.255.0   U     0      0        0 eth1
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.0.1     0.0.0.0         UG    0      0        0 eth1

In this example, you gateway is 192.168.0.1, so try pinging it:

$ ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.429 ms

In the above example, an answer came for the ping (time is not so important here). That means, you can reach another computer and even your gateway, so, connections out of your subnet should not be a problem.


Personal tools