I installed a Solaris 11 system yesterday but needed to give it a static IP rather than the dhcp that it picked up by default. Since netoworking has changed in S11 here’s a guide of what to do.
Firstly you need to disable nwam.
svcadm disable svc:/network/physical:nwam
svcadm enable svc:/network/physical:default
Check that there are no nwamd process left running.
To set your address you need to see what interface you have availble. On a typical install that already has a working DHCP interface you can see what is already in use by:
# ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok 127.0.0.1/8
net0/_b dhcp ok 12.34.56.78/21
#
So to set your static IP you would just do:
# ipadm create-addr -T static -a 12.34.56.78/21 net0/v4
However you may notice that this fails:
# ipadm create-addr -T static -a 12.34.56.78/21 net0/v4
ipadm: cannot create address: Persistent operation on temporary object
The issue here is that net0 has been created as a temporary object by the system. Which you can verify by noticing the missing entries on the PERSISTENT column of the output of show-if:
# ipadm show-if -o all
IFNAME CLASS STATE ACTIVE CURRENT PERSISTENT OVER
lo0 loopback ok yes -m46-v------ 46-- --
net0 ip down no bm46-------- ---- --
In this case delete and re-create the interface, then set your address:
# ipadm delete-ip net0
# ipadm create-ip net0
# ipadm create-addr -T static -a 12.34.56.78/21 net0/v4
The last thing you need to do is set your default route which is is done by:
# route -p add default 12.34.56.1
Next you may need to set up your system as a DNS client. This is now done by SMF and not by editing files by hand. To set DNS servers:
root@sionnach:/home/albwhite# svccfg -s dns/client
svc:/network/dns/client> listprop config
config application
config/value_authorization astring solaris.smf.value.name-service.dns.client
config/domain astring ie.oracle.com
svc:/network/dns/client> setprop config/nameserver = (12.34.56.17 192.168.82.46)
svc:/network/dns/client> listprop config
config application
config/value_authorization astring solaris.smf.value.name-service.dns.client
config/domain astring ie.oracle.com
config/nameserver net_address 12.34.56.17 192.168.82.46
svc:/network/dns/client> exit
root@sionnach:/home/albwhite# svcadm refresh dns/client
root@sionnach:/home/albwhite# svcadm restart dns/client
Similarly to set the resolv.conf entries you would do:
svccfg -s name-service/switch
> setprop config/host = "files dns"
Official documentation: http://docs.oracle.com/cd/E23824_01/html/821-1458/gdyrf.html