flybywire Asked: 2009-07-14 06:46:04 +0800 CST2009-07-14 06:46:04 +0800 CST 2009-07-14 06:46:04 +0800 CST how can I find the default gateway of an ubuntu box 772 how can I find the default gateway of an ubuntu box linux ubuntu networking ip 3 Answers Voted Best Answer Mikeage 2009-07-14T06:48:00+08:002009-07-14T06:48:00+08:00 Classic answer route Look for a line that says something like: default 10.63.3.254 0.0.0.0 UG 0 0 0 eth0 The second column contains the default gateway, and the last column is the interface. You can also use the ip command: ip route which will give you something like default via 10.63.3.254 dev eth0 Vatine 2009-07-14T07:06:04+08:002009-07-14T07:06:04+08:00 You can also use "netstat -nr" (I usually leave the n in the flags, so as to not have to wait for host resolution if there's a DNS issue). Matt 2009-07-14T06:49:09+08:002009-07-14T06:49:09+08:00 grog:/var/log# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 You can also check /etc/network/interfaces to see what it'll be on next reboot or networking restart.
Classic answer
Look for a line that says something like:
The second column contains the default gateway, and the last column is the interface.
You can also use the ip command:
which will give you something like
You can also use "netstat -nr" (I usually leave the n in the flags, so as to not have to wait for host resolution if there's a DNS issue).
You can also check /etc/network/interfaces to see what it'll be on next reboot or networking restart.