Tutorial on Figuring Out Your Server: Router/Gateway

IP Addresses
Server Config
This tutorial has examples for four versions of UNIX: Linux, Oracle’s Solaris, Apple’s Macintosh OS X and IBM’s AIX
All servers need fixed addresses so you know what address to connect to. In order for a computer with a fixed address to be on a network, it must be configured to communicate with a specific router. A router can only support a finite number of addresses within a finite area. Therefore, if you work with servers in several different data centers, gateway information will narrow down the location of your server. A network subnet (VLAN) is limited to one building, and more often, one floor or one data center in a building. So, a gateway/router can only be in a very limited number of places, such as a particular building or portion of a building such as a floor or data center.

The examples, above, also give you the router’s address. Note that the router is sometimes referred to as the gateway.

Routing information can be displayed with netstat –rn, including the default gateway/router. If you have network interfaces on two different subnets, netstat -rn or netstat - r will tell you which interface is used for which subnet. The n option shows address numbers rather than hostnames and network names, which most people will find easier to follow.

The flags mean the following:
•G: router uses a gateway
•U: interface is up
•H: only a single host can be reached (loopback interface will display H)
•D: dynamically created route

Gateway information is helpful when testing if a server is properly configured for the network. If you are logged in on a server’s console and you think there is a network issue, you will want to see if you can you ping the gateway/router. (Scroll down to end for information on finding more information on troubleshooting network issues).

penguin [1]> netstat -rn | more
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth1   U         0 0          0 eth0         UG        0 0          0 eth0

In this example, the default router is and is reached via the eth0 interface.

paloalto [1]> netstat -rn | more
Routing Table: IPv4
 Destination           Gateway           Flags  Ref   Use   Interface
-------------------- -------------------- ----- ----- ------ ---------         U        1   6250  qfe0         U        1   2942  hme0
default              UG       1  73523               UH       5 100698  lo0

In this example, the default router is and is reached via the hme0 interface. The address for that interface is and is on the network. The other interface is qfe0 and is on the network. The address for the qfe0 interface is Data for the network will be routed through the qfe0 interface.

cupertino [1]> netstat -rn | more
Routing tables
Destination        Gateway            Flags    Refs      Use  Netif Expire
default          UGSc        5        8    en1          UH         10    33948    lo0

In this example, the default router is and is reached via the en1 interface. The address is the loopback address associated with the loopback interface lo0 and refers to the server.

endicott[1]> netstat -rn
Routing tables
Destination      Gateway           Flags   Refs     Use  If   PMTU Exp Groups
Route Tree for Protocol Family 2 (Internet):
default     UG       26 188078097  en2     -   -      -  
127/8           U         7   641477  lo0     -   -      -     UHSb      0        0  en2     -   -      -   =>
192.168.22/24     U         1 11545367  en2     -   -      -         UGHS     0    22102  lo0     -   -      -     UHSb      0        4  en2     -   -      -  

In this example, there is one network interface, which is en2. It is on the network and the default router is

Suggestions for Future Learning
More information on interpreting output from netstat and ifconfig as well as networking in general is provided in UNIX For Application Support Staff Chapter 4

Tutorial Contents

Name Service queries with DNS and NIS

IP Addresses

What Is My Server’s Configuration ?

Hardware Information : CPU and Memory

Environmental Variables : Your Configuration

Disk Usage  and Listing Directory Contents

Who Else  is Logged in?

IP Addresses
Server Config