3 Days of Networking Troubleshooting – Day 1: Hardware, Modules and the Network Subsystem

Most Linux distros today will automatically configure your network as soon as you boot. Indeed, most will set up networking for you as you install. However, there is a (very small) chance something conks out and you end up having to do things by hand, or you may need some sort of special configuration.

Conventions used in this guide

Throughout our command line tutorials, we use $ to indicate you can run the command shown as a regular user, and # to indicate you must run the instruction as superuser/root or using sudo.

When we show both the instruction and its output, what you have to actually type is shown in bold.

If you’re having trouble connecting to your home or office network, the first thing to check is your hardware.

Although support for wireless cards is pretty universal in GNU/Linux nowadays, support for wired network cards is even more universal. If you are not getting a WiFi connection right of the bat and your computer has an RJ45 network port, i.e. one of these:

RJ45 port on a laptop computer.

RJ45 port on a laptop computer.

Use it! The main thing for now is to be able to connect to the net so that solving your problem is easier.

Wait a few seconds after plugging the network cable in and then try pinging an internal IP address, e.g. your router. If that works, try an external IP, for example, and then an external web address, such as google.com.

Still no network? Network cables break. Often. Change the cable, make sure it is firmly plugged in and run through the ping routine described in the paragraph above again.

Ping Pong

A ping command sends out a short burst of data (also called “ping“) that many computers on the internal network and the Internet are programmed to answer with another short burst of data called “pong” (isn’t that adorable?). Ping is the most basic way of diagnosing network problems and the first thing you should use to check your connection.

Using ping is very straightforward:

$ ping google.com
PING google.com ( 56(84) bytes of data. 
64 bytes from google.com ( icmp_seq=1 ttl=54 time=20.1 ms 
64 bytes from google.com ( icmp_seq=2 ttl=54 time=20.7 ms 

Tells you google.com is up and you can connect to it. To stop pinging hit [Ctrl] + [c].

You can use a URL (i.e. a web address) as shown above, or an IP number:

$ ping 
PING ( 56(84) bytes of data. 
64 bytes from icmp_seq=1 ttl=55 time=16.2 ms 
64 bytes from icmp_seq=2 ttl=55 time=16.1 ms 

The output above shows we are reaching machine, which is the address for one of Google’s DNS servers (more about those later on in the series). The server is answering every 16 milliseconds more or less.

If the connection between your computer and the target computer were, for any reason, down, you’d get:

$ ping 
PING ( 56(84) bytes of data. 
From XXX.XXX.XXX.XXX icmp_seq=1 Destination Host Unreachable 
From XXX.XXX.XXX.XXX icmp_seq=2 Destination Host Unreachable 

Where XXX.XXX.XXX.XXX would be the IP of your own computer.

If the network were completely down on your end, ping’s output would look like this:

$ ping 
connect: Network is unreachable

Modules and Cards

If you *still* don’t have a working connection to the net, check your network card is recognised. It would be rare if it wasn’t, but use lspci all the same. My machine gives me:

# lspci -k | grep -A 2 -i net
03:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000 [Condor Peak] 
       Subsystem: Intel Corporation Centrino Wireless-N 1000 BGN 
       Kernel driver in use: iwlwifi 
05:00.0 Ethernet controller: Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet (rev c0) 
       Subsystem: ASUSTeK Computer Inc. Device 1851 
       Kernel driver in use: atl1c

This shows the drivers are loaded, atl1c for the wired Ethernet and iwlwifi for the WiFi.

If your network cards don’t show up, or do show up, but there are no drivers loaded for them, there’s your problem. Do some research into your hardware. Again lspci can be helpful here — even if it does not identify your card as a network card, it can tell your the manufacturer and the name of the internal chipset so you can look it up on the Internet. Look for the module for your distro online, compile it and load it in by hand with

# insmod [module_name]

and run through the lspci and ping routines again to see if things have improved at all.

Network subsystem

All your drivers are loaded but still can’t connect? Check the network subsystem and see if it is up. In modern Linux distros, the network subsystem is managed via systemd.

To check if it is up, you can run this as a regular user:

$ systemctl status NetworkManager 
# systemctl status NetworkManager 
• NetworkManager.service - Network Manager 
  Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled) 
  Active: inactive (dead)

That, by the way, is what a network subsystem looks like when it is down — see where it says Active: inactive (dead)? That’s your problem right there.

To get the network up (or restart it), try this as root:

# systemctl restart NetworkManager

And then check the status again:

$ systemctl status NetworkManager
• NetworkManager.service - Network Manager
    Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
    Active: active (running) since Tue 2015-10-13 14:43:15 CEST; 1min 6s ago
 Main PID: 2382 (NetworkManager)
    CGroup: /system.slice/NetworkManager.service 
                 1335 /sbin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/dhclient-enp5s0.pid -lf /var/lib/NetworkManager/dhclient-ff9bcd90-6213-4084-900d-ce27dcfaab82-enp5s0.lease -cf /var/lib/NetworkManager/dhclien... 
                 2382 /usr/sbin/NetworkManager --no-daemon

Notice the Active: active (running) line.

See if you have network connectivity by running through the ping routine suggested above again.


To summarise, follow the list of tasks below to solve most connectivity problems like a pro:

  1. Connect a cable to the RJ45 port on your computer.
  2. Try pinging an external machine.
  3. Check the cable!
  4. Try pinging an external machine again.
  5. Check the availability of a driver for your hardware with lspci.
  6. Find and load a driver by hand with insmod.
  7. Ping that thing!
  8. Check network subsystem with systemctl status NetworkManager.
  9. Restart network subsystem with systemctl restart NetworkManager.
  10. Ping, ping, ping!

In part 2 we delve into the intricacies of configuring a makeshift wired connection by hand with and without DHCP, using the new set of GNU/Linux networking tools. Especially useful, when despite doing all of the above, you still can’t get online.

In part 3 we turn our sights onto WiFi connections. You learn how to troubleshoot and set up step by step a wireless connection manually, which in itself is a whole new kettle of fish.

Cover Image: Network NIC by Chris Ciapala for Pixabay.com.