July 20 2013

Linux Default Gateway IP Address

Tagged Under :

In Windows Machine if want to check our IP Address or Gateway the easy method is use Command Prompt type ipconfig then it will lists down everything. But in LINUX it different.

In Linux, they call it ifconfig, open the terminal and type ifconfig it will lists down all the available network. But it didn’t print out the Gateway IP Address.

The easy way to print out Gateway IP Address command.
route -n | grep 'UG[ \t]' | awk '{print $2}'
Or, you can use others command to print out the Gateway.
route -nee   U     1      0        0 eth0     0     0      0         UG    0      0        0 eth0     0     0 is gateway IP address. The flag U indicates that route is up and G indicates that it is gateway.

Make a Comment

You must be logged in to post a comment.