Linux Networking Commands

While working on Operating System like Linux, you should not waste your time by going into GUI and setting or configuring your Network system. Linux is fun only when the power of its commands is realized and believe me, once you get addicted to the commands, you’ll never think of switching to GUI. We’ll see the some of the network commands you can use to set up your networking system properly:

1. arp
ARP stands for Address Resolution Protocol, which is used to find the MAC address(your device physical address) of a network neighbour for a given IPv4 Address.

Practical Use:
Let’s assume you have a big office and different devices like Printer, IP Phones, Fax Machines etc.. are connected to network. Now each device has a unique hardware address like this 00:03:23:64:B6:32 called MAC Address or Ethernet Address.To connect this device with an IP address so that it can be access from remote we can add an entry using ARP like:
                  arp -s 00:03:23:64:B6:32
and after that, run the command
Ping Command is used to set the IP address for the hardware. PING command finally assigns the IP address.And we are done. The device is added to the ARP table and has the IP address now. You can access it now in your network.

Problems you might face:
1. You need to have administrator role to run this.
2. IP address might already be in use.
3. Wrong IP address or MAC address are given in command. PING command will confirm it.
4. PING function is not enabled.
5. The network is using DHCP, BOOTP or RARP and network will automatically assign the ip address.

2. dig
dig (domain information groper) is a tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. DNS administrators use dig to troubleshoot DNS problems. dig command has some sections in the Output it gives, but its main Section is the Answer Section which you should be looking for. For e.g. to display the output with only the answer section you need to type same as shown in the screenshot:
In above screenshot +noall means we don't want any section to be displayed, but since we want the answer section to be displayed, we add +answer. One more advantage of this command is that it can be also used for doing reverse lookups i.e. you give the address in the command and it will give the corresponding name and it can be typed as :
                                     dig –x
There is one more good option call short for viewing just the ip-address of a web site (i.e the A record), use the short form option as shown below in Screenshot:

3. domainname
The domainname command displays or sets the name of the current NIS domain. If you do not specify a parameter, the domainname command displays the name of the current NIS domain. A domain typically encompasses a group of hosts under the same administration. Only the root user can set the name of the domain by giving the domainname command an argument. To enter a new domain name, type:
                            domainname david
The command sets the NIS domain name to david.
To find out the name of the domain your machine belongs to, you just have to type:

4. ethtool
Its a query to control network driver and hardware settings and also used for displaying or modifying the Network Interface Controller (NIC) parameters.

The command is useful for:
§ Identification and diagnostic of Ethernet devices
§ Extended Ethernet devices statistics
§ Control speed, auto-negotiation and flow control for Ethernet devices
§ Control checksum offload and other hardware offload features
§ Control DMA ring sizes and interrupt moderation
§ Control receive queue selection for multiqueue devices
§ Upgrade firmware in flash memory
It is run as shown in the Screenshot:
You can type the Ethernet interface name as there in your case. By default its eth0 and if you have multiple Ethernet interface you can type as eth1 ,eth2 etc.. To know the version of the Ethernet driver you need to type as shown in screenshot below:
You can also use ethtool with -S option to display the bytes transferred, received, errors, etc, as shown below.
                                  ethtool –S etho

5. finger
In Unix, finger is a program you can use to find information about computer users. It usually lists the login name, the full name, and possibly other details about the user you are fingering. These details may include the office location and phone number(if known), login time, idle time, time mail was last read, and the user's plan and project files. Finger may be used to look up users on a remote machine. Format is
                             "user@host"or "@host"