Professional Documents
Culture Documents
It manages IP interfaces and IP addresses better. It provides an option to implement persistent interface and address configuration settings.
For a list of ifconfig options and their equivalent ipadm subcommands, see ifconfig and ipadm table of comparison at the end of this document. Another issue with interface configuration and administration is the absence of simple administrative tools to set protocol properties or tunables. The ndd command has been traditionally used to customize for this purpose. However, like the ifconfig command, ndd does not implement persistent configurations. Previously, persistent settings could be simulated for a network scenario by editing the boot scripts. With the introduction of the Service Management Facility (SMF), the use of such workarounds has been largely restricted. The ndd command has also been used to debug network configuration issues. However, new utitlities such as DTrace and the mdb command perform such debugging tasks better. The ipadm command is also designed to replace the ndd commands to configure protocol properties. As a tool to set these properties, the ipadm command provides the following benefits:
It can set temporary or persistent protocol properties for IP, ARP, and ICMP, as well as upper layer protocols such as TCP and UDP. It provides information about each TCP/IP parameter, such as a property's current and default value, as well as the range of possible values. Thus, debugging information is easier to be obtained. The ipadm command also follows a consistent command syntax and therefore is easier to use.
For a list of ndd options and their equivalent ipadm subcommands, see ndd and ipadm table of comparison at the end of this document.. Refer to the following man pages for more information about their corresponding commands:
ipadm man page dtrace(1m) man page mdb man page ndd man page ifconfig man page
Task
Description
For Instructions
Reserves an interface's port to restrict access to it except root. Sets IP packets whose destination is not the local system to be forwarded to correct target systems. Lists a TCP/IP property and its current setting.
Note For procedures that use the ipadm tool to configure network interfaces and IP addresses, refer to the section Using the ipadm Command to Configure Interfaces in this document.
smallest_nonpriv_port extra_priv_ports
Check if the designated port is in the range of regular ports and therefore can be used.
# ipadm show-prop -p smallest_nonpriv_port protocol
where protocol is the protocol type for which you want to configure a privileged port. In the command's output, the POSSIBLE field shows the range of port numbers to which regular users can bind. If the designated port is within this range, then you can set it as a privileged port.
2
Verify that the port that you want to reserve is available and not marked as already a privileged port.
# ipadm show-prop -p extra_priv_ports protocol
In the command's output, the CURRENT field indicates which ports are currently marked privileged. If the designated port is not included in this field, then you can set it as a privileged port.
3
For every additional port that you want to add or remove as privileged ports, repeat one of the following: a. To add ports as privileged ports, type the following syntax.
# ipadm set-prop -p extra_priv_ports+=portnumber protocol
Note Notice the use of the plus sign (+) qualifier. You can assign multiple ports to become privileged
ports. The plus sign qualifier allows you to build a list of these ports. Use this syntax with the qualifier to add ports to the list individually. If you do not use the plus sign qualifier, then the port that you assign replaces all the other ports that are previously listed as privileged. b. To remove ports as privileged ports, type the following syntax.
# ipadm set-prop -p extra_priv_ports-=portnumber protocol
Note Notice the use of the minus sign (-) qualifier. The minus sign qualifier removes the port from the existing ports currently listed as privileged. Use the same syntax to remove all extra privileged ports, including the default ports. 5
In the command's output, make sure that the designated ports are now included in the CURRENT field.
Example 1
DEFAULT 1024
POSSIBLE 1024-32768
PERSISTENT --
DEFAULT 2049,4045
POSSIBLE 1-65535
set-prop -p extra_priv_ports+=3001 tcp set-prop -p extra_priv_ports+=3050 tcp show-prop -p extra_priv_ports tcp PROPERTY PERM CURRENT PERSISTENT extra_priv_ports rw 2049,4045 3001,3050 3001,3050 set-prop -p extra_priv_ports-=4045 tcp show-prop -p extra_priv_ports tcp PROPERTY PERM CURRENT PERSISTENT extra_priv_ports rw 2049,3001 3001,3050 3050
DEFAULT 2049,4045
POSSIBLE 1-65535
DEFAULT 2049,4045
POSSIBLE 1-65535
If you want to be selective in how packets are forwarded, then you set packet forwarding on the interface. For example, you might have a system that has multiple NICs. Some NICs are connected to the external network, while others are connected to the private network. You would therefore set packet forwarding only on some of the interfaces, rather than on all interfaces. If you want to implement packet forwarding globally within the system, then you set the forwarding property of the protocol. For this second option, the steps are discussed in a subsequent procedure.
Note The two methods of forwarding packets are not mutually exclusive. For example, you can set packet forwarding globally, and then customize the forwarding property for each interface. Thus, packet forwarding will still be selective for that particular interface.
Become an administrator. For more information, seeHow to Obtain Administrative Rights in System Administration Guide: Security Services. Display the current setting of an interface's IP forwarding property.
# ipadm show-ifprop -p forwarding [-m protocol-version] interface
where protocol-version can either be ipv4 or ipv6. If you do not specify the version, then the setting for both IPv4 and IPv6 protocols will be displayed.
Note To display all the valid tunable properties and corresponding settings of a given interface, do not specify a property, as follows: # ipadm show-ifprop interface
For every interface on which you want to enable forwarding, perform one of the following: a. To enable the interface to forward both IPv4 and IPv6 packets, use the following command:
# ipadm set-ifprop forwarding=on interface
b. To enable the interface to forward only a specific protocol version, use the following command:
# ipadm set-ifprop forwarding=on -m protocol-version interface 4
To restore an interface's property to its default setting, type the following command:
# ipadm reset-ifprop -p forwarding [-m protocol-version] -p property interface
Example 2
set-ifprop -p forwarding=on -m ipv4 net0 show-ifprop net0 PROPERTY PROTO PERM CURRENT PERSISTENT DEFAULT arp ipv4 rw on -on
POSSIBLE on,off
net0 net0 net0 net0 net0 net0 net0 net0 net0 net0 net0 # # ipadm # ipadm IFNAME net0
forwarding metric mtu exchange_routes usesrc forwarding metric mtu nud exchange_routes usesrc
ipv4 ipv4 ipv4 ipv4 ipv4 ipv6 ipv6 ipv6 ipv6 ipv6 ipv6
rw rw rw rw rw rw rw rw rw rw rw
on -----------
reset-ifprop -p forwarding -m ipv4 net0 show-ifprop -p forwarding -m ipv4 net0 PROPERTY PROTO PERM CURRENT PERSISTENT forwarding ipv4 rw off off
DEFAULT off
POSSIBLE on,off
Become an administrator. For more information, seeHow to Obtain Administrative Rights in System Administration Guide: Security Services. Display the current setting of the IP forwarding property.
# ipadm show-prop -p forwarding protocol-version
following command:
# ipadm show-prop protocol
where protocol can be IP, UDP, TCP and other protocol families. This syntax is shown in the example that follows.
3
For every protocol version on which you want to enable forwarding, type the following command:
# ipadm set-prop forwarding=on protocol-version
Optional: Display the settings of the IP forwarding property by performing one of the following substeps. a. To display all the properties and current settings of a protocol family, type the following:
# ipadm show-prop protocol
b. To display all the property settings of a specific protocol version, type the following:
# ipadm show-prop protocol-version
To reset a specific property of a protocol version to its default setting, type the following:
# ipadm reset-prop -p property protocol-version
Example 3
set-prop -p forwarding=on ipv4 set-prop -p forwarding=on ipv6 show-prop ip PROPERTY forwarding ttl forwarding hoplimit
PERM rw rw rw rw
PERSISTENT on -on --
Become an administrator. For more information, seeHow to Obtain Administrative Rights in System Administration Guide: Security Services. (Optional) Display information about physical attributes of datalinks currently on the system.
# dladm show-phys
This command shows you the physical network cards and some of their properties that are installed on your system. For more information about this command, see How to Display Information About Physical Attributes of Data Links.
3
This command shows you the datalinks and certain properties that have been set for them, including the physical cards over which the links have been created.
4
If you intend to rename a datalink, then make sure that the link is not opened by any application. For example, if the IP interface over the link is plumbed, then unplumb the interface.
# ipadm delete-if interface
where interface Specifies the IP interface that is plumbed and using the link.
old-linkname new-linkname
6
Refers to the current name of the datalink. When a NIC is installed for the first time, by default, the NIC's link name is hardware-based, such as bge0. Refers to any name that you want to assign to the datalink.
Configure the IP interface over the link with a valid IP address.. The following syntax assigns a static address to an interface. Refer to the IPADM MAN PAGE for different options to assign IP addresses.
# ipadm create-addr -T static -a address/prefixlen addrobj
-T
Specifies the type of IP address that is assigned to the interface, which is one of the following three arguments: static, dhcp, or addrconf. Addrconf refers to automatically generated IPv6 addresses. Specifies the IP address to configure on the interface. You can specify either just a local address, or both a local address and a remote address. Typically, you assign only a local address. In this case, you specify the address directly with the -a option, such as: -a address. The address is automatically considered as a local address. However, if you are configuring tunnels, you might be required to provide both the local address of the system and the remote address of the destination system. In this case, you must specify local and remote to distinguish the two addresses, as follows: -a local=local-addr,remote=remote-addr. If you are using a numeric IP address, use the format address/prefixlen for addresses in CIDR notation, for example, 1.2.3.4/24. Optionally, you can specify a hostname for address instead of an numeric IP address. Using a hostname is valid provided that a corresponding numeric IP address is defined for that hostname in the /etc/hosts file. If no numeric IP address is defined in the file, then the numeric value is uniquely obtained by using the resolver order that is specified for hosts or ipnodes in the /etc/nsswitch.conf. If multiple entries exist for a given hostname, then an error is generated.
Note During the boot process, the creation of IP addresses precedes naming services being brought online. Therefore you must ensure that any hostname that is used in the network configuration must be defined in the /etc/hosts file.
-a
/prefixlen
Specifies the length of the network ID that is part of the IPv4 address when you use CIDR notation. In the address 12.34.56.78/24, 24 is the prefixlen. If you do not include prefixlen, then the netmask is computed according to the sequence listed for netmasks in the /etc/nsswitch.conf file, or by using Classful Address semantics. Specifies an identifier of the unique IP address or set of addresses that is used in the system. The addresses can be either IPv4 or IPv6 types. The identifier uses the format interface/user_specified_string. The interface refers to the IP interface to which the address is assigned. The interface should reflect the name of the datalink on which the IP interface is configured. The user_specified_string refers to a string of alphanumeric characters that begins with an alphabet character and has a maximum length of 32 characters. Subsequently, you can refer to the addrobj instead of the numeric IP address when you use any ipadm subcommand that manages addresses in the system, such as ipadm show-addr, or ipadm delete-addr.
addrobj
(Optional) Display information about the newly configured IP interface. You can use the following commands depending on the information that you want to check.
If you do not specify the interface, then information for all interfaces in the system will be displayed.
If you do not specify the addrobj, then information for all address objects in the system will be displayed. For more information about the information that is displayed by the ipadm show-* subcommand, refer to the ipadm(1m) MAN PAGE .
9
(Optional) Add entries for the IP addresses into the /etc/inet/hosts file. The entries in this file consist of IP addresses and the corresponding host names.
Note This step applies only if you are configuring static IP addresses. If you are using DHCP addresses, you do not need to update the /etc/hosts file.
Example 4
Using the ipadm Command to Configure a Networking Interface With a Static Address
# dladm show-phys LINK MEDIA qfe3 Ethernet STATE up SPEED 100Mb DUPLEX full DEVICE qfe3
STATE up
BRIDGE --
OVER --
# ipadm delete-if qfe3 # dladm rename-link qfe3 subitops1 # ipadm create-addr -T static -a 192.168.84.3/24 subitops1/v4static # dladm show-link LINK CLASS MTU STATE BRIDGE OVER subitops1 phys 1500 up --# ipadm show-if IFNAME STATE lo0 ok subitops1 ok
CUTTENT -m-v-----4bm-------4-
PERSISTENT ---46
# ipadm show-addr ADDROBJ TYPE lo0/? static subitops1/v4 static tun0/v4tunaddr static # vi /etc/hosts # Internet host table # 127.0.0.1 localhost 10.0.0.14 myhost 192.168.84.3 campus01
STATE ok ok ok
Note that if campus01 is already previously defined in the /etc/hosts file, you can use that hostname when assigning the address:
# ipadm create-addr -T static -a campus01 subitops1/v4static
Example 5
Using the ipadm Command to Automatically Configure a Networking Interface With an IP Address
This example uses the same network device as the previous example but configures the IP interface to receive its address from a DHCP server.
# dladm show-phys LINK MEDIA qfe3 Ethernet
STATE up
SPEED 100Mb
DUPLEX full
DEVICE qfe3
STATE up
BRIDGE --
OVER --
# ipadm delete-if qfe3 # dladm rename-link qfe3 subitops1 # ipadm create-addr -T dhcp subitops1/dhcp # dladm show-link LINK CLASS MTU STATE BRIDGE subitops1 phys 1500 up -# ipadm show-if IFNAME STATE lo0 ok subitops1 ok
OVER --
CUTTENT -m-v-----4bm-------4-
PERSISTENT ---46
# ipadm show-addr subitops1/dhcp ADDROBJ TYPE STATE subitops1/dhcp dhcp ok # ipadm show-addr ADDROBJ TYPE lo0/? static subitops1/dhcp dhcp tun0/v4tunaddr static
ADDR 10.8.48.242/24
STATE ok ok ok
If you do not specify property, then all properties are listed. If you specify a property, then you must also specify the address object whose property you want to list. If you omit both the specific property and the address object, then the properties of all existing addresses in the system are displayed.
Note You can set address properties only one at a time.
10
Become an administrator. For more information, seeHow to Obtain Administrative Rights in System Administration Guide: Security Services.
(Optional) Determine the current prefixlen setting of an IP address that you want to change.
# ipadm show-addrprop -p property addrobj
This step is an alternative step to display an address property's setting. When you display IP addresses with ipadm show-addr the addresses already include the properties' current settings.
4
Example 6
STATE ok ok ok
# ipadm show-addrprop -p prefixlen subitops/v4 ADDROBJ PROPERTY PERM CURRENT PERSISTENT DEFAULT subitops1/v4 prefixlen rw 24 24 24 # ipadm set-addrprop -t -p prefixlen=8 subitops/v4 # ipadm show-addrprop -p prefixlen subitops/v4 ADDROBJ PROPERTY PERM CURRENT PERSISTENT DEFAULT subitops1/v4 prefixlen rw 8 24 24
POSSIBLE 1-30,32
POSSIBLE 1-30,32
To obtain interface information, use ipadm show-if. To obtain address information, use ipadm show-addr.
11
To obtain information about a specific interface property, use ipadm show-ifprop. To obtain information about a specific address property, use ipadm show-addrprop
This section provides several examples of using the new command to obtain information about the networking interfaces.
Note For an explanation of all the fields that would be displayed by the ipadm show-* commands, refer to the
On the system with the interface to be configured, assume the Primary Administrator role or become superuser. The Primary Administrator role includes the Primary Administrator profile. To obtain status information about the interfaces, type the following command.
# ipadm show-if [interface]
If you do not specify an interface, then the information covers all the interfaces in the system. The fields in the output that is generated by the command refer to the following contents: IFNAME STATE Refers to the interface whose information is being displayed. Refers to the interface status. An interface can be in one of the following states: offline, failed, down, and ok. The ok and down conditions parallel the plumbed and unplumbed conditions of an interface in the ifconfig command output. Refers to other valid combination of conditions that have been set for the given interface, such as support for broadcast and multicast, packets, or whether the interface is a virtual interface, and others. The field also indicates the type of packets that is supported: IPv4 or IPv6, represented by 4 or 6, respectively. Both values are displayed if the interface supports both types of packets. Refer to the ipadm man page for more information about CURRENT. PERSISTENT Specifies the protocol packets that the interface supports when the interface is instantiated after a system reboot, or when the interface is re-enabled by issuing the ipadm enable-if subcommand. The protocol packets can be 4, 6or s. The values 4 and 6 refer to IPv4 and IPv6 packets respectively. The value s refers to a standby interface in an IPMP configuration.
CURRENT
If you do not specify an address identifier as represented by addrobj, then the address information is provided about all the address identifiers in the system. The fields in the output that is generated by the command refer to the following: ADDROBJ TYPE STATE Specifies the address object whose address is being listed. Indicates whether the IP address is static, dhcp, or addrconf The addrconf field value indicates that the address was obtained by using Stateless or Stateful Address Configuration. Describes the address object in its actual active configuration. For a full list of these values, see the ipadm man page.
12
ADDR
Specifies the IP address that is configured over the interface. The address can be IPv4 or IPv6. A tunnel interface will display both local and remote addresses.. For more information about tunnels, see Chapter 8, Configuring IP Tunnels, in System Administration Guide: IP Services.
To obtain information about other properties of a specific interface, type the following command.
# ipadm show-ifprop [-p property] interface
If you do not specify a property, then all the properties and corresponding values of the interface are listed. The following information is displayed: IFNAME PROPERTY PROTO PERM CURRENT PERSISTENT DEFAULT POSSIBLE Refers to the interface whose information is being displayed. Refers to all the properties of the interface and their settings. Refers to the protocol that is used on the interface, which can either be IPv4 or IPv6. Refers to the allowed permissions of a given property, which can be read only, write only, or both. Indicates the actual value of the property in the present configuration. Refers to the value of the property that is reapplied when the system is rebooted. Indicates the default value of the specific property. Refers to a list of values that can be assigned to the specific property. For numeric values, a range of acceptable values is displayed.
Note If any field value is unknown, such as in the case of an interface that does not support the property
whose information is being requested, the value is displayed as a question mark (?).
5
To obtain information about a specific property of an IP address, type the following command.
# ipadm show-addrprop [-p property,...] [addrobj]
If you do not specify property, then all properties are listed. If you specify a property, then you must also specify the address object whose property you want to list. If you omit both the specific property and the address object, then the properties of all existing addresses in the system are displayed. The following information is displayed: ADDROBJ PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE Refers to the address object whose properties are being listed. Refers to the property of the address object. An address object can have several properties. Refers to the allowed permissions of a given property, which can be read only, write only, or both. Refers to the actual value of the property in the present configuration. Refers to the value of the property that is reapplied when the system is rebooted. Indicates the default value of the specific property. Refers to a list of values that can be assigned to the specific property. For numeric values, a range of acceptable values is displayed.
Example 7
13
# ipadm show-if IFNAME STATE CURRENT PERSISTENT lo0 ok -m-v----46 --subitops1 ok bm------4- -46 net1 ok bm------4- -4tun0 ok -mp-----46 -46 # ipadm show-addr ADDROBJ TYPE STATE ADDR lo0/? static ok 127.0.0.1/8 subitops1/v4 static ok 192.168.84.3/24 tun0/v4tunaddr static ok 173.129.134.1-->173.129.134.2
Note that an object that is listed as interface/? indicates that the address was configured on the interface by applications that did not use libipadm APIs. Such applications are not under the control of the ipadm command which requires that the address object name use the format interface/user-defined-string. For examples to assign IP addresses, see How to Configure an IP Interface With the ipadm Command.
# ipadm IFNAME net1 net1 show-ifprop -p mtu net1 PROPERTY PROTO PERM CURRENT PERSISTENT DEFAULT POSSIBLE mtu ipv4 rw 1500 -1500 68-1500 mtu ipv6 rw 1500 -1500 1280-1500
# ipadm show-addrprop ne1/v4static ADDROBJ PROPERTY PERM CURRENT bge1/v4static broadcast r192.168.10.255 bge1/v4static deprecated rw off bge1/v4static prefixlen rw 24 bge1/v4static private rw off bge1/v4static transmit rw on bge1/v4static zone rw global
ifconfig Command
plumb/unplumb
[address[/prefix_length] [dest_address]] [addif address[prefix_length]] [removeif address[prefix_length]][netmask mask][destination dest_address]{auto-dhcp|dhcp}[primary][wait seconds]extend | release | start
ipadm create-addr -T static ipadm create-addr -T dhcp ipadm create-addr -T addrconf ipadm show-addr ipadm delete-addr ipadm refresh-addr
[deprecated | -deprecated] [preferred | -preferred] [private | -private] [zone zonename | -zones | -all-zones][xmit | -xmit] up down
14
TABLE 1
(Continued)
ifconfig Command
[metric n] [mtu n] [nud | -nud] [arp | -arp] [usesrc [name | none] [router | -router]
[ipmp] [group [name | ""]] standby | -standby] [failover | -failover] [tdst tunnel_dest_addr] [tsrc tunnel_srcs_addr] [encaplimit n| -encaplimit] [thoplimit n]
Equivalent subcommands currently not supported. dladm *-iptun set of commands. For more details, see the dladm(1M) man page and Tunnel Configuration and Administration With the dladm Command in System Administration Guide: IP Services. ipsecconf For details, see the ipsecconf(1M) and Chapter 20, Configuring IPsec (Tasks), in System Administration Guide: IP Services. Equivalent subcommands currently unavailable.
[auth_algs authentication algorithm] [encr_algs encryption algorithm] [encr_auth_algs encryption authentication algorithm]
[auth_revarp] [ether [address]] [index if_index] [subnet subnet_address] [broadcast broadcast_address] [token address/prefix_length] dhcp options inform, ping, release, status, drop modlist] [modinsert mod_name@pos] [modremove mod_name@pos]
ndd Command
Retrieving Properties
15
TABLE 2
(Continued)
ndd Command
ipadm Command
bash-3.2# ndd -get /dev/ip ? ip_def_ttl ip6_def_hops ip_forward_directed_broadcasts ip_forwarding ... ...
bash-3.2# ipadm show-prop ip PROTO PROPERTY FAMILY ip ttl inet ip hoplimit inet6 ip pmtu-interal -ip redirect-interval -... bash-3.2# ipadm PROTO PROPERTY ip ttl ip hoplimit
PERM rw rw rw rw
bash-3.2# ndd -get /dev/ip ip_def_ttl 100 bash-3.2# ndd -get /dev/ip ip6_def_hops 255 bash-3.2# ndd -get /dev/tcp ? tcp_cwnd_max (read tcp_strong_iss (read tcp_time_wait_interval (read tcp_tstamp_always (read tcp_tstamp_if_wscale (read ... ...
show-prop -p ttl,hoplimit ip FAMILY PERM VALUE DEFAULT POSSIBLE inet rw 100 255 1-255 inet6 rw 255 255 1-255
bash-3.2# ipadm show-prop tcp PROTO PROPERTY FAMILY tcp cwnd-max -tcp strong-iss -tcp time-wait-interval -tcp tstamp-always -... ... bash-3.2# ipadm show-prop -p PROTO PROPERTY FAMILY PERM tcp strong-iss -rw tcp cwnd-max -rw
PERM rw rw rw rw
bash-3.2# ndd -get /dev/tcp tcp_cwnd_max 1048576 bash-3.2# ndd -get /dev/tcp tcp_strong_iss 1 Setting Properties bash-3.2# ndd -set /dev/ip ip_def_ttl 64 bash-3.2# ndd -get /dev/ip ip_def_ttl 64
bash-3.2# ipadm bash-3.2# ipadm PROTO PROPERTY ip ttl bash-3.2# ipadm bash-3.2# ipadm PROTO PROPERTY ip ttl
set-prop -p ttl=64 ip show-prop -p ttl ip FAMILY PERM VALUE inet rw 64 reset-prop -p ttl ip show-prop -p ttl ip FAMILY PERM VALUE inet rw 255
16