ipadm create-addr
is used to assign an IP address to an interface. Its syntax:
ipadm create-addr -T address-type -a address/netmask addrobj
-T address-type
refers to static
, dhcp
or addrconf
(for automatically generated IPv6 addresses).
addrobj
is an identifier for the unique IP used in the system.
dladm show-phys
LINK MEDIA STATE SPEED DUPLEX DEVICE
net0 Ethernet up 1000 full e1000g0
Static IP
ipadm create-ip net0
ipadm create-addr -T static -a 10.0.2.15/24 net0/v4
ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/v4 static ok 10.0.2.15/24
Dynamic IP
ipadm create-ip net0
ipadm create-addr -T dhcp net0/v4
ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/v4 dhcp ok 10.8.29.188/24