Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Jun 26 '12 at 2:27

This question came from our site for professional and enthusiast programmers.

1 Answer 1

You can use:

ip route get 8.8.8.8

Where 8.8.8.8 is an IP address located outside of your network. (In this case is the Google DNS)

Or:

ip route list exact 0/0
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.