How do I find out my Linux gateway / router IP address?
Q. How do I find out my gateway IP for a computer or a network device that allows or controls access to another computer or network under Linux / UNIX?
A. A gateway is a network point that acts as an entrance to another network. On the Internet, a node or stopping point can be either a gateway node or a host (end-point) node. Both the computers of Internet users and the computers that serve pages to users are host nodes. The computers that control traffic within your company's network or at your local Internet service provider (ISP) are gateway nodes. In the network for an enterprise, a computer server acting as a gateway node is often also acting as a proxy server and a firewall server. A gateway is often associated with both a router, which knows where to direct a given packet of data that arrives at the gateway, and a switch, which furnishes the actual path in and out of the gateway for a given packet.
Find out Gateway / router IP address under Linux / UNIX
You need to use command called route. It manipulates the kernel’s IP routing tables. It can also use as follows to print gateway / router IP address:
$ route -n
Output:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 ra0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 ra0
192.168.1.1 is gateway IP address for our computer. The flag U indicates that route is up and G indicates that it is gateway. You can print gateway name, enter:
$ route
Output:
Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 0 0 0 ra0 default wrt 0.0.0.0 UG 0 0 0 ra0
Second column prints Gateway hostname / IP address. In our example wrt is gateway.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Ubuntu Linux Configure Gateway / Default Routing IP Address
- Openbsd change, add or display default gateway
- OpenBSD Set / Change Default Gateway
- Linux creating or adding new network alias to a network card (NIC)
- Red Hat / CentOS Linux Setting a Default Gateway
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: destination_gateway, firewall_server, gateway_ip_address, gateway_router, ip_routing, router_ip_address, route_command, ubuntu_gateway



May 29th, 2008 at 7:37 pm
The route command you mentioned helps solve my problem. Thanks!