Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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.