Network Debugging

From ArchWiki
Revision as of 00:04, 21 May 2011 by Fukawi2 (talk | contribs) (IP Address and Netmask)
Jump to: navigation, search

Basic Checks

You should be root to perform these checks since networking affects the whole system, many commands require root privileges.

If you are unsure of what any of these values should be, compare the output of the below commands with the same commands when using DHCP, or ask your Network Administrator.

IP Address and Netmask

Use the command `ifconfig eth0` to ensure you have a valid and correct IP address + Netmask combination. Replace 'eth0' with the appropriate interface for your machine, though it is usually 'eth0'.


The line of interest is the second line, starting with 'inet addr:'. In the above example, our IP Address is '' and our subnet mask is ''. Both of these examples are commonly used values.

Default Route

Ensure you have a default route set; this tells the kernel where to send packets for hosts other than the local network. A default gateway is your Cable or DSL modem.


The last line with both 'Destination' and 'Genmask' set to '' is the default gateway. In the above example, our default gateway is ''

DNS Servers

DNS servers are what converts domain names into IP Addresses. If you are able to ping IP Addresses outside your network, but not open websites etc then it is likely you have missing or invalid DNS servers configured.


  • The 'nameserver' line is the relevant part of this file.
  • You may or may not have the 'domain' line.
  • There may be additional lines, and/or multiple 'nameserver' lines.
  • It is common for your 'nameserver' to be the same as your default gateway (see above).
  • If you are unsure, you can usually use Google DNS as your DNS Servers:
Note: Using OpenDNS is possible but can make later diagnostic testing difficult: "OpenDNS, surtout pas".

Further Testing


Test to ensure you can connect "out" one-step at a time. Start by pinging your default gateway. Replace '' with your default gateway (as shown in `route -rn` from above:

# ping -c4
PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=64 time=0.193 ms
64 bytes from icmp_req=2 ttl=64 time=0.190 ms
64 bytes from icmp_req=3 ttl=64 time=0.192 ms
64 bytes from icmp_req=4 ttl=64 time=0.189 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 2999ms
rtt min/avg/max/mdev = 0.165/0.184/0.193/0.014 ms

The output above is considered successful; each line starts with "64 bytes from <ip address>". If you instead get errors stating "Destination Host Unreachable" then check and ensure that your IP Address/Netmask and Default Route are all correct.

Ensure this test SUCCEEDS before moving on to further tests!

Next, test if your router is passing traffic to the outside world correctly. Test by pinging a public address by IP Address. Google's DNS servers are good for this test since they respond to ping requests and are easy to remember:

# ping -c4
PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=51 time=171 ms
64 bytes from icmp_req=2 ttl=51 time=170 ms
64 bytes from icmp_req=3 ttl=51 time=170 ms
64 bytes from icmp_req=4 ttl=51 time=170 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 170.290/170.915/171.579/0.461 ms

Again, the above output is considered successful. If this test fails then it is likely that your PC is configured successfully, but your internet connection is disconnected for some reason.

Test DNS Servers

Check your current DNS servers in /etc/resolv.conf then test them, starting with the first.

Note: You will need the 'dnsutils' package installed to perform this test.

Using the `dig` command, send a directed DNS query (using the '@' prefix to tell `dig` which server to ask) to your DNS servers for a DNS record. In this example, our DNS server is '' and we are asking it for ''

The important parts to this output are highlighted in bold below, and listed here:

  • The "HEADER" line that states the 'status' is 'NOERROR'
  • The "flags" line that shows we got 1 'ANSWER'
  • It may also be relevant to ensure the 'ANSWER SECTION' provides the correct IP Address (for this is currently
  • If you are having performance issues, check the "Query time" value near the bottom. If this is more than ~500ms then there is a network performance issue somewhere that requires further investigation beyond the scope of this wiki article.
# dig @

; <<>> DiG 9.8.0 <<>> @
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14697
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

;			IN	A


;; AUTHORITY SECTION:		61676	IN	NS		61676	IN	NS		61676	IN	NS		61676	IN	NS

;; ADDITIONAL SECTION:	61675	IN	A	61675	IN	A	61675	IN	A	61675	IN	A

;; Query time: 264 msec
;; WHEN: Fri May 20 15:45:17 2011
;; MSG SIZE  rcvd: 195