Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (9905 KB)
ifconfig(1M)Name | Synopsis | Description | Options | Operands | INTERFACE FLAGS | LOGICAL INTERFACES | IP MULTIPATHING GROUPS | CONFIGURING IPv6 INTERFACES | Examples | Files | Attributes | See Also | Diagnostics | Notes Name
Synopsisifconfig interface [address_family] [address [/prefix_length] [dest_address]] [addif address [/prefix_length]] [removeif address [/prefix_length]] [arp | -arp] [auth_algs authentication algorithm] [encr_algs encryption algorithm] [encr_auth_algs authentication algorithm] [auto-revarp] [broadcast address] [deprecated | -deprecated] [preferred | -preferred] [destination dest_address] [ether [address]] [failover | -failover] [group [name | ""]] [index if_index] [ipmp] [metric n] [modlist] [modinsert mod_name@pos] [modremove mod_name@pos] [mtu n] [netmask mask] [plumb] [unplumb] [private | -private] [nud | -nud] [set [address] [/netmask]] [standby | -standby] [subnet subnet_address] [tdst tunnel_dest_address] [token address/prefix_length] [tsrc tunnel_src_address] [trailers | -trailers] [up] [down] [usesrc [name | none]] [xmit | -xmit] [encaplimit n | -encaplimit] [thoplimit n] [router | -router] [zone zonename | -zone | -all-zones]
ifconfig [address_family] interface {auto-dhcp | dhcp} [primary]
[wait seconds] drop | extend | inform | ping
| release | start | status
DescriptionThe command ifconfig is used to assign an address to a network interface and to configure network interface parameters. The ifconfig command 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 privileged users may modify the configuration of a network interface. Options appearing within braces ({ }) indicate that one of the options must be specified. DHCP ConfigurationThe forms of ifconfig that use the auto-dhcp or dhcp arguments are used to control the Dynamic Host Configuration Protocol (“DHCP”) configuration of the interface. 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, dhcpagent will remove the interface from its control. Options
The following options are supported: Operands
The interface operand, as well as address parameters that affect it, are described below. INTERFACE FLAGS
The ifconfig command supports the following interface flags. The term “address” in this context refers to a logical interface, for example, eri0:0, while “interface” refers to the physical interface, for example, eri0. LOGICAL INTERFACESSolaris 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 command. For example:
Once a physical interface has been “plumbed”, logical interfaces associated with the physical interface can be configured by separate -plumb or -addif options to the ifconfig command.
allocates a specific logical interface associated with the physical interface eri0. The command
allocates the next available logical unit number on the eri0 physical interface and assigns an address and prefix_length. A logical interface can be configured with parameters ( address,prefix_length, 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 an existing and “up” physical interface. So, for example, the logical interface eri0:1 can only be configured after the physical interface eri0 has been plumbed. To delete a logical interface, use the unplumb or removeif options. For example,
will delete the logical interface eri0:1. IP MULTIPATHING GROUPS
Physical interfaces that share the same link–layer broadcast domain must be collected into a single IP Multipathing (IPMP) group using the group subcommand. Each IPMP group has an associated IPMP IP interface, which can either be explicitly created (the preferred method) by using the ipmp subcommand or implicitly created by ifconfig in response to placing an IP interface into a new IPMP group. Implicitly-created IPMP interfaces will be named ipmpN where N is the lowest integer that does not conflict with an existing IP interface name or IPMP group name. Each IPMP IP interface is created with a matching IPMP group name, though it can be changed using the group subcommand. Each IPMP IP interface hosts a set of highly-available IP addresses. These addresses will remain reachable so long as at least one interface in the group is active, where “active” is defined as having at least one UP address and having INACTIVE, FAILED, and OFFLINE clear. IP addresses hosted on the IPMP IP interface may either be configured statically or configured through DHCP by means of the dhcp subcommand. Interfaces assigned to the same IPMP group are treated as equivalent and monitored for failure by in.mpathd. Provided that active interfaces in the group remain, IP interface failures (and any subsequent repairs) are handled transparently to sockets-based applications. IPMP is also integrated with the Dynamic Reconfiguration framework (see cfgadm(1M)), which enables network adapters to be replaced in a way that is invisible to sockets-based applications. The IP module automatically load-spreads all outbound traffic across all active interfaces in an IPMP group. Similarly, all UP addresses hosted on the IPMP IP interface will be distributed across the active interfaces to promote inbound load-spreading. The ipmpstat(1M) utility allows many aspects of the IPMP subsystem to be observed, including the current binding of IP data addresses to IP interfaces. When an interface is placed into an IPMP group, any UP logical interfaces are “migrated” to the IPMP IP interface for use by the group, unless: Likewise, once an interface is in a group, if changes are made to a logical interface such that it is UP and not exempted by one of the conditions above, it will also migrate to the associated IPMP IP interface. Logical interfaces never migrate back, even if the physical interface that contributed the address is removed from the group. Each interface placed into an IPMP group may be optionally configured with a “test” address that in.mpathd will use for probe-based failure detection; see in.mpathd(1M). These addresses must be marked NOFAILOVER (using the -failover subcommand) prior to being marked UP. Test addresses may also be acquired through DHCP by means of the dhcp subcommand. For more background on IPMP, please see the IPMP–related chapters of the System Administration Guide: Network Interfaces and Network Virtualization. CONFIGURING IPv6 INTERFACESWhen an IPv6 physical interface is plumbed and configured “up” with ifconfig, it is automatically assigned an IPv6 link-local address for which the last 64 bits are calculated from the MAC address of the interface.
The following example shows that the link-local address has a prefix of fe80::/10.
Link-local addresses are only used for communication on the local subnet and are not visible to other subnets. If an advertising IPv6 router exists on the link advertising prefixes, then the newly plumbed IPv6 interface will autoconfigure logical interface(s) depending on the prefix advertisements. For example, for the prefix advertisement 2001:0db8:3c4d:0:55::/64, the autoconfigured interface will look like:
Even if there are no prefix advertisements on the link, you can still assign global addresses manually, for example:
To configure boot-time defaults for the interface eri0, place the following entry in the /etc/hostname6.eri0 file: addif 2001:0db8:3c4d:55:a00:20ff:fe8e:f3ad/64 up Configuring IP-over-IP Tunnel Interfaces
An IP tunnel is conceptually comprised of two parts: a virtual link between two or more IP nodes, and an IP interface above this link which allows the system to transmit and receive IP packets encapsulated by the underlying link. The dladm(1M) command is used to configure tunnel links, and ifconfig is used to configure IP interfaces over those tunnel links. An IPv4-over-IPv4 tunnel is created by plumbing an IPv4 interface over an IPv4 tunnel link. An IPv6-over-IPv4 tunnel is created by plumbing an IPv6 interface over an IPv6 tunnel link, and so forth. When IPv6 interfaces are plumbed over IP tunnel links, their IPv6 addresses are automatically set. For IPv4 and IPv6 tunnels, source and destination link-local addresses of the form fe80::interface-id are configured. For IPv4 tunnels, the interface-id is the IPv4 tunnel source or destination address. For IPv6 tunnels, the interface-id is the last 64 bits of the IPv6 tunnel source or destination address. For example, for an IPv4 tunnel between 10.1.2.3 and 10.4.5.6, the IPv6 link-local source and destination addresses of the IPv6 interface would be fe80::a01:203 and fe80::a04:506. For an IPv6 tunnel between 2000::1234:abcd and 3000::5678:abcd, the IPv6 link-local source and destination addresses of the interface would be fe80::1234:abcd and fe80::5678:abcd. These default link-local addresses can be overridden by specifying the addresses explicitly, as with any other point-to-point interface. For 6to4 tunnels, a 6to4 global address of the form 2002:tsrc::1/16 is configured. The tsrc portion is the tunnel source IPv4 address. The prefix length of the 6to4 interface is automatically set to 16, as all 6to4 packets (destinations in the 2002::/16 range) are forwarded to the 6to4 tunnel interface. For example, for a 6to4 link with a tunnel source of 75.1.2.3, the IPv6 interface would have an address of 2002:4b01:203::1/16. Additional IPv6 addresses can be added using the addif option or by plumbing additional logical interfaces. For backward compatibility, the plumbing of tunnel IP interfaces with special names will implicitly result in the creation of tunnel links without invoking dladm create-iptun. These tunnel names are: These tunnels are “implicit tunnels”, denoted with the i flag in dladm show-iptun output. The tunnel links over which these special IP interfaces are plumbed are automatically created, and they are automatically deleted when the last reference is released (that is, when the last IP interface is unplumbed). The tsrc, tdst, encaplim, and hoplimit options to ifconfig are obsolete and maintained only for backward compatibility. They are equivalent to their dladm(1M) counterparts. Display of Tunnel Security SettingsThe ifconfig output for IP tunnel interfaces indicates whether IPsec policy is configured for the underlying IP tunnel link. For example, a line of the following form will be displayed if IPsec policy is present:
If you do net set security policy, using either ifconfig or ipsecconf(1M), there is no tunnel security setting displayed. ExamplesExample 1 Using the ifconfig CommandIf your workstation is not attached to an Ethernet, the network interface, for example, eri0, should be marked “down” as follows:
Example 2 Printing Addressing InformationTo print out the addressing information for each interface, use the following command:
Example 3 Resetting the Broadcast AddressTo reset each interface's broadcast address after the netmasks have been correctly set, use the next command:
Example 4 Changing the Ethernet AddressTo change the Ethernet address for interface ce0, use the following command:
Example 5 Configuring an IP-in-IP TunnelTo configure an IP-in-IP tunnel, first create an IP tunnel link (tunsrc and tundst are hostnames with corresponding IPv4 entries in /etc/hosts):
Then plumb a point-to-point interface, supplying the source and destination addresses (mysrc and thedst are hostnames with corresponding IPv4 entries in /etc/hosts):
Use ipsecconf(1M), as described above, to configure tunnel security properties. Configuring IPv6 tunnels is done by using a tunnel type of ipv6 with create-iptun. IPv6 interfaces can also be plumbed over either type of tunnel. Example 6 Configuring 6to4 TunnelsTo configure 6to4 tunnels, first create a 6to4 tunnel link (myv4addr is a hostname with a corresponding IPv4 entry in /etc/hosts):
Then an IPv6 interface is plumbed over this link:
The IPv6 address of the interface is automatically set as described above. Example 7 Configuring IP Forwarding on an InterfaceTo enable IP forwarding on a single interface, use the following command:
To disable IP forwarding on a single interface, use the following command:
Example 8 Configuring Source Address Selection Using a Virtual InterfaceThe following command configures source address selection such that every packet that is locally generated with no bound source address and going out on qfe2 prefers a source address hosted on vni0.
The ifconfig -a output for the qfe2 and vni0 interfaces displays as follows: qfe2: flags=1100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4> mtu 1500 index 4 usesrc vni0 inet 1.2.3.4 netmask ffffff00 broadcast 1.2.3.255 ether 0:3:ba:17:4b:e1 vni0: flags=20011100c1<UP,RUNNING,NOARP,NOXMIT,ROUTER,IPv4,VIRTUAL> mtu 0 index 5 srcof qfe2 inet 3.4.5.6 netmask ffffffff Observe, above, the usesrc and srcof keywords in the ifconfig output. These keywords also appear on the logical instances of the physical interface, even though this is a per-physical interface parameter. There is no srcof keyword in ifconfig for configuring interfaces. This information is determined automatically from the set of interfaces that have usesrc set on them. The following command, using the none keyword, undoes the effect of the preceding ifconfig usesrc command.
Following this command, ifconfig -a output displays as follows: qfe2: flags=1100843<UP,BROADCAST,RUNNING,MULTICAST,ROUTER,IPv4> mtu 1500 index 4 inet 1.2.3.4 netmask ffffff00 broadcast 1.2.3.255 ether 0:3:ba:17:4b:e1 vni0: flags=20011100c1<UP,RUNNING,NOARP,NOXMIT,ROUTER,IPv4,VIRTUAL> mtu 0 index 5 inet 3.4.5.6 netmask ffffffff Note the absence of the usesrc and srcof keywords in the output above. Example 9 Configuring Source Address Selection for an IPv6 AddressThe following command configures source address selection for an IPv6 address, selecting a source address hosted on vni0.
Following this command, ifconfig -a output displays as follows: qfe1: flags=2000841<UP,RUNNING,MULTICAST,IPv6> mtu 1500 index 3 usesrc vni0 inet6 fe80::203:baff:fe17:4be0/10 ether 0:3:ba:17:4b:e0 vni0: flags=2002210041<UP,RUNNING,NOXMIT,NONUD,IPv6,VIRTUAL> mtu 0 index 5 srcof qfe1 inet6 fe80::203:baff:fe17:4444/128 vni0:1: flags=2002210040<RUNNING,NOXMIT,NONUD,IPv6,VIRTUAL> mtu 0 index 5 srcof qfe1 inet6 fec0::203:baff:fe17:4444/128 vni0:2: flags=2002210040<RUNNING,NOXMIT,NONUD,IPv6,VIRTUAL> mtu 0 index 5 srcof qfe1 inet6 2000::203:baff:fe17:4444/128 Depending on the scope of the destination of the packet going out on qfe1, the appropriately scoped source address is selected from vni0 and its aliases. Example 10 Using Source Address Selection with Shared-IP ZonesThe following is an example of how the usesrc feature can be used with the zones(5) facility in Solaris. The following commands are invoked in the global zone:
Following the preceding commands, the ifconfig -a output for the virtual interfaces would display as: vni0: flags=20011100c1<UP,RUNNING,NOARP,NOXMIT,ROUTER,IPv4,VIRTUAL> mtu 0 index 23 srcof hme0 eri0 qfe0 inet 10.0.0.1 netmask ffffffff vni0:1: flags=20011100c1<UP,RUNNING,NOARP,NOXMIT,ROUTER,IPv4,VIRTUAL> mtu 0 index 23 zone test1 srcof hme0 eri0 qfe0 inet 10.0.0.2 netmask ffffffff vni0:2: flags=20011100c1<UP,RUNNING,NOARP,NOXMIT,ROUTER,IPv4,VIRTUAL> mtu 0 index 23 zone test2 srcof hme0 eri0 qfe0 inet 10.0.0.3 netmask ffffffff vni0:3: flags=20011100c1<UP,RUNNING,NOARP,NOXMIT,ROUTER,IPv4,VIRTUAL> mtu 0 index 23 zone test3 srcof hme0 eri0 qfe0 inet 10.0.0.4 netmask ffffffff There is one virtual interface alias per zone (test1, test2, and test3). A source address from the virtual interface alias in the same zone is selected. The virtual interface aliases were created using zonecfg(1M) as follows:
The test2 and test3 zone interfaces and addresses are created in the same way. Example 11 Turning Off DHCPv6The following example shows how to disable automatic use of DHCPv6 on all interfaces, and immediately shut down DHCPv6 on the interface named hme0. See in.ndpd(1M) and ndpd.conf(4) for more information on the automatic DHCPv6 configuration mechanism.
FilesAttributesSee attributes(5) for descriptions of the following attributes:
See Alsodhcpinfo(1), cfgadm(1M), dhcpagent(1M), dladm(1M), if_mpadm(1M), in.mpathd(1M), in.ndpd(1M), in.routed(1M), ipmpstat(1M), ipsecconf(1M), ndd(1M), netstat(1M), zoneadm(1M), zonecfg(1M), ethers(3SOCKET), gethostbyname(3NSL), getnetbyname(3SOCKET), hosts(4), inet_type(4), ndpd.conf(4), netmasks(4), networks(4), nsswitch.conf(4), attributes(5), privileges(5), zones(5), arp(7P), ipsecah(7P), ipsecesp(7P) Diagnostics
ifconfig sends messages that indicate if: NotesDo not select the names broadcast, down, private, trailers, up or other possible option names when you choose host names. If you choose any one of these names as host names, it can cause unusual problems that are extremely difficult to diagnose. Name | Synopsis | Description | Options | Operands | INTERFACE FLAGS | LOGICAL INTERFACES | IP MULTIPATHING GROUPS | CONFIGURING IPv6 INTERFACES | Examples | Files | Attributes | See Also | Diagnostics | Notes |
||||||||||||||||||||||||||||||||||||||||||