| technology | networking - Graeme Messina
15 Linux Tools to Fix Network Issues
Part of CompTIA's Linux+ exam deals with the networking side of the operating system. In order to pass the exam you will need to understand how to configure your network devices — and where those configuration files are located.
Linux is an incredibly versatile operating system that can be used in anything from servers and desktops to Raspberry Pi units and smartphones. To get these different devices and operating systems to communicate with one another, we need to understand how to configure and use networking technologies properly.
To help us, we will look at some basic applications and configuration files that are commonly worked on in Linux — and how they relate to the Linux+ certification.
What is the Basic Linux Network Setup?
If you are new to Linux and you have never set up a network device in this operating system before, then now is a good time to learn how. This can be done in two ways, either by using the graphical user interfaces (GUI) or from within your terminal window with commands that are typed into it manually.
The GUI is normally much easier to use than the text based terminal as it provides you with a lot of basic information without you needing to remember any commands or command line switches.
If you are wondering why you would want to know how to configure a system via the terminal then you have come to the right place. Terminal commands are for people who want more control over what they are doing and how things work on their system(s). Knowledge of terminal commands is very important for the Linux+ exam so it is definitely worth learning how the basics are done.
The GUI method of configuring networking devices uses Network Manager which comes pre-installed as part of Linux distributions such as Mint Linux, where it is the default networking package. This application makes setting everything very easy but does not give users much flexibility when compared against manual configuration methods.
You will need to know how to edit files directly through command line tools such as nano, vim and other terminal text editors.
6 Most Common Linux Network Commands
Basic networking setup and configuration of a system is available in many different forms on a Linux system. This includes both GUI methods as well as manual command line tools. The most common ways of checking your network settings from the command line is by typing:
This will reveal all of the current connection details of your interface cards, both wired and wireless. You will be able to quickly and easily tell if your network configuration is correct or not be looking at your currently assigned IP addresses in the case of DHCP. If you have manually configured your own IP address then you can also check hose details there.
If you need to change any details for your network interface card then you can find that configuration file and edit it by typing:
This will open up the interfaces of your system inside the nano text editor, allowing you to change the IP address, netmask and gateway of your system. You can also specify the DNS server you want to use, as well. The interface file is read by the system at startup and it will configure your network card with all of these details automatically.
Ping sends out an “echo packet” which contains all of your data and waits for its return, just like you would when talking on a phone or sending someone an email asking them if they got it.
Pinging works by using ICMP protocol’s echo request packets as well as listening for responses from this host. This is done in order to determine whether there are any connection problems such as latency issues with high ping times.
This can often indicate a poor connection, especially if there are failures, as is the case if the response packets do not reach their intended destinations.
Netstat is a very powerful tool that displays all connections on your system, both incoming and outgoing. This includes the ports where they are connecting from and to so you can verify if there’s any connection issues or malicious software running but not detected by other programs.
Netstat quickly shows what kind of network activity is happening on its own computer as well as remote computers connected to it.
Dig is a Linux command for DNS operations. This tool is useful on larger networks, and for diagnosing internet issues related to DNS.
The dig utility enables you the ability to test your current DNS server and view any related information like A Record, CNAME, MX Records with the help of Dig commands
NSLookup is a command which verifies DNS names. It will show you the current state of connections to your computer and what it is sending and receiving.
9 More Important Linux Tools
Linux is crammed full of networking tools that help you to get the most out of your system. The Linux+ exam also expects you to have some knowledge of these network related tools:
- Host. This command shows you DNS related entries and lookup information in Linux.
- Route. This command allows you to see and interact with the routing table of your Linux system.
- IP. This allows you to see all the network devices of your system.
- Ethtool. With this tool you can change Ethernet card settings.
- SS. Using this tool shows you the socket information related to your system.
- Iwconfig. Similar to ifconfig but relates to the wireless card of your system.
- Nmcli. Reports the network status of your system and allows you to control those connections.
- Brctl. Allows you to manage the Ethernet bridge configuration of your system.
- Nmtui – This is the Network Manager Text User Interface, which gives you a text based menu to configure your system from.
Networking Configuration Files
Previously, we showed you how to edit the interfaces file of a Linux system to change the IP address and subnet of a system, as well as a few other items. The Linux+ exam covers more details on additional configuration files, which we will touch on and give a brief overview of each one.
- /etc/sysconfig/network. This file allows users to enable and disable networking across the system, what the hostname should be, and what the gateway of the network is.
- /etc/hosts. This file allows you to make changes to the hostname and IP configuration of hosts on your network. This is useful in situations where you do not have DNS running on your network, but you would like to bind a hostname of another computer to an IP address.
- /etc/network. This folder contains the interfaces file as well as some services and scripts
- /etc/nsswitch.conf. This file contains the Name Service Switch configuration information for your system. It determines where the name service information should be pulled from for some applications. It also determines the order.
- /etc/resolv.conf. This configuration file is for setting the DNS resolver settings of your system.
- /etc/netplan. This is an Ubuntu specific network configuration utility for easily managing network settings.
- /etc/sysctl.conf. This file allows you to make network changes to your kernel while it is running.
- /etc/dhcp/dhclient.conf: Here you can make configuration changes to the Internet Systems Consortium DHCP client for your Linux system.
All of these configuration locations are important for your system to run correctly. If you are having issues with your Linux system on the networking front then you will find most settings in these locations. There are many graphical apps that interact with these files as well, and depending on your system you will find a variety of options for each.
The Linux+ exam focuses on configuring these files from the command line, so it is a good idea to practice for yourself to help you gain some hands-on experience.
Linux can be intimidating for new users, but it really shouldn't be. There are plenty of different techniques and applications that make network diagnostics and configuration in Linux much easier. However, you need to make sure that you can navigate through the Linux file system via the command line.
This not only helps you to practice your skills for different parts of the Linux+ exam, but it also gives you a much better understanding of where the different system components are located on your Linux machine. This is important if you are ever stuck in a terminal environment without any graphical tools to use. Being able to repair your system and change network settings from the terminal is a valuable skill that will make you all the more marketable as a Linux technician or engineer.