Ubuntu: Find Out Default Gateway

How do I find out default gateway IP address (default router IP assigned) for my Ubuntu Linux systems?

Use the route or ip command to get default routing table for Ubuntu Linux. Open the terminal and type the following command:

# route -n

Sample outputs:

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

Destination for 0.0.0.0 is set to 192.168.1.1 via wlan0 interface i.e. 192.168.1.1 is default gateway. If you just type the route command with the -n switch it show word default instead of 0.0.0.0:

route

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 1 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0

p route Command

The following command does the same thing:

# ip route show

Sample outputs:

192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.200 metric 1
169.254.0.0/16 dev eth0 scope link metric 1000
default via 192.168.1.1 dev eth0 proto static

Popular posts from this blog

Worlds Biggest Books Collection

10 Differences between Windows(R) XP and Vista(tm)

Windows XP Live: USB Stick Edition