Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ifconfig(1M) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dhcpinfo(1)

dhcpagent(1M)

in.routed(1M)

ndd(1M)

netstat(1M)

ethers(3N)

gethostbyname(3N)

getnetbyname(3N)

hosts(4)

netmasks(4)

networks(4)

nsswitch.conf(4)

attributes(5)

arp(7P)

ifconfig(1M)

NAME

ifconfig − configure network interface parameters

SYNOPSIS

/sbin/ifconfig interface [ address_family ] [ address [ dest_address ] ] [ up ] [ down ]

[ auto-revarp ] [ netmask mask ] [ broadcast address ] [ metric n ] [ mtu n ]

[ trailers | −trailers ] [ private | −private ] [ arp | −arp ] [ plumb ] [ unplumb ]

/usr/sbin/ifconfig interface [ address_family ] [ address [ dest_address ] ] [ up ] [ down ]

[ auto-revarp ] [ netmask mask ] [ broadcast address ] [ metric n ] [ mtu n ]

[ trailers | −trailers ] [ private | −private ] [ arp | −arp ] [ plumb ] [ unplumb ]

/sbin/ifconfig interface { auto-dhcp | dhcp } [ primary ] [ wait seconds ]

drop | extend | ping | release | start | status

/usr/sbin/ifconfig interface { auto-dhcp | dhcp } [ primary ] [ wait seconds ]

drop | extend | ping | release | start | status

DESCRIPTION

The command ifconfig is used to assign an address to a network interface or to configure network interface parameters, or both.  ifconfig must be used at boot time to define the network address of each interface present on a machine; it may also be used at a later time to redefine an interface’s address or other operating parameters.  If no option is specified, ifconfig displays the current configuration for a network interface.  If an address family is specified, ifconfig reports only the details specific to that address family.  Only the super-user may modify the configuration of a network interface.  Options appearing within braces ({}) indicate that one of the options must be specified. 

The two versions of ifconfig, /sbin/ifconfig and /usr/sbin/ifconfig, behave differently with respect to name services.  The order in which names are looked up by /sbin/ifconfig when the system is booting is fixed and cannot be changed.  In contrast, changing /etc/nsswitch.conf may affect the behavior of /usr/sbin/ifconfig.  The system administrator may configure the source and lookup order in the tables via the name service switch.  See nsswitch.conf(4) for more information. 

DHCP Configuration

The third and fourth forms of this command are used to control DHCP (Dynamic Host Configuration Protocol) configuring of the interface.  DHCP is only available on interfaces whose address family is inet.  In this mode, ifconfig is used to control operation of dhcpagent(1M), the DHCP client daemon.  Once an interface is placed under DHCP control (by using the start operand), ifconfig should not, in normal operation, be used to modify the address or characteristics of the interface.  If the address of an interface under DHCP is changed, the agent will implicitly drop the interface from its control, although this will not occur until dhcpagent wakes up to conduct another DHCP operation on the interface. 

OPTIONS

The following options are supported:

arp Enable the use of the Address Resolution Protocol (ARP) in mapping between network level addresses and link level addresses (default).  This is currently implemented for mapping between TCP/IP addresses and 10Mb/s Ethernet addresses. 

−arp Disable the use of the Address Resolution Protocol ARP. 

auto-dhcp Use the Dynamic Host Configuration Protocol (DHCP) to automatically acquire an address for this interface.  This option has a completely equivalent alias called dhcp. 

primary
Defines the interface as the "primary". The interface is defined as the preferred one for the delivery of client-wide configuration data. See dhcpagent(1M) and dhcpinfo(1) for details.  Only one interface can be the primary at any given time. If another interface is subsequently selected as the primary, it replaces the previous one. Nominating an interface as the primary one will not have much significance once the client work station has booted, as many applications will already have started and been configured with data read from the previous primary interface.

wait seconds
ifconfig will wait until the operation either completes or for the interval specified, whichever is the sooner.  If no wait interval is given, and the operation is one that cannot complete immediately, ifconfig will exit immediately but the requested operation will continue.  The exit status of ifconfig in this case will indicate merely the validity of the request, not whether that request was actually successful.  The symbolic value forever may be used in place of a numeric, with obvious meaning. 

drop The specified interface will be removed from the control of dhcpagent. 

extend extend dhcpagent will try to extend the lease on the interface’s IP address.  This is not required, as the agent will automatically extend the lease well before it expires. 

