Ubuntu Countdown

Friday, July 6, 2007

Linux Networking no.4: Common Network Tools

Here is a short list of tools helpful when trouble shouting network connections.

1. ping:

This tools sends and ICMP ECHO_REQUEST datagram to a host and expects an ICMP ECHO_RESPONSE.

Options for ping
-b ping a broadcast address
-c send N packets
-q quiet mode: Display only start and end messages

2. tcpdump:
This is a tool used to analyse network traffic by capturing network packets. The following commands illustrate some options:

Let tcpdump autodetect network interface
tcpdump

Specify a network interface to capture packets from
tcpdump -i wlan0 (wlan0 is your network interface card)

Give an expression to match
tcpdump host 192.168.10.1 and port 80

3. netstat
Get information on current network connections, the routing table or interface statistics depending on the options used.

Option for netstat:
-r same as /sbin/route
-l display list of interface
-n don't resolve IP address
-p returns the PID and names of programs (only for root)
-v verbose
-c continuous update

4. arp:

Display the kernel address resolution cache.

5. traceroute:

Displays the route taken from the local host to the distination host. Traceroute forces intermediate routers to send back error messages (ICMP TIME_EXCEEDED) by deliberately setting the ttl(time to live) value too low. After each TIME_EXCEEDED notification traceroute increment the ttl value, forcing the next packet to travel further, until it reaches its' destination.

Option for traceroute:

-f ttl change the initial time to live value to ttl instead of 1
-n do not resolve IP numbers
-v verbose
-w sec set the timeout on returned packet to sec

Thats all.