Software >> OS >> Unix >> Solaris >> 11 >> Networking >> How to assign or deassign static or dynamic IP address to a an interface starting with datalink status of unknown for NCP DefaultFixed


## starting with

root@vbS11-lm:~# netadm list
TYPE        PROFILE        STATE
ncp         Automatic      disabled
ncp         DefaultFixed   online
loc         Automatic      offline
loc         NoNet          offline
loc         DefaultFixed   online


## if not yet set as DefaultFixed, enable it by

root@vbS11:~# netadm enable -p ncp DefaultFixed
Enabling ncp 'DefaultFixed'


## e.g. net0 to be assigned dynamic IP and net1 to be assigned static

root@vbS11:~# dladm show-link

LINK     CLASS   MTU    STATE    OVER
net0     phys    1500   unknown  ---
net1     phys    1500   unknown  ---


## net0
## 1st create the IP interface for net0

root@vbS11:~# ipadm create-ip net0


## next, assign the IP addr with type dhcp

root@vbS11:~# ipadm create-addr -T dhcp -h dhcp-client-hostname net0

or just

root@vbS11:~# ipadm create-addr -T dhcp net0


## net1
## 1st, create the IP interface for net1


root@vbS11:~# ipadm create-ip net1


## next, assign the IP addr with type static

root@vbS11:~# ipadm create-addr -T static -a 192.168.9.100/24 net1


## For either net0 or net1 if need to set name server and default gateway
## e.g. in this case net0

svcs network/dns/client

svccfg -s svc:/network/dns/client         setprop config/nameserver =192.168.1.254

svcprop -p config/nameserver svc:/network/dns/client

svcadm refresh svc:/network/dns/client

svcadm restart svc:/network/dns/client

svccfg -s svc:/system/name-service/switch setprop config/host       = \"files dns\"

svccfg -s svc:/system/name-service/switch setprop config/ipnode     = astring: \"files dns\"

svcprop -p config/host svc:/system/name-service/switch

svcprop -p config/ipnode svc:/system/name-service/switch

svcadm refresh svc:/system/name-service/switch

svcadm restart svc:/system/name-service/switch

route -p add default 192.168.1.254


## How to deassign

ipadm delete-addr net1/v4

ipadm delete-ip net1