ping Checks whether the interface given is under DHCP control.  An exit status of 0 means yes. 

release The IP address on the interface is relinquished, and the interface marked as "down". 

start DHCP will be started on the interface. 

status Display the DHCP configuration status of the interface. 

auto-revarp Use the Reverse Address Resolution Protocol (RARP) to automatically acquire an address for this interface. 

broadcast address
(inet only.)  Specify the address to use to represent broadcasts to the network.  The default broadcast address is the address with a host part of all 1’s.  A "+" (plus sign) given for the broadcast value causes the broadcast address to be reset to a default appropriate for the (possibly new) address and netmask.  Note: The arguments of ifconfig are interpreted left to right.  Therefore

ifconfig −a netmask + broadcast +

and

ifconfig −a broadcast + netmask +

may result in different values being assigned for the broadcast addresses of the interfaces. 

dhcp This option is an alias for option auto-dhcp (see above). 

down Mark an interface "down".  When an interface is marked "down", the system does not attempt to transmit messages through that interface.  If possible, the interface is reset to disable reception as well.  This action does not automatically disable routes using the interface. 

metric n Set the routing metric of the interface to n; if no value is specified, the default is 0.  The routing metric is used by the routing protocol.  Higher metrics have the effect of making a route less favorable; metrics are counted as addition hops to the destination network or host. 

mtu n Set the maximum transmission unit of the interface to n. For many types of networks, the mtu has an upper limit, for example, 1500 for Ethernet. 

netmask mask (inet only.)  Specify how much of the address to reserve for subdividing networks into sub-networks.  The mask includes the network part of the local address and the subnet part, which is taken from the host field of the address.  The mask contains 1’s for the bit positions in the 32-bit address which are to be used for the network and subnet parts, and 0’s for the host part.  The mask should contain at least the standard network portion, and the subnet field should be contiguous with the network portion.  The mask can be specified in one of four ways:

a) with a single hexadecimal number with a leading 0x,

b) with a dot-notation address,

c) with a "+" (plus sign) address, or

d) with a pseudo host name/pseudo network name found in the network database networks(4). 

If a "+" (plus sign) is given for the netmask value, the mask is looked up in the netmasks(4) database.  This lookup finds the longest matching netmask in the database by starting with the interface’s IP address as the key and iteratively masking off more and more low order bits of the address.  This iterative lookup ensures that the netmasks(4) database can be used to specify the netmasks when variable length subnetmasks are used within a network number. 

If a pseudo host name/pseudo network name is supplied as the netmask value, netmask data may be located in the hosts or networks database.  Names are looked up by first using gethostbyname(3N).  If not found there, the names are looked up in getnetbyname(3N).  These interfaces may in turn use nsswitch.conf(4) to determine what data store(s) to use to fetch the actual value. 

plumb Open the device associated with the physical interface name and set up the streams needed for TCP/IP to use the device.  Before this is done, the interface will not show up in the output of ifconfig −a. 

unplumb Destroy any streams associated with this device and close the device.  After this command is executed, the device name should not show up in the output of ifconfig −a. 

private Tells the in.routed routing daemon that the interface should not be advertised. 

−private Specify unadvertised interfaces. 

trailers This flag previously caused a non-standard encapsulation of inet packets on certain link levels.  Drivers supplied with this release no longer use this flag.  It is provided for compatibility, but is ignored. 

−trailers Disable the use of a "trailer" link level encapsulation. 

up Mark an interface "up".  This happens automatically when setting the first address on an interface.  The up option enables an interface after an ifconfig down, which reinitializes the hardware. 

OPERANDS

The interface operand, as well as address parameters that affect it, are described below. 

interface A string of the form, name physical-unit, for example, le0 or ie1; or of the form name physical-unit:logical-unit, for example, le0:1.  Five special interface names, −a, −ad, −au, −adD, and −auD, are reserved and refer to all or a subset of the interfaces in the system.  If one of these interface names is given, the commands following it are applied to all of the interfaces that match:

−a Apply the commands to all interfaces in the system. 

−ad Apply the commands to all "down" interfaces in the system. 

−adD Like −ad, but only apply the commands if the interface is not under DHCP (Dynamic Host Configuration Protocol) control. 

−au Apply the commands to all "up" interfaces in the system. 

−auD Like −au, but only apply the commands if the interface is not under DHCP control. 

