Diagnose internet connection issues using command line

28,862

Solution 1

There are a number of things to check. I would begin by checking these things:

  • command "ifconfig": ensure that you have an IP address and the correct net mask on the adapter you're connecting through. If you have multiple adapters on your server, make sure the right port is plugged in.
  • If you're using a static IP, try switching to DHCP if you can. If it works now, you've got some settings that are not being properly set when using the static IP.
  • command "ping default_gateway_ip": put the ip address of your gateway in to see if the server can communicate within your network
  • command "ping 8.8.8.8": test if traffic is flowing directly to a remote address.
  • command "ping www.google.com": test if you can resolve an address via DNS
  • command "route": make sure your default gateway is set, otherwise traffic won't properly route to external networks. (look for the UG flag)
  • command "service iptables stop": turn off you're firewall and test if it's mis-configured (don't forget to turn it back on)

If any of these fail, you should be able to do a web search to find a solution.

Solution 2

You can try some of the basic troubleshooting steps if you haven't already.

Try to ping speedtest.wdc01.softlayer.com, does it resolve the DNS name? If it does, then your DNS is working correctly. Does the ping respond with the IP address of that website? If yes, then your IP connectivity is working correctly.

You could also try the same thing with google.com to verify with a different address etc.

Try a traceroute to see how "close" it gets to your destination, it could be something on your system, or it could be something out of your control. These tests will help you narrow that down.

You can also verify you have the right IP/Subnet/Gateway by running ifconfig and also looking at the /etc/sysconfig/network-scripts/ifcfg-eth0 file, you can make sure the DNS servers your server uses are correct by looking at the /etc/resolv.conf file.

Share:
28,862

Related videos on Youtube

user1766888
Author by

user1766888

Updated on September 18, 2022

Comments

  • user1766888
    user1766888 over 1 year

    I'm having multiple issues trying to get CentOS to download anything. I can't get yum to work because there is a time out when trying to access a file. Anyways, is there a way to trace why a command won't get past a certain phase?

    For example, if I run the following command:

     wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test10.zip
    

    wget hangs on Connecting to addressFromAbove and finally times out a couple of minutes later.

    How can I diagnose this issue?