Sign up ×
Server Fault is a question and answer site for 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         dnsip         UG     0      0        0 eth0

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

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 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

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


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

Your Answer


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