Sunday, March 13, 2016

Manual wired connection

This post is to log the most basic network setup to a Solaris 11 box.
Since Solaris 11/11 the network configuration procedure evolved.
While a lot of great things kicked in, it became more complex.
By Solaris 11.3 the procedures seems somewhat stable.

To make justice, the Solaris on-line documentation has been always great and under a continuous effort of improvement and correctness.

But when all that's required is a straightforward old and good static IP configuration to a standard wired ethernet network, the lots of new frameworks and subsystems may get in the way. The more you're in a hush, the more these small complexities can drive you mad. So, I tried to write this post as a sort of a more strait "complete" yet "minimalist" example.

As a minimum I assume:
  • An on-line DefaultFixed NCP.
  • A wired link that was already renamed to e0.
  • Basic DNS services just for Internet access.
  • Basic /etc/hosts for local host name resolution.
  • The host being configured is box-01 at 192.168.10.10
  • The gateway is at 192.168.10.1

CLEAN-UP

If you have some left over configuration from other scenarios or from failed attempts, you can try some of following commands in order to start over from the scratch and follow the rest of this post to the bottom:

# ipadm delete-addr e0/v4
...

# ipadm delete-ip e0
...

# route -p show
...

# route -p delete ...
...

# route flush
...
  
Visit the post DNS client configuration for its specific clean-up.

CONFIGURATION

Create the e0 ip interface over the link of the same name.
(I simply don't have any reason to use different names right now)

# ipadm create-ip e0
# ipadm show-if

IFNAME     CLASS    STATE    ACTIVE OVER
lo0        loopback ok       yes    --
e0         ip       down     no     --


Set up the static IP address to be used by the interface.
(An unambiguous /etc/hosts entry can be used instead of the IP)
(Depending on the IP, it may require a /prefixlen or /etc/netmasks)

# ipadm create-addr -T static -a 192.168.10.10 e0/v4
# ipadm show-addr

lo0/v4            static   ok           127.0.0.1/8
e0/v4             static   ok           192.168.10.10/24
lo0/v6            static   ok           ::1/128


Set up the persistent route to the default gateway to be used.
(Assume that the default gateway is at 192.168.10.1)

# route -p add default 192.168.10.1
add net default: gateway 192.168.10.1
add persistent net default: gateway 192.168.10.1


# route -p show
persistent: route add default 192.168.10.1


# grep default /etc/inet/static_routes-DefaultFixed
default 192.168.10.1


# netstat -rn -f inet 

Routing Table: IPv4
 Destination     Gateway     Flags Ref  Use   Interface

------------- -------------- ----- --- ------ ---------
default       192.168.10.1   UG      8   7774          
127.0.0.1     127.0.0.1      UH      2   2694 lo0      
192.168.10.0  192.168.10.10  U       3    196 e0
       

Next, configure the DNS client accordingly.

Finally, check if you have a reasonably basic /etc/hosts in place:
   
# cat /etc/hosts
#
# ...
#

::1             localhost
127.0.0.1       localhost              loghost
#
192.168.2.10    box-01.business.corp   box-01