Tuesday, January 17, 2012

Static IP's and Solaris 11

No matter how many times I setup up static IP's on my Solaris 11 express or Open Indiana 151a installs, I always come across different problems! Almost every guide has you do it differently and I wanted to post what finally worked for me. This is from late last summer, but I found it relevant when trying to resetup my Napp-IT ZFS All-in-one on ESXi tonight.

First up fire up terminal and switch to root.

Next up disable network auto magic:
# svcadm disable nwam
# svcadm enable network/physical:default
 
Check the physical adapter state and note the LINK name: 
# dladm show-phys
LINK         MEDIA                STATE      SPEED  DUPLEX    DEVICE
bge0         Ethernet             unknown    1000   full      bge0 
 
Check the logical adapter state: 
# ipadm show-if
IFNAME     STATE    CURRENT      PERSISTENT
lo0        ok       -m-v------46 --- 

Create a logical adapter:


# ipadm create-if bge0
# dladm show-link
LINK        CLASS     MTU    STATE    BRIDGE     OVER
bge0        phys      1500   up       --         --
# ipadm show-if
IFNAME     STATE    CURRENT      PERSISTENT
lo0        ok       -m-v------46 ---
bge0       down     bm--------46 -46
 
Assign the adapter a static ip of 172.16.1.10/16. 
#ipadm create-addr -T static -a 172.16.1.10 bge0/v4
# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
bge0/v4           static   ok           172.16.1.10/16
lo0/v6            static   ok           ::1/128 

Now verify the existing routing tables:
# netstat -r

Routing Table: IPv4
Destination           Gateway           Flags  Ref     Use     Interface
-------------------- -------------------- ----- ----- ---------- ---------
solaris              solaris              UH        2          0 lo0
172.16.0.0        172.16.1.1      U         3          1 bge0

Routing Table: IPv6
Destination/Mask            Gateway                   Flags Ref   Use    If
--------------------------- --------------------------- ----- --- ------- -----
solaris                     solaris                     UH      2       4 lo0
 
Add a persitant default route:
# route -p add default 172.16.1.1
add net default: gateway 172.16.1.1
add persistent net default: gateway 172.16.1.1
 
Now your routing table should look like this:
# netstat -r

Routing Table: IPv4
Destination           Gateway           Flags  Ref     Use     Interface
-------------------- -------------------- ----- ----- ---------- ---------
default              fw01.allanglesit.net UG        2      10466
solaris              solaris              UH        2         12 lo0
172.16.0.0        172.16.1.1      U         6       1810 bge0

Routing Table: IPv6
Destination/Mask            Gateway                   Flags Ref   Use    If
--------------------------- --------------------------- ----- --- ------- -----
solaris                     solaris                     UH      2     156 lo0 
 
 
Go ahead and check your resolv.conf:
 
# cat /etc/resolv.conf
domain  allanglesit.net
nameserver  172.16.1.1
 
# dig www.google.com 
 
Now reboot and enjoy your new static IP :)
 
This has been modified from a guide here: LINK
 

2 comments:

  1. I had to do one last thing to get my internet connection fully functional. Replace the default nsswitch.conf with nsswitch.dns:

    # mv /etc/nsswitch.conf /etc/nsswitch.original
    # cp /etc/nsswitch.dns /etc/nsswitch.conf

    This was on OpenIndiana 151a5 Desktop.

    ReplyDelete
  2. In addition to the comment above, I also had to add one additional thing to get the network working fully:

    route -p add default 192.168.1.1

    Without this and the nsswitch.dns copy above, only local intranet access was available on my OpenIndiana system.

    ReplyDelete