Creating a static IP in OpenIndiana/OpenSolaris

If you’re running an OpenIndiana/OpenSolaris fileserver chances are you’ll need a static IP so that you’ll always know where to find it on the network. There is more than one way of doing this but by far the easiest is using NWAM, or network auto magic.

 

Do the following (the # at the beginning means you need to have superuser permissions for this, and any line without bolded text at the end means you just hit enter):

 

# nwamcfg

nwamcfg> create ncp lan

nwamcfg:ncp:lan> create ncu phys e1000g0

Created ncu ‘e1000g0’. Walking properties …

activation-mode (manual) [manual|prioritized]> prioritized

enabled (true) [true|false]>

priority-group> 0

priority-mode [exclusive|shared|all]> shared

link-mac-addr>

link-autopush>

link-mtu>

nwamcfg:ncp:lan:ncu:e1000g0> end

Committed changes

nwamcfg:ncp:lan> create ncu ip e1000g0

Created ncu ‘e1000g0‘. Walking properties …

enabled (true) [true|false]>

ip-version (ipv4,ipv6) [ipv4|ipv6]> ipv4

ipv4-addrsrc (dhcp) [dhcp|static]> static

ipv4-addr> 10.0.1.2

ipv4-default-route> 10.0.1.1

nwamcfg:ncp:CorpNet:ncu:e1000g0> end

Committed changes

nwamcfg:ncp:lan> end

nwamcfg> end

# nwamadm enable -p ncp lan

 

Voila! You have now set a static ipv4 IP in OpenIndiana/OpenSolaris. If you would like to set an ipv6 address instead, or both, select ipv6 or nothing when prompted for the ip-version. Replace the 10.1.1.2 and gateway (10.1.1.1) with whatever IP addresses match your own network.