With the advent of the latest technologies, computer as a single unit has lost its existence as a computer connected with an internet connectivity or interconnected set of computers via a network connection perform more activities such exchanging information or resources with each other. And by that, if there are two or more than two computers connected with each other via a network then it is known as a Computer network and along with them there can be more network devices or media devices involved to form the computer network.
Computers loaded with various kinds of operating systems can form a computer network, be it small or a large network but by nature of this article, we will more focused towards Linux operating systems forming the networks. As discussed, to maintain and also to run this computer network is a tough task that a System Administrator or a Network Administrator does on a day to day basis. In this article, we will try to review network configuration and troubleshoot commands in Linux that are very frequently used by the administrators.
These network commands are frequently used by the administrators on computers that network either within the local networks or spread across the geographical locations connected by the internet. This article will provide you the best of the information on the necessary network configurations, file transfers and also on the working with remote machines.
This command is used to display the contents of the /proc/net files. This command works with the Linux network subsystem and will let you know on the status of the ports if they are open, closed, waiting or masquerade connections. This provides various other information based on using the many options that this commands provide with.
This is a sniffer command, basically a program that targets on capturing the packets off a networking interface and also does the interpretation of these for you. This command understands all the basic internet protocols and it can also be used to save the entire packets for inspection that can be always performed later.
This command derives its name after the sound of an active sonar system, and performs a similar activity on a linux networking system as well. This command is used to send echo requests to a host that we specify in conjunction with this command and further lists the responses that are received from the round trip time.
PING (Packet INternet Groper) command is the best way to test connectivity between two nodes. To stop a ping to a host, we may use the keyboard keys CTRL + C together to break it.
Using ping /smbmount/ssh or any other UNIX system programs with a fully qualified domain name (FQDN) instead of an IP address will work out if and only if, these computers are listed in your /etc/hosts file or else it won’t.
This command lets the system or network administrator know the host name of the computer that they are logged into. This may sometimes be called as host as well.
This command is used to know the route of a packet. This command will list all the series of hosts through which the packets have gone through or travelled through on its way to the specified destination. There are many graphical equivalents to this command / program and one of such commands is xtraceroute.
Traceroute command usage can be as follows:
traceroute machine_name or ip
The command tracepath does a similar function as that of traceroute but differs mostly on the fact that the tracepath command doesn’t take complicated options.
tracepath machine_name or ip
The findsmb command is used to list down all the information about machines that do respond to the SMB name queries. To take an example, the windows based machines which share their hard disks.
This command will list down all possible machines and to control over the output that you see, you may want to specify a particular subnet to query upon to retrieve machines pertaining to it alone.
This command is a very sophisticated network tool that is used to query for machines (either local or remote machines) to check whether they are UP and Running, and if so, on what ports are open on these machines. This command / tool can be safely understood as a network exploration tool and also a security scanner.
The command usage is pretty simple, shown as below:
This would query on the machine name that is provided on what ports are kept open. nmap is a wonderful and the most powerful tool for which documentation is available on the nmap site itself.
This command is generally used to configure the network interfaces or also can be used to display the current configuration of the machine. Additionally, the activating and the deactivating of interfaces can be pretty easily managed by the “up” and “down” settings – this command is also very much necessary to set an interface’s address related details (if it is not set already by using the ifcfg scripts).
We can use this command individually without providing any network devices tagged with the command, and this will list all the information of all the network devices that are currently UP. ifconfig
If it is used in conjunction with any network device name (considering that the mentioned network device is available), it brings it down. This further means, that the network device will no longer be able to receive or send anything until it is put back UP again.
ifconfig eth0 down
You can refer to the manual pages to obtain any further information about this tool. ifconfig with interface (eth0) command only shows specific interface details like IP Address, MAC Address etc. with -a options will display all available interface details if it is disable also.
We can use this command to bring UP an interface by following a simple script that contains the default network settings. The usage is pretty simple and you will get a lot of help on how to use this script from the manual pages.
The command above will bring up eth0, if it is currently down by any chance.
We can use this command to bring DOWN an interface using a script that contains your default network settings. The usage is pretty simple and you will get a lot of help on how to use this script from the manual pages.
The command above will bring DOWN eth0, if it is currently UP by any chance.
This command should be used to configure any particular interface if it is not already configured well. You can get more details and help by simple tying the command and on its usage through the manual pages.
For instance, if you would want to configure eth0 from 192.168.0.10 to 192.168.0.11, you could do that simply as follows:
ifcfg eth0 del 192.168.0.10
ifcfg eth0 add 192.168.0.11
The commands when used in conjunction, will take down eth0 by removing the stored IP address and also brings it back up with the new address being added.
This command is a tool that is used to display or even modify the routing table. If you would want to add a specific gateway as the default, you would simply do it as follows:
route add default gw some_address
In this article, we have introduced to more than necessary frequently used Linux networking commands that can help you get out of situations that you don’t want to be seen in. These should be the precise set of commands that every Linux System and Network administrator to be aware of with its usage and also based on its usage the repercussions.
|Red Hat Certified Engineer||Linux Security Fundamentals|
|Linux Networking||Linux Administration|
|Linux Cluster||IBM LinuxONE|
Get Updates on Tech posts, Interview & Certification questions and training schedules