Skip to content

Instantly share code, notes, and snippets.

@ozuma
Last active February 8, 2021 12:50
Show Gist options
  • Save ozuma/6702e141f92975224ee1 to your computer and use it in GitHub Desktop.
Save ozuma/6702e141f92975224ee1 to your computer and use it in GitHub Desktop.
Solaris 11: static IP Setting

Solaris 11: static IP setting

root@solaris11:~# netadm enable -p ncp DefaultFixed
Enabling ncp 'DefaultFixed'
root@solaris11:~# ipadm delete-ip net0
ipadm: cannot delete interface net0: No such interface
root@solaris11:~# ipadm
NAME              CLASS/TYPE STATE        UNDER      ADDR
lo0               loopback   ok           --         --
   lo0/v4         static     ok           --         127.0.0.1/8
   lo0/v6         static     ok           --         ::1/128
root@solaris11:~# ipadm create-ip net0
root@solaris11:~# dladm show-link
LINK                CLASS     MTU    STATE    OVER
net0                phys      1500   up       --
root@solaris11:~# dladm show-phys
LINK              MEDIA                STATE      SPEED  DUPLEX    DEVICE
net0              Ethernet             up         1000   full      e1000g0
root@solaris11:~# ipadm create-addr -T static -a 192.168.2.94/24 net0/v4wire
root@solaris11:~# ipadm show-addr
ADDROBJ           TYPE     STATE        ADDR
lo0/v4            static   ok           127.0.0.1/8
net0/v4wire       static   ok           192.168.2.94/24
lo0/v6            static   ok           ::1/128
root@solaris11:~# route -p add default 192.168.2.1
add net default: gateway 192.168.2.1
add persistent net default: gateway 192.168.2.1
root@solaris11:~# 

DNS setting

You can't write /etc/resolv.conf directly... Use svccfg instead.

root@solaris11:/etc# svccfg -s system/name-service/switch
svc:/system/name-service/switch> setprop config/host = astring: "files dns"
svc:/system/name-service/switch> select system/name-service/switch:default
svc:/system/name-service/switch:default> refresh
svc:/system/name-service/switch:default> quit
root@solaris11:/etc# svcadm enable system/name-service/switch
root@solaris11:/etc# ping -s www.sakura.ne.jp
PING www.sakura.ne.jp: 56 data bytes
64 bytes from www.sakura.ad.jp (210.224.168.100): icmp_seq=0. time=18.685 ms
64 bytes from www.sakura.ad.jp (210.224.168.100): icmp_seq=1. time=16.946 ms
64 bytes from www.sakura.ad.jp (210.224.168.100): icmp_seq=2. time=15.828 ms
64 bytes from www.sakura.ad.jp (210.224.168.100): icmp_seq=3. time=16.364 ms
^C
----www.sakura.ne.jp PING Statistics----
4 packets transmitted, 4 packets received, 0% packet loss
round-trip (ms)  min/avg/max/stddev = 15.828/16.956/18.685/1.240
root@solaris11:/etc#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment