LOGO

Display Routing Table - Windows & Ubuntu

September 11, 2006
Display Routing Table - Windows & Ubuntu

Understanding the Routing Table with netstat

The netstat command, when used with the -rn option, provides a view of the kernel's IP routing table. This table is fundamental to how your system directs network traffic.

Accessing the Routing Table

To access this information, execute the following command from your command prompt or terminal:

netstat -rn

The resulting output will display the routing rules currently in effect on your system.

Interpreting the Output

The output from netstat -rn is structured into several columns, each providing specific details about a route.

  • Destination: This column indicates the network or host the route applies to.
  • Gateway: The IP address of the next hop router for packets destined for the specified destination.
  • Genmask: The network mask associated with the destination network.
  • Flags: These flags denote the route's characteristics, such as whether it's up (U) or a gateway route (G).
  • MSS: Maximum Segment Size, indicating the largest packet size allowed.
  • Window: Used for TCP windowing.
  • irtt: Internet Round Trip Time.
  • Iface: The network interface used for this route.

Example Output Breakdown

Consider a sample output:

Kernel IP routing table

Destination Gateway Genmask Flags MSS Window irtt Iface

192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0

127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

The first line indicates that traffic destined for the 192.168.1.0 network should be sent directly via the eth0 interface. The second line shows the APIPA range using the eth0 interface. The third line defines the loopback interface (lo). Finally, the last line specifies the default gateway (192.168.1.1) for all traffic not matching other routes.

Understanding this table is crucial for troubleshooting network connectivity issues and verifying proper routing configuration.

#routing table#windows#ubuntu#network#command line#networking