Ubuntu network troubleshoot – Fix No Internet issue

Network troubleshoot in Ubuntu is the combined measures and processes used to identify, diagnose and solve problems within a computer network. There are always chances of failure in the smooth operation of the network because of misconfiguration, hardware issue or any other faults.

By collecting the right information about the problem and how it came, you will have a much better chance of resolving the issue fast and quickly. By doing that, you don’t need to try unnecessary fixes. Linux provides some command line tools to figure out exactly what’s going wrong on your network, and by doing self analysis you can fix it.

In this guide, we will discuss solutions to troubleshoot Ubuntu network, whether it’s a personal network or a network that you manage professionally as a network administrator.

1) Do the common things first

Before we deeply dive into the problem and troubleshoot network in ubuntu, it is always good to look at some common network issues, some tips for quickly resolving problems that people encounter. Try the below solutions one by one and move to the next solution if it does not work:

  1. Restart your router and system.
  2. Unplug and plug in again the ethernet cable from both the computer’s ethernet port and the router’s ethernet port.
  3. Replace your ethernet cable which is connecting the devices. The cable which connects two devices can become faulty or can be physically damaged.

2) Forget and Reconnect WiFi network

If your device is connected via WiFi then, Make Ubuntu settings to forget that network and reconnect it.

3) Check network interface connectivity

Once you have confirmed that you are physically connected to the network, the next step is to confirm that the network interface is configured correctly on your host machine. Let’s check it by running the ifconfig command. 

Ifconfig (interface configurator) command displays current network configuration information, setting up an ip address, netmask or broadcast address to an network interface. 

sudo ifconfig eth0

Now, investigate the second line, which tells us what ip address (192.168.1.101) and subnet mask (255 .255.255.0) has been assigned to the host. If the IP is not showing then follow below steps:

  1. If the network adapter does not display an IP address, disable the network adapter in the and enable it again.

sudo ifdown eth0

  1. Wait a moment and then re-enable the network adapter by running ifup command. Then run ifconfig again to see if IP is assigned or not.

sudo ifup eth0

  1. Check the network interface configuration again to see if the network adapter now has an assigned IP address.

sudo ifconfig eth0

  1. Analyze /etc/network/interfaces and verify any network setting error:

cat /etc/network/interfaces

  1. Restart the networking service:

sudo service networking restart

  1. Restart the DHCP service:

sudo service dhcpd restart

4) Check network connectivity

The ping command is one of the most used Linux network commands in network troubleshooting. It provides a basic connectivity test between the requesting host and a destination host. The ping command test connectivity by sending an ICMP echo request to check the network connectivity.

ping www.google.com

The output will be like the above screenshot which shows a successful ping. In Linux, ping commands keep executing until you interrupt. Press Ctrl + C to stop ping response. If it does not work then it means there is a physical problem in the network itself.

5) Diagnose DNS(Domain Name System) records

After confirming that you can connect to the gateway, the next thing to test is whether DNS functions. Dig is a network administration command-line tool for querying DNS name servers. It is useful for verifying and troubleshooting DNS problems and also to perform DNS lookups. You can use the dig command to verify DNS mappings, host addresses, MX records, and all other DNS records for a better understanding of DNS topography.

dig google.com

Dig displays a QUESTION SECTION (the request) and an ANSWER SECTION (what the DNS server sends in response to the request). Here, we have used the default options for dig, which simply looks up the A record for a domain. To solve problems you need to know where the problem is. Using the dig-command you can learn about a given network and domain configuration.

6) Diagnose where the connection fails  

1) “traceroute” command: once the ping utility has been used to determine basic connectivity, you must test whether you can route to the remote host. The traceroute utility can be used to determine number of hops taken to reach destination host including the route the packet takes and the response time of these intermediate hosts. 

traceroute google.com

You will gradually see the route take form as your computer receives responses from the routers along the way. This command prints to the console, a list of hosts through which the packet travels in order to the destination. You can see the hostname, IP address, the hop number, and packet travel times.

If your traceroute dissolves into some asterisks (*), there is a problem with the route to the host as the asterisks indicate packet loss or dropped packets. Now, you will need to investigate why it can’t route packets between the two networks. 

2) “mtr” Command (Realtime Tracing): A dynamic alternative to the traceroute program is mtr. mtr(my traceroute) is a command line network diagnostic tool that provides the functionality of both the ping and traceroute commands. mtr allows you to constantly poll a remote server and see how the latency and performance changes over time. It is a simple and cross-platform tool that prints information about the entire route that the network packets take, right from the host system to the specified destination system.

Unlike traceroute, mtr is not installed by default in linux servers. You need to install it by typing the following commands.

sudo apt-get install mtr

Once it is installed, you can use below command::

mtr google.com

The best thing about mtr command is that it displays real-time data unlike traceroute. This allows you to accumulate trends and averages, and also allows you to see how the network performance varies over time. 

Furthermore, you can use the mtr command with –report option, this command sends 10 packets to each hop found on its way like this:

mtr –report google.com

7) Arp Command

Address Resolution Protocol (ARP) is a procedure for mapping a dynamic IP address to a permanent physical machine address in a LAN. The physical machine address is also known as a Media Access Control or MAC address.  If you try to connect to an IP address, your router will check for your MAC address. If it is a cached, the ARP table is not used. To view the arp table, use the arp command:

arp

By default, arp command shows the hostnames, you can show IP addresses instead like this:

arp -n

You can delete entries from the arp table like this:

arp -d HWADDR

8) Run Antivirus Scan

  1. Network viruses can completely disable a computer network. Viruses can come from a wide range of sources such as e-mail attachments, malicious software,  social media etc. Scan your computer by antivirus and restart it

That’s it. This is all about the various fixes to troubleshoot network in ubuntu. I hope after reading this guide, you would be able to fix your issue easily by one of the solutions listed above. If it still did not work then you need to throw your problem in the ubuntu community.

Did you enjoy this troubleshoot article? Please like and share this post with your friends and colleagues. It will help and motivate us to post articles with quality content.

You May Also Like

About the Author: softwaretrickadmin

I am a professional software developer and founder of softwaretricks.net. I have a passion for troubleshooting and solving software problems on Windows and Linux. I love to write articles for installation steps and troubleshooting software problems. I am always ready to accept challenges!!