Contained WithinFind More DocumentationFeatured Support Resources | Descargar este libro en PDF (8966 KB)
ifconfig(1M)Name | Synopsis | Description | Options | Operands | INTERFACE FLAGS | LOGICAL INTERFACES | 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] [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. MULTIPATHING GROUPSPhysical interfaces that share the same IP broadcast domain can be collected into a multipathing group using the group keyword. Interfaces assigned to the same multipathing group are treated as equivalent and outgoing traffic is spread across the interfaces on a per-IP-destination basis. In addition, individual interfaces in a multipathing group are monitored for failures; the addresses associated with failed interfaces are automatically transferred to other functioning interfaces within the group. For more details on IP multipathing, see in.mpathd(1M) and the System Administration Guide: IP Services. See netstat(1M) for per-IP-destination information. 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 IPv6/IPv4 tunnelsAn IPv6 over IPv4 tunnel interface can send and receive IPv6 packets encapsulated in an IPv4 packet. Create tunnels at both ends pointing to each other. IPv6 over IPv4 tunnels require the tunnel source and tunnel destination IPv4 and IPv6 addresses. Solaris 8 supports both automatic and configured tunnels. For automatic tunnels, an IPv4-compatible IPv6 address is used. The following demonstrates auto-tunnel configuration:
where IPv4–address is the IPv4 address of the interface through which the tunnel traffic will flow, and IPv4-address, ::<IPv4–address>, is the corresponding IPv4-compatible IPv6 address. The following is an example of a configured tunnel:
This creates a configured tunnel between my-ipv4-address and peer-ipv4-address with corresponding link-local addresses. For tunnels with global or site-local addresses, the logical tunnel interfaces need to be configured in the following form:
For example,
To show all IPv6 interfaces that are up and configured:
In the output above, note the line that begins with “tunnel security settings”. The content of this line varies according to whether and how you have set your security settings. See “Display of Tunnel Security Settings,” below. Configuring IPv4/IPv6 TunnelsAn IPv4 over IPv6 tunnel interface can send and receive IPv4 packets encapsulated in an IPv6 packet. Create tunnels at both ends pointing to each other. IPv4 over IPv6 tunnels require the tunnel source and tunnel destination IPv6 and IPv4 addresses. The following demonstrates auto-tunnel configuration:
This creates a configured tunnel between my-ipv6-address and peer-ipv6-address with my-ipv4-address and peer-ipv4-address as the endpoints of the point-to-point interface, for example:
To show all IPv4 interfaces that are up and configured:
In the output above, note the line that begins with “tunnel security settings”. The content of this line varies according to whether and how you have set your security settings. See “Display of Tunnel Security Settings,” below. Display of Tunnel Security Settings
The ifconfig output for tunneled interfaces indicates security settings, if present, for a tunnel. The content of the line showing your settings differs depending on how you have made your settings: 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 plumb it with the following command:
Then configure it as a point-to-point interface, supplying the tunnel source and the tunnel destination:
Use ipsecconf(1M), as described above, to configure tunnel security properties. Example 6 Configuring 6to4 TunnelsTo configure 6to4 tunnels, use the following commands:
IPv4-address denotes the address of the encapsulating interface. 6to4-address denotes the address of the local IPv6 address of form 2002:IPv4-address:SUBNET-ID:HOSTID. The long form should be used to resolve any potential conflicts that might arise if the system administrator utilizes an addressing plan where the values for SUBNET-ID or HOSTID are reserved for something else. After the interface is plumbed, a 6to4 tunnel can be configured as follows:
This short form sets the address. It uses the convention: 2002:IPv4-address::1 The SUBNET-ID is 0, and the HOSTID is 1. 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 usersrc 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), dhcpagent(1M), dladm(1M), in.mpathd(1M), in.ndpd(1M), in.routed(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), tun(7M) 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 | MULTIPATHING GROUPS | CONFIGURING IPv6 INTERFACES | Examples | Files | Attributes | See Also | Diagnostics | Notes |
||||||||||||||||||||||||||||||||||||||||||||||||||