how to get gateway address

Posted by brknl on Server Fault See other posts from Server Fault or by brknl
Published on 2012-04-12T07:32:31Z Indexed on 2012/06/26 3:18 UTC
Read the original article Hit count: 547

Filed under:
|
|
|

I am trying to get gateway address but when i call "route -n" I expect to see something like that

  Destination     Gateway     Genmask      Flags
  0.0.0.0         dnsip      0.0.0.0         UG     0      0        0 eth0

but I only see the flag U ones and gateway ip is 0.0.0.0.

When i look /etc/sysconfig/network/routes i can see the gateway address. I can not use that file because not every versions of open suse have that file. So i need to use a common way to find out the gateway addres.

© Server Fault or respective owner

Related posts about linux

Related posts about ip