Thursday, January 24, 2019

Rdisplays The Route Table

The tracepath command will produce one line of output for each response it receives, unlike tracreoute which produces one line of output per hop. In the following example, youll see that two responses were received from 10.0.2.2.

$ tracepath -n google.com

1?: [LOCALHOST] pmtu 1500

1: 10.0.2.2 0.470ms

1: 10.0.2.2 0.649ms

2: 192.168.1.1 2.147ms asymm 64

...

For simple checks, tracepath can do the trick. For advanced options, youll probably end up using traceroute.

Network Statistics

The netstat command can be used to collect a wide variety of network information. Here are some of my favorite and most used netstat options.

-nDisplay numerical addresses and ports.

-iDisplays a list of network interfaces.

-rDisplays the route table. (netstat -rn)

-pDisplay the PID and program used.

-lDisplay listening sockets. (netstat -nlp)

-tLimit the output to TCP (netstat -ntlp)

-uLimit the output to UDP (netstat -nulp)

The -n option is used to display numerical IP addresses and ports as opposed to hostnames and service names. You can use this option in conjunction with most other netstat options.

Get a list of network interfaces on your system by using the -i option.

To display routing information, use -r. I often use netstat -rn to display the routes using IP addresses.