Monday 24 June 2013

Linux Network Troubleshooting




  1. First check the network ip address of the system using ifconfig /all. This will list ip address along with the default gateway of the system.
  2. If the machine does not take any ip from DHCP Server then use dhclient  to query the DHCP server so that it may give an ip address to the system.
  3. Use the route –n to check for the default gateway (one with destination address as 0.0.0.0). Check the ip of default gateway and check the connectivity of the system by pinging the gateway.
  4. Default gateway can be changed(deleted/added) by using the following command

# route del default gw 192.168.1.1 ( Deleting the default gateway 192.168.1.1)

# route add default gw 192.168.1.2 ( Adding the default gateway 192.168.1.2)

Default gateway is the ip through which packets leave the local network (go to internet)


  1. Check the DNS server entry in  /etc/resolv.conf  file. DNS server entry is marked
with “nameserver=x.x.x.x” in the file. DNS server is used for querying the hostname for the requested ip address. If no DNS server is listed in the file then we can edit the file to enter the DNS server ip address. Some public  DNS servers are 4.2.2.1, 4.2.2.2, 4.2.2.3, 4.2.2.4, 4.2.2.5 , 4.2.2.6 etc.

     
  1. Use the following command to view/change the Linux network settings (ip address, dhcp , dns , gateway etc.)

# system-config-network


  1. We can also use the following command to view network settings.

# cat /etc/sysconfig/network-scripts/ifcfg-eth0

will list the network details.

  1. Use the following command to find query ip address mapping to hostname.

# nslookup
> microsoft.com


Will list the DNS server being used along with the ip address of the site microsoft.com.This can be used to check that which DNS server is being used and
wether or not there is an entry for the given site in that DNS server.

    

  1. In some cases it is found that the system does not take an ip address because of the conflict with qemu (Linux virtual server) bridging with the local network service..In this case first check wether qemu is turned ON/OFF in level 3, 4 & 5( runlevels) by issuing the following command:

# chkconfig  --list | more

This will list all the Linux services (qemu also) with their status (ON/OFF) in all the runlevels.

Hence we can turn a service ON/OFF.

            Thus if qemu is showing ON status in say level 3, 4 & 5, then we need to turn it  
            OFF in the above levels using the below command.

            # chkconfig  --level 345 qemu off

            will turn the qemu service OFF in run levels 3,4 & 5.
            Also check that Network service is turned ON in run levels 3, 4 & 5.

  1. After this restart the network service using

# service network restart



    



No comments:

Post a Comment