5 Linux Network Troubleshooting and Configuration Commands

Computers are usually connected in networks which are groups of computer systems and other computing hardware devices that are linked together through communication channels so they can facilitate communication and resource-sharing among a wide range of users.

This article explains some of the most frequently used network configuration and troubleshooting commands in Linux. They are various tools which can be useful when networking with other computers both within the local network and across the Internet, obtaining more information about other computers. All these commands should be entered at the command prompt in your Linux VPS and you must press the ENTER button to execute the desired command. Please note that all Linux commands are case sensitive.

Using the “ping” command is the best way to test connectivity between a source computer and a specified destination computer. Ping uses ICMP (Internet Control Message Protocol) to communicate to other devices.

Usage:

ping yourdomain.com

Example:

ping rosehosting.com

In Linux the ping command keeps executing until you interrupt it using Control+C from the keyboard. If you want to exit after N number of requests (success or error responses) you need to use the -c option.

ping -c 6 rosehosting.com

2. IFCONFIG command

The “ifconfig” command is used for displaying current network configuration information. You can also set up an IP address, netmask or broadcast address to a network interface. With this command you can view IP addresses and assign a Hardware / MAC address to interface.

The MTU and Metric fields show the current MTU and metric values for that interface.The RX and TX lines show how many packets have been received or transmitted error free, how many errors occurred, how many packets were dropped (probably because of low memory), and how many were lost because of an overrun.

ifconfig

If you want to see a specific network interface like for example eth0 you need to enter:

ifconfig eth0

3. TRACEROUTE Command

Traceroute is a network troubleshooting utility which shows the number of hops taken to reach a destination. It also determines the packets traveling path.

Usage:

traceroute yourdomain.com

Example:

traceroute google.com

4. DIG (domain information groper) is a network administration command-line tool for querying Domain Name System (DNS) servers for information about host addresses, mail exchanges, name servers, and related information.
This tool can be used from any Linux (Unix) or Macintosh OS X operating system. Usually the most typical use of dig is to simply query a single host.

Usage:

dig yourdomain.com

Example:

dig google.com

If you want to query the MX records for google.com enter the following command:

dig MX google.com

The information that we need is in the Answer Section.

5. NETSTAT command is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interfaces (network interface controller or software-defined network interface).

For example :

netstat -anlp

Gives us the following output:

Now we can see all active connections and the TCP and UDP ports on which the computer is listening.

To displays routing table information use option -r.

For example:

netstat -r

Of course this is only a glimpse of the possible network commands usage. You can learn the command line and work with these network command tools if you use one of our Linux VPS Hosting services. You can always contact our admins if you encounter a problem in managing your server. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.