Tutorial on Figuring out your server: IP Addresses

Name Service Queries
This tutorial has examples for four versions of UNIX: Linux, Oracle’s Solaris, Apple’s Macintosh OS X and IBM’s AIX
IP Addresses
The command ifconfig –a shows network interface information, particularly the IP address. The output from ifconfig -a can be verbose, notably in the OS X version, so only a portion of the output is shown in the examples, below. After the examples, some of the other information is discussed.

Note that in most of these examples, more than one network interface is be present. Also, output from the loopback interface is shown. The command ifconfig -a will also give you the hardware address (also known as the MAC or Ethernet address). There is a separate hardware address for each interface. Solaris has a setting called local-mac-address that will force one hardware address to be shared by all interfaces (yes, this is understandably confusing for the network guys).

The address is the loopback address associated with the loopback interface and is reserved for traffic staying within the host. This is often used to define the loghost. The logs are sometimes kept on one computer so that there is a centralized location for logs. In that case, the loghost entry in /etc/hosts will be for the computer where the logs are kept. Otherwise, loghost will be set to, which is the default setting.

paloalto [1]> grep log /etc/hosts       localhost loghost

penguin [1]> ifconfig -a | more
eth0                Link encap:Ethernet  HWaddr 00:13:21:1B:0A:80  
                inet addr:  Bcast:  Mask:

eth1                Link encap:Ethernet  HWaddr 00:13:21:1B:0A:7F  
                inet addr:  Bcast:  Mask:

lo                Link encap:Local Loopback  
                inet addr:  Mask:

In this example, the Linux server known as penguin is also on the subnet It is connected to this subnet on the secondary network interface eth1. Note that the hardware address is slightly different for the two interfaces. Linux interface names will vary with the type of interface. Ethernet interfaces are called eth0, eth1, et cetera while FDDI interfaces are called fddi0, fddi1, and so on.

paloalto [1]> ifconfig -a | more
lo0: flags=1000849 mtu 8232 index 1
                inet netmask ff000000
hme0: flags=1000843 mtu 1500 index 2
                inet  netmask ffffff00 broadcast
                ether 8:0:20:ec:da:66
qfe0: flags=1000843 mtu 1500 index 3
                inet  netmask ffffff00 broadcast
                ether 8:0:20:ec:da:66

In this example, the Solaris server known as paloalto is also on the subnet It is connected to this subnet on the secondary network interface qfe0. Note that the MAC/ether address is the same for both interfaces. This is based on the Solaris system setting local-mac-address? which can be changed by the SAs.
paloalto [1]> eeprom | grep -i mac

Note that ifconfig –a in Solaris will display the hardware address only if you’re logged in as root (administrator).

cupertino [1]> ifconfig -a | more
lo0: flags=8049 mtu 16384
        inet netmask 0xff000000
en0: flags=8863 mtu 1500
        inet netmask 0xffffffc0 broadcast
        ether 00:14:51:05:db:b6
        media: autoselect (100baseTX ) status: active
en1: flags=8822 mtu 1500
        ether 00:11:24:a2:d9:48
        media: autoselect () status: inactive

The easiest way to get OS X  network information is with system_profiler. The first section of the system_profiler output gives you a hardware overview. Immediately after that is the network section. Note that system_profiler gives you information on Airport (wireless) as well as Ethernet connections.

cupertino [1]> system_profiler | more
Built-in Ethernet:
        Type: Ethernet
        Hardware: Ethernet
        BSD Device Name: en0
        Has IP Assigned: No
                Configuration Method: DHCP
                Configuration Method: Automatic
                MAC Address: 00:14:51:05:db:b6
                Media Options:
                Media Subtype: none
        Type: AirPort
        Hardware: AirPort
        BSD Device Name: en1
        Has IP Assigned: Yes
        IPv4 Addresses:
                Configuration Method: DHCP
                Interface Name: en1
                Subnet Masks:
                Configuration Method: Automatic
                MAC Address: 00:11:24:a2:d9:48
Subnet Mask:

In this example, there is a built-in ethernet network interface, known as en0, and an AirPort (wireless) network interface, en1. The AirPort interface is in use and the configuration method is DHCP. This means that a server on the network assigns the IP address (the D in DHCP stands for Dynamic). IPv4 is short for Internet protocol version 4. This is the version of TCP/IP used at most companies. IPv6 is a newer version that will, among other things, give us more addresses to work with.

The output from system_profiler also gives you information on which network interface is in use. The laptop in this example has two network interfaces, one of which is AirPort (wireless networking) and the other is a standard interface, known as Built-in Ethernet.

endicott[1]> ifconfig -a | more
en2: flags=5e080863,c0
        inet netmask 0xffffff00 broadcast
        tcp_sendspace 131072 tcp_recvspace 65536
lo0: flags=e08084b
inet netmask 0xff000000 broadcast

If you are using AIX, you can also use prtconf to find your computer’s address:

endicott[1]> prtconf | more
Network Information
        Host Name: endicott
        IP Address:
        Sub Netmask:

Once you are somewhat familiar with the output from ifconfig -a, use grep to get just the information that you want. For example, to see the IP address, try:
ifconfig -a | grep -i inet

You may hear about other methods of determining the IP Address, but these are essentially checking the same configuration files that are read at startup. The ifconfig command gives you the actual address being used. This should be a moot difference, but UNIX systems administrators will sometimes change and test network configuration on the fly before updating the configuration files.

Suggestions for Future Learning
More information on network-related configuration files and how IP addresses are assigned is provided  in UNIX For Application Support Staff Chapter 4

Tutorial Contents

Name Service queries with DNS and NIS

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?

Name Service Queries
Name Service Queries