How to view network routing table in Debian 10

What is network packet routing?

The process of routing a network packet is the transmission of an IP packet from one point to another over the network, for example via the Internet. When you send an email to someone, you are actually transferring a series of IP packets or datagrams from your computer to another network node or PC. Packets sent from your computer go through several gateways or routers to reach the target computer system. The same approach applies to all Internet protocols such as HTTP, IRC, FTP, etc.

On all Linux and UNIX systems, IP packet forwarding information is stored in the kernel structure. These structures are called routing tables. If you want your system to interact with other computers, you should configure these routing tables. But first, it’s important how you can display these routing tables on your Linux system.

Commands Described in This Article

In this article, we will explain how to display the routing table in Debian using the following three popular commands.

  • Ip command
  • Route team
  • Netstat route command

We tested the commands in this article on the Debian 10 Buster system.

We use the Debian command line terminal to execute the above commands. You can open a terminal by searching for application launch as follows:

The application launcher can be launched using the Super / Windows key on the keyboard.

How to use the ip command to view network routes

Last, but not least, here is the most recommended way to print routing table information on Linux. Here’s how to use this command:

$ ip route

Ip route command

Although this information is not as readable as the information from the previously mentioned commands, it is still enough to configure the route.

These were several commands for viewing routing table information in Debian. Although the ip route command does not look neat, it is still the most recommended way to find the appropriate information in the routing table. Other commands are considered obsolete, but they can still be useful in getting what you need to extract.

Viewing the routing table using the route command

The route command also belongs to the category of the once widely used but now obsolete command for viewing routing tables. The man page for this command also mentions that the command has now been replaced with the ip route command.

With this command you can view the same information as with the netstat command. Here is how you can use it: Advertising

$ sudo route -n

-n This flag is used only to display numeric addresses.

route team

The output format is somewhat similar to the format of the netstat command.

Use the netstat command to view the routing table.

The netstat command has always been a widely used method for printing routing table information on Linux. However, it is officially replaced by the ip route command. We include it anyway, as this is still an approach for obtaining the necessary information.

Here is how you can use this command:

$ netstat -rn

-r This flag is used to display kernel routing tables.

-n This flag is used to display numerical addresses.

Netstat Team

Here is what the result indicates:

DestinationThis column indicates the destination network.
GatewayThis column indicates the specific gateway for the network. If you see * in this column, this means that a forwarding gateway is not required for the specified network.
GenmaskThis column indicates the netmask.
FlagsThe output of U in these columns means that the route is up. Pin G indicates that the specified gateway should be used for this route. D is dynamically set, M is modified, and R is reduced.
MSSThis column shows the default maximum segment size (MSS) for TCP connections for this route.
WindowThis column shows the default window size for TCP connections on this route.
irttThis column indicates the initial round-trip time for this route.
I faceThe Iface column shows the network interface. If you had more than one interface, you will see lo (for feedback), eth0 (the first Ethernet device) and eth1 (for the second Ethernet device), etc. For the number of interfaces installed.

How to view network routing table in Debian 10