Network configuration and trouble shooting commands in Linux
Computers are often connected to each other on a network. They send request to each other in the form of packets that travels from the host to the destination. Linux provides various commands from network configuration and troubleshooting.
Here is the list of important commands:
1. Ping(Packet Internet Groper)
The ping command is used to ensure that a computer can communicate to a specified device over the network. The pings command sends Internet Control Message Protocol(ICMP) Echo Request messages in the form of packets to the destination computer and waits in order to get the response back. Once the packets are received by the destined computer, it starts sending the packets back. This command keeps executing until it si interrupted.
ping command provides details such as
- number of packets transmitted
- number of packets received
- time taken by the packet to return
ping command in generally used for the following purposes:
- measuring the time taken by the packets to return to determine the speed of the connection
- to make sure that the network connection between the host and the destined computer can be established
nslookup command queries the DNS in order to fetch the IP address or the domain name from DNS records.
This command is used to get the route of a packet. In other words, the traceroute command is used to determine the path along which a packet travels. It also returns the number of hops taken by the packet to reach the destination. This command prints to the console, a list of hosts through which the packet travels in order to the destination.
Image source: Google Images
host command is used to find a domain name associated with the IP address or find an IP address associated with the domain name. The returned IP address is either IPv4 or IPv6.
netstat(Network Statistics) is the command that is used to display routing table, connection information, the status of ports, etc. This command works with Linux Network Subsystem. This command basically displays the content of /proc/net file defined in the Linux file system.
ARP(Address Resolution Protocol) command is used to display and modify ARP cache, which contains the mapping of IP address to MAC address. The system’s TCP/IP stack uses ARP in order to determine the MAC address associated with an IP address.
ifconfig(Interface Configuration) is a utility in an operating system that is used to set or display the IP address and netmask of a network interface. It also provides commands to enable or disable an interface. Many UNIX-like operating systems initialize their network interfaces using ifconfig at boot time. ifconfig is also used to view the MTU(Maximum transmission unit).
This article is contributed by Mayank Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.