Server is Not Reachable

Imran Afzal
A free video tutorial from Imran Afzal
Systems Manager / Engineer / Instructor
4.6 instructor rating • 14 courses • 168,956 students

Learn more from the full course

Complete Linux Troubleshooting Course (Practical Examples)

The Best Linux Troubleshooting and Administration Course that prepare you to diagnose and resolve Systems issues

17:38:26 of on-demand video • Updated May 2020

  • Troubleshoot IT and Linux related issues with effective tools and techniques
  • Save time when troubleshooting is done with the correct approach
  • Manage your company's IT environment and respond to critical issues smoothly
  • Diagnose and Repair Common Networking and Filesystem Errors
English [Auto] Server is not reachable or many times people will refer to as servers not Pangle or I cannot connect to the server. So now let's get into some technical side of the things we we cover most of the conceptual things. So now let's get into where we could actually run the commands and actually troubleshoot by logging into the server. So when you get an issue where someone reports a server is not reachable there are a few set of rules that you have to follow that I'm going to show you one by one. First thing is you have to do is you have to ping the destination server the server that is having the issue. Ping is the command that is built in with your Linux operating system and any flavor that you have in Linux. Ping comes pre-built a pre installed in your server so you have to bring up your computer and run the command paying followed by the server name. So let's do that. As an example I have my linux machine up and running and it's my linux machine name is my first Linux VM now. The first thing I wanted to do is let's say this someone says the server a cannot connect to server B so that what is the name of the server. Of course they will give you the information the server B is X Y Z. So in our example I will do is helping the Google ping Google dot com. So this is the first thing you have to do from your source. This is your source computer and you are going to your target or destination computer which is Google. So you go ahead and run ping Google dot com and you could see you are getting the results back which means 64 bytes from this and it is coming back and it's going and doing an ICMP protocol and it's going to Google and asking hey are you there. Are you there. And Google server comes back and says Yes I'm here I'm here and you are getting a response back. Perfect. So that is the first thing you have to do. Now going back to our set of steps. Second is if the server name is not Pangle. So you run the ping command and you you and you are not getting a pinger return. So what do you do. Well let's look at our machine again and we will pick something we'll make up something that will not going to pick. So I will do ping Google instead of dot com. I'll do go google dot C.P.. I know Google RCP is and doesn't exist. It doesn't have a server. There is no host or DNS entry for it. So I'll go ahead and ping it and it says ping googled ICP name or service now found. So now the next thing is you have to do is it means that there is your name that the DNS entry for Google dot C.P. does not exist. So you have to find the IP address of this destination server. So if the server name is not Pangle then ping the destination server IP address and how do you find the IP address. There are a couple of ways to find the IP addresses of course. First you go into your own documents. Go and find out what is the IP address of the server that is down and then you go in and paying the IP address. Now let's say if I if you know the IP address of Google. So. And we need to find out the IP address of the Google will do. And let's look up and let's look up is another command or tool or utility that tells you or that translates you hostname to IP address. So that's to Google dot com and hit enter. You'll see it will return the name of the server and the IP address of the server. OK. So now you go ahead and ping one I 172 2 1 7 dot turned out 14 and enter and now you see it is pinging that server by the IP address. If you do the same thing to Google dot C.P. dot com group then. So Google does only then you will see that it is saying that I'm going to find the DNS information for that. But I can not find it. It says server can find Google dot C.P.. Mm hmm. Yes because of course it doesn't exist. So let's go back to a set of instructions paying the server paying the destiny server by IP. We did ping it and it was Pangle. So it means there is something wrong with the DNS. So now it says if IP is bankable then it means something wrong with the name resolution issue. So what the next step that we need to do if we could ping from the IP but we cannot ping through the name then what we need to do is first we need to check the SC host file at sea hosts file is the file a local file in a Linux or. There is also at file and windows as well. But the path is not Etsy. So that file is actually keeps the record locally off a hostname and translate it to the IP address. So if I do cat hosts you'll see there is an IP address of my local host meaning my local computer if I'm paying local host you see it is pinging my local host with that IP address so I will go in and I'll check. Do I have an entry for the server that I'm pinging in my FC host. If it's not there then what do you do next file you need to check it. Etsy resolved a cough is your server really has a DNS that is actually going in resolving it. So to verify if you do cat at sea resolved conflict. This is where the DNS server information is saved. So we are telling my machine which is this machine that every time you need to go out and resolve the hostname with an IP address then you need to go to name server as one aide to 168 out one down one. This is the name or this is the IP address of my modem or my ruler. This is all this IP or this modem also serves as my DNS server my local DNS server. So it is telling it every time you need to resolve something go to this. So I have verified it. It is there. Now every time when you need to resolve from host name to IP address there is an other file in your Linux machine do you remember the file. Okay. If you don't. The next file you have to check is called Etsy N.S. switch dot com file. What does that file does that file is actually tells your computer Hey Ben ever you need to resolve hostname to IP address. I will tell you to first go to the DNS server or go to Etsy file or wherever you have to go. I'll tell you where to look for. So let's see what cat at CNN switched our car file says when you go in here you will see if you go scroll up right here. It says the password file is a local file of course. Now we're looking for here. We are saying that we are looking for host if I need to resolve a host name with an IP address where should I go and my computer or my server says hey first you need to go to files which is what my at C host for first go into their file and see if you could find the host into IP address. If you can not find it then the next thing you need to do is to go to DNS. OK. I will go to DNS now who is my DNS. Where should I go to ask how to resolve hostname to IP address the DNS server to find it is where it's right here at C result dot com. So go at C resolved. Kavi already cover that. And that is where it will go to find the host name an IP address coming back to our set of instructions. If IP is Pangle then it means something is wrong with your name and resolution. So you will check all these files. Next thing if IP is not Pangle. So you paying for the server name you're paying the the IP nothing is working. You cannot ping then what could be the issue. Well ping another server by the name and then by IP maybe the server we are trying to work with is actually down. So regardless you ping with the hostname or with the IP server it is actually down. So what you do is you could try to paint another server in the network to see if you could reach other servers such first tribe with the name and then try with the IP address. So I'll go in and I will do is I will paying instead of Google let's say I'll ping yahoo dot com and I'll say Hey yes I could ping it. Perfect. So it means there is nothing wrong with me or my computer my computer can ping other computers or other servers. There's definitely something with the Google or that your destination server. Next step is check if your server has an IP address. So if you can not paying another server meaning if you're trying to ping into the server let's say a Yahoo dot com and you cannot ping that then then definitely something with your own server. So check if your own server has an IP address how to check that you're on the command if config the F config command is the command that gives you the IP address of your own computer. Yes you do have an IP address and yes you could get onto the network so which you have confirmed already. That is perfect. Now the next step is paying your gateway and modem IP. So what is my gateway. So most of the time you could find your gateway information by doing nets that Dash are and WI when you hit enter. You'll see the gateway is right here. So now the next step is. See if you could go to Gateway and gateway is the one that actually is going to let you go out and ping the server. So I'm going to go ping one ninety two 168 1 to one and enter. Nice. OK. I could ping my gateway. That is perfect. So now the question is if I cannot pay my gateway or even if I could ping my gateway but I could still can not go outside or I cannot ping Google or I cannot ping Yahoo. Then what. Then the last thing that I have listed here is check physical cable connection. Yes it does happen it happened and I've seen it a few times. You need to go to your own server. This or that you logged in by the way you won't be able to log into the server anyway if your cable is disconnected but I'm just saying just in case let's say if you are connected on the console or you are it's your laptop you you're logging in straight to your laptop then check the physical connection or check your wife I know whether it's working or not. Along the same line going one step back when you are pinging your gateway you also have to verify that your gateway traffic or your routing is also set correctly. How do you check. You run the command nets that Dash are and we hit enter. You need to make sure all the traffic going to where ever is going because you see right here the first column says traffic wherever are you going which ever the IP address you're going. Every time you have to go outside you have to go through the gateway from 1 9 2 1 6 8 1 down 1. That's what it's telling it and it's telling it gateway. Just think of Gateway as actually the gate to go outside. So when you have that set then it means you are all good. If you do not have that said it means you do have an IP address but somehow you can not go outside because you do not have a route. So if you are leaving your house for example you know how to leave your house right. You know there is a front door. You could leave from the front door but if you do not have that. If you do not know where the front door is then you cannot go anywhere. Right. So that works the same way. You have to define where your front door is and the way you could define it. You could define it in this routing table. If this is not set then you have to there's something wrong with your routing table and you have to run some routing commands to set your routing table and then it should work.