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.
5 Most Used Linux Network Troubleshooting and Configuration Commands
Login to your Linux virtual private server using SSH
1. PING Command in Linux
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.
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 in Linux
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.
If you want to see a specific network interface like for example eth0 you need to enter:
3. TRACEROUTE Command in Linux
Traceroute is a network troubleshooting utility which shows the number of hops taken to reach a destination. It also determines the packets traveling path.
4. DIG Command in Linux
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.
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 in Linux
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 :
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.
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.