Network configuration and trouble shooting commands in Linux
Computers are often connected to each on a network. They send request to each other in the form of packets that travels from the host to destination. Linux provides various commands from network configuration and troubleshooting.
Here are the list of important commands:
- Ping(Packet Internet Groper)
ping command is used to ensure that a computer can communicate to a specified device over the network. ping 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 speed of the connection
- to make sure that the network connection between 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, 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 domain name associated with the IP address or find IP address associated with 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, that contains the mapping of IP address to MAC address. The system’s TCP/IP stack uses ARP in order to determine MAC address associated with an IP address.
ifconfig(Interface Configuration) is a utility in 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 system initializes 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 contribute.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.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.