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

Run

route -nee

The output will look like this:

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

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

Share this page:

6 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: tdi

It also possible to use great iproute2 package: the command to show the current routing tables is : ip route show

192.168.1.0/24 dev eth1  scope link
127.0.0.0/8 dev lo scope link
default via 192.168.1.1 dev eth1

By: Anonymous

Hi, 

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

Regards,

Karthik.  

By: gaurav

how to find the defalt gateway of any other machine.

By: sodase mohamed

How do you find a sytem because I got a computer and when I turned it on it said system not found?

What do I do?

By: prashant

route -n

By: HERNAN HOLGUIN

hi, the information is very helpful;  when I hit the command I only get an internal Ip 10.x.x.x,; I am currently practicing arpspoofing and all I can see on my kali linux network is those Ip's; how can I make kali linux run with my actual network so I can practice with my second laptop which is connected to my verizon router; 

Thank you in advance,

HH