Low Orbit Flux Logo 2 F

Linux How To Find Default Gateway

From time to time you may find yourself needing to look up your default gateway a Linux system. You may need to troubleshoot connectivity or complete some other task but either way it is a relatively common thing to do and something you should be familiar with. Fortunately it is also very easy to do.

You can use the ip command to find the default gateway. Look or grep for the line with the word default in the output. You can also just use “ip r” for short.


ip route show
ip r
ip r | grep default

It will look like this:


default via 192.168.1.1 dev eth1  proto static 

You can also use either of these commands to find the gateway. It will be listed on a line with the G flag set.


route -n
netstat -rn