Live Chat Software by Kayako |
Configuring IPv4 Interfaces
Posted by Sandi Widianto on 17 November 2022 01:46 PM
|
|
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. How to Configure an IPv4 InterfaceBefore You Begin Ensure that your role has the appropriate rights profile to perform this procedure. See Using Rights Profiles to Perform Network Configuration.
Example 2 Configuring an IPv4 Interface With a Static IP Address The following example shows how to configure an IPv4 interface with a static IP address. The example also shows how to configure a persistent route for the interface 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 -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 sales1 Example 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 | |
|