Common Linux network tools - ping, telnet, netstat and arp
ping (Packet Internet Gropper)
Ping command allows a user to ping another network IP address. Ping command sends ICMP ECHO_REQUEST packets to other hosts and this command can help determine the connectivity to the remote host.
Simple ping command syntax is ping <ip_address>
Example:
[root@localhost ~]# ping 192.168.1.109
PING 192.168.1.109 (192.168.1.109) 56(84) bytes of data.
64 bytes from 192.168.1.109: icmp_seq=1 ttl=64 time=3.92 ms
64 bytes from 192.168.1.109: icmp_seq=2 ttl=64 time=0.223 ms
64 bytes from 192.168.1.109: icmp_seq=3 ttl=64 time=0.004 ms
64 bytes from 192.168.1.109: icmp_seq=4 ttl=64 time=0.168 ms
Important options of the ping command are
• -a (Audible ping)
• -c (Count)
• -f (Flood ping)
• -i (Interval - Wait interval seconds between sending next packet)
• -I (Interface address - Set source address to specified interface address.)
• -s (packetsize - Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data)
telnet (teletype network)
Telnet (teletype network) is a network protocol used on the Internet or local area networks to provide a bidirectional interactive communications facility. Telnet provides access to a command-line interface on a remote host via a virtual terminal connection.
Main disadvantages of Telnet is that the data is sent over the network as clear text. It is possible for someone to use a network analyzer to peek into your data packets and see your username and password. A more secure method for remote logins would be via Secure Shell (SSH) which encrypts the data which is sent over the network.
Telnet can be used to scan a remote host for open TCP ports also.
[root@RHEL01 ~]# telnet 192.168.1.109
Trying 192.168.1.109...
Connected to RHEL09.omnisecu.com (192.168.1.109).
Escape character is '^]'.
Red Hat Enterprise Linux Server release 5 (Tikanga)
Kernel 2.6.18-8.el5 on an i686
login: tintin
Password:
netstat
netstat command prints information about the Linux networking subsystem.
Important options of netstat command.
• -r (Displays the routing table)
• -I = <interface_no> (Displays the interface table)
• -i (Displays the interface table)
• -s (Displays the networking statistics)
• -v (verbose)
• -n (numeric – netstat uses /etc/services to translate ports to names)
• -a (all)
• -l (Listening)
• -t (TCP)
• -u (UDP)
arp (address resolution protocol)
Address Resolution Protocol (ARP) is used to translate protocol addresses to hardware interface addresses. The arp command displays a table of translated hardware addresses in the cache.
Important options of arp command.
• -a (Displays all in BSD style)
• -e (Displays all in Linux style)
• -d (Delete an entry)
• -n (numeric)
• -s (add a new entry)