Find The Default Gateway From The Command Line In Ubuntu 14.04

Gateway

When your Ubuntu computer is connected to a network, it almost certainly receives a “default gateway” along with its IP address. Basically, every TCP/IP network is divided into segments, and to communicate with other networks outside the segment, the computer needs to send its network traffic to a gateway that forwards the traffic on to the next network segment. Usually, the gateway is the local router or network switch – if you have a home wireless router that device will be your gateway. It is possible to have a network without a gateway, but such a network will be unable to communicate with other network segments, which means it cannot communicate with the Internet. (This is common on isolated networks, such as in a science lab, where the computers need to communicate with each other but not the Internet.) From time to time you may need to find the gateway address to solve a network problem.

To find the gateway address in the Terminal, Ubuntu’s command-line interface, first launch the Terminal by going to the Dash, searching for “Terminal”, and then clicking on the icon for Terminal when it appear. You can also launch the Terminal by hitting the CTRL+ALT+T keys simultaneously.

Once the Terminal launches, type this command and then hit the ENTER key:

route –n

The Terminal will then display the local gateway for each network connection under the “Gateway” heading in the command’s output.

-JM