Configuring IP interfaces enables a system to connect to the network. The procedure essentially involves assigning IP addresses to the interfaces.
When you assign an IP address to an IP interface, a corresponding address object is created to represent that address.
The address object uses the format interface/address-family, where address-family is either v4 or v6. For example, net0 with an IPv4 address would have the address object net0/v4. Multiple address objects of the same IP interface are distinguished by a letter suffix, such as net0/v4a, net0/v4b, net0/v4c, and so on.
Similarly, an IP interface with IPv6 addresses would have address objects such as net1/v6a, net1/v6b, and so on.
Any subsequent command on this interface's address can use the address object as reference. For instance, using an address object from the previous examples, you would type ipadm delete-addr net0/v4b.
Before You Begin
Ensure that your role has the appropriate rights profile to perform this procedure. See Using Rights Profiles to Perform Network Configuration.
$ ipadm create-ip interface
The interface name follows the datalink name on which the interface is created.
This syntax is the most commonly used to configure networking on a system. However, two other create subcommands are available for other types of configuration:
create-vni creates a STREAMS virtual network interface.
create-ipmp creates an IPMP group. See Chapter 2, About IPMP Administration in Administering TCP/IP Networks, IPMP, and IP Tunnels in Oracle Solaris 11.4.
Use one of the following commands depending on the type of address:
See also Monitoring IP Interfaces and Addresses that show how to obtain interface information by using show-* subcommands.
The entries in this file consist of IP addresses and their corresponding host names.
$ dladm show-phys LINK MEDIA STATE SPEED DUPLEX DEVICE net3 Ethernet up 100Mb full bge3 $ dladm show-link LINK CLASS MTU STATE OVER net3 phys 1500 up -- -- $ ipadm create-ip net3 $ ipadm create-addr -a 192.0.2.3/24 net3 net3/v4 $ ipadm NAME CLASS/TYPE STATE UNDER ADDR aggr0 ip down -- -- lo0 loopback ok -- -- lo0/v4 static ok -- 127.0.0.1/8 lo0/v6 static ok -- ::1/128 net3 ip ok -- -- net3/v4 static ok -- 192.0.2.3/24 $ vi /etc/hosts # Internet host table # 127.0.0.1 localhost 203.0.113.14 foohost 192.0.2.3 sales1Example 3 Configuring a Network Interface to Receive an IP Address From a DHCP Server
In the following example, the IP interface is configured to receive its address from a DHCP server. DHCP typically also installs a default route. Therefore, this example does not include a step for manually adding a default route by using the route command.
$ dladm show-phys LINK MEDIA STATE SPEED DUPLEX DEVICE net3 Ethernet up 100Mb full bge3 $ dladm show-link LINK CLASS MTU STATE OVER net3 phys 1500 up -- -- $ ipadm create-ip net3 $ ipadm create-addr -T dhcp net3 net3v4 $ ipadm NAME CLASS/TYPE STATE UNDER ADDR aggr0 ip down -- -- lo0 loopback ok -- -- lo0/v4 static ok -- 127.0.0.1/8 lo0/v6 static ok -- ::1/128 net3 ip ok -- -- net3/v4 static ok -- 203.0.113.3/24