address_family Since an interface may receive transmissions in differing protocols, each of which may require separate naming schemes, the parameters and addresses are interpreted according to the rules of some address family, specified by the address_family parameter.  The address families currently supported are ether and inet.  If no address family is specified, inet is assumed. 

address For the TCP/IP family (inet), the address is either a host name present in the host name data base (see hosts(4)) or in the Network Information Service (NIS) map hosts, or a TCP/IP address expressed in the Internet standard "dot notation".  Typically, an Internet address specified in dot notation consists of your system’s network number and the machine’s unique host number.  A typical Internet address is 192.9.200.44, where 192.9.200 is the network number and 44 is the machine’s host number. 

For the ether address family, the address is an Ethernet address represented as x:x:x: x:x:x where x is a hexadecimal number between 0 and FF. 

Some, though not all, of the Ethernet interface cards have their own addresses.  To use cards that do not have their own addresses, refer to section 3.2.3(4) of the IEEE 802.3 specification for a definition of the locally administered address space.  The use of interface groups should be restricted to those cards with their own addresses (see INTERFACE GROUPS). 

dest_address If the dest_address parameter is supplied in addition to the address parameter, it specifies the address of the correspondent on the other end of a point-to-point link. 

LOGICAL INTERFACES

Solaris TCP/IP allows multiple logical interfaces to be associated with a physical network interface.  This allows a single machine to be assigned multiple IP addresses, even though it may have only one network interface.  Physical network interfaces have names of the form driver-name physical-unit-number, while logical interfaces have names of the form driver-name physical-unit-number:logical-unit-number.  A physical interface is configured into the system using the plumb sub-command.  For example:

ifconfig le0 plumb

Logical interfaces do not need to be "plumbed".  Once a physical interface has been "plumbed", logical interfaces associated with the physical interface can be configured by naming them in subsequent ifconfig commands.  However, only root can create or delete a logical interface.  For example, when executed by root the command:

ifconfig le0:1

allocates a logical interface associated with the physical interface le0 and reports its status.  When executed by a non-privileged user, ifconfig will report the status of the interface if it already exists, or give an error message if it does not exist. 

A logical interface can be configured with parameters ( address, netmask, and so on) different from the physical interface with which it is associated.  Logical interfaces that are associated with the same physical interface can be given different parameters as well.  Each logical interface must be associated with a physical interface.  So, for example, the logical interface le0:1 can only be configured after the physical interface le0 has been plumbed. 

To delete a logical interface, simply name the interface specifying an address of 0, after ensuring that the interface has been marked as "down".  For example, the command:

ifconfig le0:1 0 down

will delete the logical interface le0:1. 

INTERFACE GROUPS

If an interface (logical or physical) shares an IP prefix with another interface, these interfaces are collected into an interface group. IP uses an interface group to rotate source address selection when the source address is unspecified, and in the case of multiple physical interfaces in the same group, to scatter traffic across different IP addresses on a per-IP-destination basis.  (See netstat(1M) for per-IP-destination information.) 

This feature may be disabled by using ndd(1M). 

EXAMPLES

If your workstation is not attached to an Ethernet, the le0 interface should be marked "down" as follows:

example% ifconfig le0 down

To print out the addressing information for each interface, use the following command:

example% ifconfig −a

To reset each interface’s broadcast address after the netmasks have been correctly set, use the next command:

example% ifconfig −a broadcast +

To change the Ethernet address for interface le0, use the following command:

example% ifconfig le0 ether aa:1:2:3:4:5

FILES

/etc/netmasks netmask data

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

/usr/sbin

ATTRIBUTE TYPE ATTRIBUTE VALUE
Availability SUNWcsu

/sbin

ATTRIBUTE TYPE ATTRIBUTE VALUE
Availability SUNWcsr

SEE ALSO

dhcpinfo(1), dhcpagent(1M), in.routed(1M), ndd(1M), netstat(1M), ethers(3N), gethostbyname(3N), getnetbyname(3N), hosts(4), netmasks(4), networks(4), nsswitch.conf(4), attributes(5), arp(7P)

DIAGNOSTICS

ifconfig sends messages that indicate if:

• the specified interface does not exist

• the requested address is unknown

• the user is not privileged and tried to alter an interface’s configuration

NOTES

It is recommended that the names broadcast, down, private, trailers, up, and the other possible option names not be selected when choosing host names.  Choosing any one of these names as host names will cause bizarre problems that can be extremely difficult to diagnose. 

SunOS 5.6  —  Last change: 28 Mar 1997

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026