Friday, July 17, 2015

How to get route table in linux

A routing table is a set of rules, often viewed in table format, that is used to determine where data packets traveling over an Internet Protocol (IP) network will be directed. There are several ways to get the route table in Linux. So open your terminal pressing Ctrl + Alt + T

* route

$ route -n
( here -n for to get numerical values instead of symbolic values)

Kernel IP routing table
Destination     Gateway         Genmask            Flags  Metric Ref    Use   Iface
0.0.0.0         10.64.64.64     0.0.0.0                    UG     0          0        0     ppp0
10.64.64.64     0.0.0.0         255.255.255.255    UH     0          0        0     ppp0
192.168.1.0     0.0.0.0         255.255.255.0        U        0          0        0     eth0


* ip

$ ip route list

default via 10.64.64.64 dev ppp0  proto static
10.64.64.64 dev ppp0  proto kernel  scope link  src 10.125.56.254
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.1

* netstat

$ netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask            Flags   MSS    Window  irtt Iface
0.0.0.0         10.64.64.64      0.0.0.0                   UG        0 0          0           ppp0
10.64.64.64     0.0.0.0         255.255.255.255    UH        0 0          0           ppp0
192.168.1.0     0.0.0.0         255.255.255.0          U         0 0          0           eth0

* direct path

or you can just copy and paste below path

$ /sbin/route

Kernel IP routing table
Destination     Gateway         Genmask            Flags Metric Ref    Use Iface
default          10.64.64.64     0.0.0.0                   UG    0      0        0 ppp0
10.64.64.64     *               255.255.255.255       UH    0      0        0 ppp0
192.168.1.0     *               255.255.255.0            U     0      0        0 eth0


(here you can see some symbolic values in the table )


No comments:

Post a Comment