Pages

Monday, July 25, 2011

Obtaining NIC/LAN information in HP-UX

First find out which devices are available, by which dirver it is used, hardware path etc:

# ioscan -fnClan
Class     I  H/W Path       Driver   S/W State   H/W Type     Description

==========================================================================
lan       0  0/4/2/0        iether   CLAIMED     INTERFACE    HP AB352-60003 PCI/PCI-X 1000Base-T Dual-port Core
lan       1  0/4/2/1        iether   CLAIMED     INTERFACE    HP AB352-60003 PCI/PCI-X 1000Base-T Dual-port Core
lan       2  0/6/0/0/0/0/0/0/0/0  iether   CLAIMED     INTERFACE    HP AD337-60001 PCIe 1000Base-T Dual-port Adapter
lan       3  0/6/0/0/0/0/0/0/0/1  iether   CLAIMED     INTERFACE    HP AD337-60001 PCIe 1000Base-T Dual-port Adapter


For the next step the Class and Interface columns are important. The first line shows the class lan and interface 0, so our device will be lan0, the next device lan1 and so on:

# ifconfig lan0
lan0: flags=1843<UP,BROADCAST,RUNNING,MULTICAST,CKO>
        inet 10.0.0.1 netmask ffffff00 broadcast 192.168.1.255
# ifconfig lan1
lan1: flags=1843<UP,BROADCAST,RUNNING,MULTICAST,CKO>
        inet 10.0.1.1 netmask ffffff00 broadcast 192.168.1.255


But sometime this does not work. For every interface you try to manage with ifconfig you get the following:

# ifconfig lan0
ifconfig: no such interface


Even a request for all interfaces fails:

# ifconfig -a
ifconfig: no such interface


In this case take a look at /etc/rc.config.d/netconf and grep for INTERFACE_NAME:

# grep "INTERFACE_NAME" /etc/rc.config.d/netconf
...
INTERFACE_NAME[0]=lan999
INTERFACE_NAME[1]=lan999:1
INTERFACE_NAME[2]=lan999:2
...


The above file netconf holds all network configuration to use while booting. In this case lan999 is a aggregated interface. Now you can take a look et e.g. lan999:

# ifconfig lan999
lan999: flags=1843<UP,BROADCAST,RUNNING,MULTICAST,CKO>
        inet 10.20.1.0 netmask ffff0000 broadcast 10.20.255.255


Another nice solutions to get all network interface is netstat:

# netstat -i
Name     Mtu  Network   Address   Ipkts Ierrs Opkts Oerrs Coll
lan999   1500 10.20.1.0 dc01      2432  0     4232  0     0
lan999:2 1500 10.20.1.2 db01      2193  0     1695  0     0
lan999:1 1500 10.20.1.1 fs01      1540  0     138   0     0
lo0      4136 loopback  localhost 1281  0     1281  0     0


If you need to know which physical network interface are attached to lan999 then take a look at /etc/rc.config.d/hp_apaconf:

# cat /etc/rc.config.d/hp_apaconf
...
HP_APA_INTERFACE_NAME[0]=lan999
...
HP_APA_MANUAL_LA[0]=2,3
...


The above inforamtion reveals that lan999 consists of two physical interfaces, lan2 and lan3. The last thing you probably need to know is the mac address for each interface. Use lanscan to list all physical (and more virtual) information about your network interfaces:

# lanscan
Hardware Station        Crd Hdw   Net-Interface  NM  MAC       HP-DLPI DLPI
Path     Address        In# State NamePPA        ID  Type      Support Mjr#
0/2/1/0/6/0 0x001570DD57B6 4   UP    lan2 snap2     1   ETHER     Yes     119
0/2/1/0/6/1 0x001570DD57B7 5   UP    lan3 snap3     2   ETHER     Yes     119
0/4/2/0  0x001A4C09E940 0   UP    lan0 snap0     3   ETHER     Yes     119
0/4/2/1  0x001A4C09E941 1   UP    lan1 snap1     6   ETHER     Yes     119
LinkAgg0 0x001A1CD30AE6 900 UP    lan999 snap900 8   ETHER     Yes     119


With the above information you should be able to get most needed information about a existing HP-UX network configuration