Showing the routing table in Linux is very useful when you are required to get information about a network.
This is the output when retrieving the routing table in Windows 7.
C:\Users\jason>route PRINT =========================================================================== Interface List 16...00 ff f0 18 9a f5 ......TAP-Windows Adapter V9 13...00 13 46 3a 02 83 ......Realtek RTL8139/810x Family Fast Ethernet NIC #2 12...6c f0 49 b5 e6 2a ......Realtek RTL8168D/8111D Family PCI-E Gigabit Ethernet NIC (NDIS 6.20) 10...f8 1a 67 10 b1 63 ......Realtek RTL8139/810x Family Fast Ethernet NIC 18...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1 20...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8 1...........................Software Loopback Interface 1 11...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 24...00 00 00 00 00 00 00 e0 Microsoft Direct Point-to-point Adapater 14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 15...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3 17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4 19...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #5 23...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #7 =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.100.1 192.168.100.2 20 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 192.168.17.0 255.255.255.0 On-link 192.168.17.1 276 192.168.17.1 255.255.255.255 On-link 192.168.17.1 276 192.168.17.255 255.255.255.255 On-link 192.168.17.1 276 192.168.100.0 255.255.255.0 On-link 192.168.100.2 276 192.168.100.2 255.255.255.255 On-link 192.168.100.2 276 192.168.100.255 255.255.255.255 On-link 192.168.100.2 276 192.168.248.0 255.255.255.0 On-link 192.168.248.1 276 192.168.248.1 255.255.255.255 On-link 192.168.248.1 276 192.168.248.255 255.255.255.255 On-link 192.168.248.1 276 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 192.168.100.2 276 224.0.0.0 240.0.0.0 On-link 192.168.17.1 276 224.0.0.0 240.0.0.0 On-link 192.168.248.1 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 192.168.100.2 276 255.255.255.255 255.255.255.255 On-link 192.168.17.1 276 255.255.255.255 255.255.255.255 On-link 192.168.248.1 276 =========================================================================== Persistent Routes: None IPv6 Route Table =========================================================================== Active Routes: If Metric Network Destination Gateway 1 306 ::1/128 On-link 10 276 fe80::/64 On-link 18 276 fe80::/64 On-link 20 276 fe80::/64 On-link 20 276 fe80::35c9:fab0:c58:9537/128 On-link 18 276 fe80::7d9a:395:2c12:eec5/128 On-link 10 276 fe80::ac72:159e:fd1e:d216/128 On-link 1 306 ff00::/8 On-link 10 276 ff00::/8 On-link 18 276 ff00::/8 On-link 20 276 ff00::/8 On-link =========================================================================== Persistent Routes: If Metric Network Destination Gateway 0 4294967295 ::/0 2001:470:1f06:1b5::1 =========================================================================== |
You may also use Powershell to get this information very easily.
PS C:\Users\Intel i5> Get-NetRoute ifIndex DestinationPrefix NextHop RouteMetric ifMetric PolicyStore ------- ----------------- ------- ----------- -------- ----------- 18 255.255.255.255/32 0.0.0.0 256 5000 ActiveStore 12 255.255.255.255/32 0.0.0.0 256 25 ActiveStore 1 255.255.255.255/32 0.0.0.0 256 75 ActiveStore 18 224.0.0.0/4 0.0.0.0 256 5000 ActiveStore 12 224.0.0.0/4 0.0.0.0 256 25 ActiveStore 1 224.0.0.0/4 0.0.0.0 256 75 ActiveStore 12 192.168.1.255/32 0.0.0.0 256 25 ActiveStore 12 192.168.1.5/32 0.0.0.0 256 25 ActiveStore 12 192.168.1.0/24 0.0.0.0 256 25 ActiveStore 18 172.28.223.255/32 0.0.0.0 256 5000 ActiveStore 18 172.28.208.1/32 0.0.0.0 256 5000 ActiveStore 18 172.28.208.0/20 0.0.0.0 256 5000 ActiveStore 1 127.255.255.255/32 0.0.0.0 256 75 ActiveStore 1 127.0.0.1/32 0.0.0.0 256 75 ActiveStore 1 127.0.0.0/8 0.0.0.0 256 75 ActiveStore 12 0.0.0.0/0 192.168.1.1 0 25 ActiveStore 18 ff00::/8 :: 256 5000 ActiveStore 12 ff00::/8 :: 256 25 ActiveStore 1 ff00::/8 :: 256 75 ActiveStore 12 fe80::948f:319f:ac29:d5f6/128 :: 256 25 ActiveStore 18 fe80::3ca5:1cc0:896:321b/128 :: 256 5000 ActiveStore 18 fe80::/64 :: 256 5000 ActiveStore 12 fe80::/64 :: 256 25 ActiveStore 12 fdc8:1451:5fa9:4700:e0a9:2faa:4468:b581/128 :: 256 25 ActiveStore 12 fdc8:1451:5fa9:4700:948f:319f:ac29:d5f6/128 :: 256 25 ActiveStore 12 fdc8:1451:5fa9:4700::/64 :: 16 25 ActiveStore 1 ::1/128 :: 256 75 ActiveStore |
This is another example, formatted in a table.
PS C:\Users\Intel i5> Get-NetRoute | Format-Table -Property * Publish Protocol Store AddressFamily State ifIndex Caption Description ElementName InstanceID AdminDistance DestinationAddress IsStatic RouteMetric TypeOfRou te ------- -------- ----- ------------- ----- ------- ------- ----------- ----------- ---------- ------------- ------------------ -------- ----------- --------- No Local ActiveStore IPv4 Alive 18 <??8<??8<??8<??9=<55;B55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 12 <??8<??8<??8<??9=<55;<55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 1 <??8<??8<??8<??9=<55;55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 18 <<>8:8:8:9>55;B55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 12 <<>8:8:8:9>55;<55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 1 <<>8:8:8:9>55;55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 12 ;C<8;@B8;8<??9=<55;<55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 12 ;C<8;@B8;8?9=<55;<55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 12 ;C<8;@B8;8:9<>55;<55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 18 ;A<8<B8<<=8<??9=<55;B55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 18 ;A<8<B8<:B8;9=<55;B55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 18 ;A<8<B8<:B8:9<:55;B55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 1 ;<A8<??8<??8<??9=<55;55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 1 ;<A8:8:8;9=<55;55:8:8:8:55; 256 3 No Local ActiveStore IPv4 Alive 1 ;<A8:8:8:9B55;55:8:8:8:55; 256 3 No NetMgmt ActiveStore IPv4 Alive 12 :8:8:8:9:55;<55;C<8;@B8;8;55; 0 3 No Local ActiveStore IPv6 Alive 18 pp::DD9B55;B55DD55; 256 3 No Local ActiveStore IPv6 Alive 12 pp::DD9B55;<55DD55; 256 3 No Local ActiveStore IPv6 Alive 1 pp::DD9B55;55DD55; 256 3 No Local ActiveStore IPv6 Alive 12 poB:DDC>BpD=;CpDkm<CDn?p@9;<B55;<55DD55; 256 3 No Local ActiveStore IPv6 Alive 18 poB:DD=mk?D;mm:DBC@D=<;l9;<B55;B55DD55; 256 3 No Local ActiveStore IPv6 Alive 18 poB:DD9@>55;B55DD55; 256 3 No Local ActiveStore IPv6 Alive 12 poB:DD9@>55;<55DD55; 256 3 No Local ActiveStore IPv6 Alive 12 pnmBD;>?;D?pkCD>A::Do:kCD<pkkD>>@BDl?B;9;<B55;<55DD55; 256 3 No Local ActiveStore IPv6 Alive 12 pnmBD;>?;D?pkCD>A::DC>BpD=;CpDkm<CDn?p@9;<B55;<55DD55; 256 3 No NetMgmt ActiveStore IPv6 Alive 12 pnmBD;>?;D?pkCD>A::DD9@>55;<55DD55; 16 3 No Local ActiveStore IPv6 Alive 1 DD;9;<B55;55DD55; 256 3 |
And this is how it is done in Linux.
jason@eyjafjallajkull:~$ route -e -v Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface default 192.168.100.1 0.0.0.0 UG 0 0 0 eth2 10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun1194 10.8.0.2 * 255.255.255.255 UH 0 0 0 tun1194 link-local * 255.255.0.0 U 0 0 0 eth2 192.168.100.0 * 255.255.255.0 U 0 0 0 eth2 |
Linux shows a lot less information than Windows, but it is still pertinent information. This shows the gateway IP address of my router and the network mask. As well as the IP address of my VPN configuration.