How do I find out which gateway a Linux system is currently using?

Want to support HowtoForge? Become a subscriber!
Submitted by admin (Contact Author) (Forums) on Mon, 2006-08-07 16:28. :: Networking


route -nee

The output will look like this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    MSS   Window irtt   U     0      0        0 eth0     0     0      0         UG    0      0        0 eth0     0     0      0         UG    0      0        0 eth0     0     0      0

This means that the system with the IP address is using as gateway.

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by themachine (registered user) on Sun, 2006-08-27 11:40.
It also possible to use great iproute2 package: the command to show the current routing tables is : ip route show dev eth1  scope link dev lo scope link
default via dev eth1
Submitted by Anonymous (not registered) on Mon, 2011-12-05 11:36.


 This command is not working on my Desktop which have CentOS installed on it.