NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | LOGICAL INTERFACES | INTERFACE GROUPS | EXAMPLES | SUMMARY OF TRUSTED SOLARIS CHANGES | FILES | ATTRIBUTES | SEE ALSO | DIAGNOSTICS | NOTES
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. ifconfig needs the sys_net_config
privilege in order to 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.
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 that need to open
network devices readable only by root and protected at ADMIN_HIGH
(ether, auto-revarp,
and plumb) are intended to be invoked at ADMIN_HIGH
with effective user ID 0. These restrictions may be overridden by the file_dac_read
, file_dac_write
,
and file_mac_read
privileges.
The following options are supported:
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.
Disable the use of the Address Resolution Protocol ARP.
Use the Dynamic Host Configuration Protocol (DHCP) to automatically acquire an address for this interface. This option has a completely equivalent alias called dhcp.
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.
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.
The specified interface will be removed from the control of dhcpagent.
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.
Checks whether the interface given is under DHCP control. An exit status of 0 means yes.
The IP address on the interface is relinquished, and the interface marked as "down".
DHCP will be started on the interface.
Display the DHCP configuration status of the interface.
Use the Reverse Address Resolution Protocol (RARP) to automatically acquire an address for this interface.
(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 + |
ifconfig -a broadcast + netmask + |
This option is an alias for option auto-dhcp
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.
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.
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.
(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:
with a single hexadecimal number with a leading 0x,
with a dot-notation address,
with a "+" (plus sign) address, or
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.
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.
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.
Tells the in.routed routing daemon that the interface should not be advertised.
Specify unadvertised interfaces.
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.
Disable the use of a "trailer" link level encapsulation.
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.
The interface operand, as well as address parameters that affect it, are described below.
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:
Apply the commands to all interfaces in the system.
Apply the commands to all "down" interfaces in the system.
Like -ad, but only apply the commands if the interface is not under DHCP (Dynamic Host Configuration Protocol) control.
Apply the commands to all "up" interfaces in the system.
Like -au, but only apply the commands if the interface is not under DHCP control.
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.
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).
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.
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 |
ifconfig le0:1 |
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 |
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).
If your workstation is not attached to an Ethernet, the le0 interface should be marked "down" as follows:
example% ifconfig le0 down |
example% ifconfig a |
example% ifconfig a broadcast + |
example% ifconfig le0 ether aa:1:2:3:4:5 |
The ifconfig command needs the sys_net_config
privilege to configure network interfaces; without
privilege, ifconfig displays the status of network interfaces.
The ether, auto-revarp, and plumb options need to open ADMIN_HIGH
network devices readable only by root; these options are intended
to be invoked at ADMIN_HIGH
with
an effective user ID0. Alternately, file_dac_read
, file_dac_write
, and file_mac_read
privileges may be used to override these restrictions.
See attributes(5) for descriptions of the following attributes:
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
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.
NAME | SYNOPSIS | DESCRIPTION | OPTIONS | OPERANDS | LOGICAL INTERFACES | INTERFACE GROUPS | EXAMPLES | SUMMARY OF TRUSTED SOLARIS CHANGES | FILES | ATTRIBUTES | SEE ALSO | DIAGNOSTICS | NOTES