How to find Gateway Ip in Linux

Share it:
How to find Gateway Ip in Linux

Gateway is a node (ie.router) that act as a network point used to pass the data from local area network to outside network.It is not possible to use internet without gateways.

In this tutorial i will show you how to find the gateway IP in Linux using route,netstat and ip route commands

Using route command

route -n
Use the command as "route" in terminal followed by -n option to list the gateway ip address
  • -n for showing numerical addresses

From the image my gateway IP address is and the flags U indicates link is up and G represents the gateway

Using netstat command

netstat -rn 
The command "netstat"  will print all the list of open sockets, so use the options r and n
  • -r for showing the routing table
  • -n for showing numerical addresses

Using ip route command

ip route
The command "ip route" will also used for displaying the gateway details

Thank you for referring this tutorial.
Share it:

Post A Comment: