How to Find Default Gateway in Linux

The easiest way to find your default gateway in Linux is by running the ip route command. It will display your network's routing table, and the default gateway is listed after the word default.

Using the ip route Command

Another method is using netstat -rn. This command will show you the kernel routing table, and the default gateway will appear under the "Gateway" column.

Check with netstat Command

You can also use the route -n command to find the default gateway. The gateway address is listed in the Gateway column, next to the destination 0.0.0.0.

Using the route Command

For systems using NetworkManager, type nmcli dev show | grep GATEWAY. This will display the default gateway of your active network interface.

Check Default Gateway via nmcli

If you're on a Linux desktop environment, you can check the default gateway through the network settings GUI, typically under the "Routes" or "IPv4" tab.

Using GUI Network Tools

For more Linux tips and tutorials, visit unixmen.com—your ultimate resource for mastering Linux and its networking commands.

Learn More at unixmen.com