电脑技术学习

What do the flags values in "ifconfig -a" mean?

dn001
This document explains the flags value in ifconfig -a output. For example:
# ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 129.149.141.67 netmask ffffff00 broadcast 129.149.141.255

The flags value is a hexadecimal representation of the state of the interface. Each number in the value is distinct. In the above example, both flags= values are comprised of 7 different hex values, 1,0,0,0,8,4,9. To find out what the value means, follow the chart below: For example if the flags value is 1000849, that means the interface card is:
0x00000008 + 0x00000001 = is a loopback and the card is up
0x00000040 = resources are allocated
0x00000800 = card supports multicasting
=========
0x00000849
Previous to Solaris[TM] 8, the flags value only showed three digits, e.g., flags=843. Below is the chart excerpt from /usr/include/net/if.h:
0x00000001 /* interface is up */
0x00000002 /* broadcast address valid */
0x00000004 /* turn on debugging */
0x00000008 /* is a loopback net */
0x00000010 /* interface is point-to-point link */
0x00000020 /* avoid use of trailers */
0x00000040 /* resources allocated */
0x00000080 /* no address resolution protocol */
0x00000100 /* receive all packets */
0x00000200 /* receive all multicast packets */
0x00000400 /* protocol code on board */
0x00000800 /* supports multicast */
0x00001000 /* multicast using broadcast address */
0x00002000 /* non-unique address */
0x00004000 /* DHCP controls this interface */
0x00008000 /* do not advertise */
0x00010000 /* Do not transmit packets */
0x00020000 /* No address - just on-link subnet */
0x00040000 /* interface address deprecated */
0x00080000 /* address from stateless addrconf */
0x00100000 /* router on this interface */
0x00200000 /* No NUD on this interface */
0x00400000 /* Anycast address */
0x00800000 /* Do not exchange routing info */
0x01000000 /* IPv4 interface */
0x02000000 /* IPv6 interface */
0x04000000 /* Mobile IP controls this interface */
0x08000000 /* Don't failover on NIC failure */
0x10000000 /* NIC has failed */
0x20000000 /* Standby NIC to be used on failures */
0x40000000 /* Standby active or not ? */
0x80000000 /* NIC has been offlined */

标签: