When we can't reach a server, we try to ping it using the below:
If we don't get a response we try to ping its IP address:
If the IP address "ping" is successful, we would know that we have a name resolution issue and we check the below files.
We check the "/etc/hosts" to see if the name of the host and its IP address are in the file.
We can also check the "/etc/resolv.conf" to see if the we have the right DNS server IP address:
The "search" option allows us to use "short" names for the hosts.
We can use the below command to "ssh" to "site.company.com":
The system will add "company.com". It will be as if we have typed the whole name of the host:
We check also the "/etc/nsswitch.conf" that tells the system the order in which these files (/etc/hosts, /etc/resolv.conf) should be checked to resolve the name of a host (in the example below the order is : file then dns):
files : checks the list of "IP/name" pair values of hosts in the "/etc/hosts file".
dns : checks the list of DNS servers to consult in "/etc/resolv.conf"
IP address not reachabe:
If the IP address is not reachable either, we use the below command to check the network interface to see if its active and that it has the right IP address:
We could also release our IP address, if we are using a dynamic IP address:
And ask for a new IP address from the DHCP server, using the below command:
The default gateway:
We check that the packets can reach the default gateway and we ping the it.
We can get the IP address of the default gateway using the below command:
If we can't ping the default gateway, we might want to check our physical cables.
We would also need to check if the entries in the routing table are accurate. We can display the routing table using the below command to check if our gateway is in the routing table and that it is set correctly.