Routing, the process of directing IP packets from one network point to another, is essential for effective communication across networks. Linux systems, including Ubuntu, manage this task through kernel structures known as routing tables, which contain information on how IP packets should be routed.
Commands for Viewing Routing Tables:
1. The netstat Command
The netstat command has traditionally been used to display routing table information in Linux. Despite being officially replaced by the ip route command, we include it here for reference.
-r: Displays Kernel routing tables.
-n: Displays numerical addresses.
2. The route Command
The route command, once widely employed for viewing routing tables, is now considered obsolete. The manual page for this command even acknowledges its replacement by the ip route command.
-n: Displays numerical addresses only.
3. The ip route Command
The ip route command is the modern and recommended approach for accessing routing table information in Linux.
The ip route command provides a comprehensive view of the routing table, and while its output may appear less concise, it remains the most reliable and up-to-date method.