Introduction

OpenIndiana 151a is by default installed to use NWAM and DHCP dynamic IPs. In many situations it would be preferred to set up a static IP for the server, something which is difficult to do through nwam.  There a few guides to use NWAM for Static IPs (examples: A, B, or C) but none seem straight forward.

GUI Way (easiest)

Using su, sudo or pfexec to acquire the required privileges:

Commands

Warning! This commands will first disable your network interface , if you are doing this,
you better be on the console and not on remote (ssh) connection or you will be locked out of machine. 

Use scripted commands in line,that bring interface Up right after bringing it down
or stay with NWAM untill you get local console access.

# svcadm disable svc:/network/physical:nwam

# svcadm enable svc:/network/physical:default
# cp /etc/nsswitch.dns /etc/nsswitch.conf
# network-admin

network-admin

Connections

General

DNS

Hosts

This last command will open a window in gnome in which you can fill in the required values.

Console Way

Commands (Solaris 11 and OpenIndiana 151):

# ipadm create-addr -T static -a 1.2.3.4/24 e1000g0/v4static
# route -p add default 1.2.3.254
# cp /etc/nsswitch.dns /etc/nsswitch.conf

# vi /etc/hosts
# vi /etc/resolv.conf

Commands:

# svcadm disable svc:/network/physical:nwam
# svcadm enable svc:/network/physical:default
# cp /etc/nsswitch.dns /etc/nsswitch.conf
# vi /etc/hosts
# vi /etc/resolv.conf
# vi /etc/defaultrouter
# vi /etc/hostname.NIC
# svcadm restart svc:/network/physical:default

files

The following files need to be edited.  Change the parts necessary, where oibox is the current computer name, example.net is the domain name (or workgroup). 

# Internet host table
#
127.0.0.1 localhost.localdomain localhost.local localhost loghost oibox oibox.local oibox.localdomain oibox.example oibox.example.net
::1 localhost.localdomain localhost.local localhost loghost oibox oibox.local oibox.localdomain oibox.example oibox.example.net
nameserver 8.8.8.8
nameserver 8.8.4.4
192.168.1.1

Note the file /etc/hostname._NIC_ will be something like /etc/hostname.bnx0 where the suffix is your physical NIC.

192.168.1.16

Potential Issues and Workarounds

Typically it is always a good ideas do all this work in a true console (direct keyboard plus screen or a BMC/iLOM/IMM device) as you may lose all networked connectivity to your system.

firewalls

 

The use of ipfilter (a firewall) can prevent the changes above from working.  To check if ipfilter is active

# svcs ipfilter

The following command to disable ipfilter may solve issues in trying to get a static IP to work.

# svcadm disable ipfilter 

alternate set of files changes 

A more traditional set of changes (similar to what sys-unconfig would do), allowing the system to have multiple IP addresses with different hostnames on each of your physical interfaces.  The below assumes you want the server to have Static IP: 192.168.1.16, hostname: oibox, a default route of 192.168.1.1, and to use google's DNS name servers of 8.8.8.8 and 8.8.4.4.   This is what I do, it is different than the above "files" section, and is based on information at http://www.outside-the-box.com/?p=185

# Internet host table
#
::1             oibox.local localhost loghost
127.0.0.1       oibox.local localhost loghost
192.168.1.16    oibox oibox.example.net
nameserver 8.8.8.8
nameserver 8.8.4.4
192.168.1.1

Note the file /etc/hostname._NIC_ will be something like /etc/hostname.bnx0 where the suffix bnx0, pcn0, nge0, etc. is your physical NIC identifier.

oibox

ssh keys

You may wish to generate a new set of ssh keys to do this you will need to remove the keys, the will be regenerated automatically on next system reboot.

# rm  /etc/ssh/*key*

Other

This section needs to be merged with http://wiki.openindiana.org/oi/4.2+Network+management