Troubleshooting issues with Network Manager

Network Manager is a tool that is used to manage network connections in Linux. It consists of a daemon that runs in the background, as well as an optional graphical utility that most desktop distributions include to show you your connection status at any given time. Network Manager is not required by any means, but it simplifies the management of your network interfaces and their configuration. In a lot of real-world networks, Network Manager is typically disabled and static IP addresses are used instead. As I've mentioned probably a hundred times so far, I always prefer static leases over static IPs. With a static IP, you do not have the central point of management, and would need to track down and change a server's IP address manually. It is for this reason that I recommend you to keep Network Manager running. It will watch for connections, activate your DHCP client, and then receive an IP address lease from your DHCP server. If you've set up a static lease (reservation) then you're already all set to go as soon as Network Manager initiates your connection.

In the case of networking issues that you've troubleshooted to be an issue local to Network Manager itself, there are several things you can do in order to pinpoint the problem.

First, on CentOS systems, ensure that your network interface is configured to come up on boot. For some reason I cannot understand, CentOS actually defaults to turning your network interface off during installation. Unless you turn it on while running the installer, it will also be disabled by default after you boot as well. If the interface is not enabled, then Network Manager wouldn't be able to manage it. Correcting this is simply a matter of editing the init script for the interface. You'll find init scripts for your network interface cards in CentOS at the following location: /etc/sysconfig/network-scripts. On my system, I find the init script for my interface card at /etc/sysconfig/network-scripts/ifcfg-enp0s3, though the name of your interface will of course differ.

Look at the last line, where you should see ONBOOT="yes". If you don't see that, modify that line and then restart networking:

# systemctl restart network

Second, on Debian and CentOS systems, check to make sure that Network Manager is running. This is one of those rare occasions where the command to do something is the same in both distributions. With the following command, we can check the status of the NetworkManager daemon:

# systemctl status NetworkManager

While troubleshooting issues, systemctl can be very useful as it not only tells you whether or not the service is started, it also gives you a handful of lines from the logs that may be able to point you in the right direction if you're experiencing an issue.

To peruse Network Manager logs in their entirety, you can use journalctl:

journalctl -u NetworkManager

You can also use the -f flag to follow the log, so you'll see new entries as they happen. This is especially useful while troubleshooting why a machine isn't able to connect to a wireless network. Errors will appear as the user attempts to connect. The following example shows how to follow the output of NetworkManager output that gets written to the journal.

journalctl -f -u NetworkManager

As with most systemd units, we can restart Network Manager with one simple command:

# systemctl restart NetworkManager

The previous command may seem like a no-brainer, but for some reason, I've had to restart Network Manager more times than I would like. This is especially true while switching a machine from one network to another, or resuming from suspend (though those issues primarily only come up on end-user workstations).

For the most part, issues with Network Manager are rare and troubleshooting it is relatively straightforward. Using systemd's journalctl, we can watch Network Manager's output and determine the root cause. In most cases, the issue will come down to a misconfigured network card.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset