how to find out the gateway ip address

Posted . Visible to the public.

with ip

~$ ip route show
default via 192.168.2.1 dev eth0  proto static 
192.168.2.0/24 dev eth0  proto kernel  scope link  src 192.168.2.6  metric 1

with netstat

~$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG        0 0          0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

with route

~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     1      0        0 eth0
Last edit
cakuzo
Keywords
network
Posted by cakuzo to linux (2015-02-19 13:23)