©2015 - 2022 Chad’s Technoworks. Disclaimer and Terms of Use

Chad’s TechnoWorks My Journal On Technology

Information Technology

Solaris 11 Network IP Configuration

Table Of Contents

How To Add Static IP To An Existing Network Interface

How To Remove A Static IP From The Network Interface


There's an article on Solaris 11 Basic Network Configuration in Oracle's TechNet that discusses the configuration of IPs. What that article didn't cover is the idea of adding static IPs to an existing network interface configured in Auto NCP with a DHCP IP which made me wonder if this is possible. The following are the procedures to prove this approach.


How To Add Static IP To An Existing Network Interface


Solaris 11 uses NCP (Network Configuration Profile) in two modes Automatic NCP using DHCP and manual DefaultFixed NCP.

In my case, my Solaris 11 is on Automatic NCP which uses the DHCP IP provided by the VMware Fusion.


Step 1: Gather Existing Network info:


root@s11node1:~# ipadm show-if

IFNAME     CLASS    STATE    ACTIVE OVER

lo0        loopback ok       yes    --

net0       ip       ok       yes    --

net1       ip       ok       yes    --

root@s11node1:~#

root@s11node1:~# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

        inet 127.0.0.1 netmask ff000000

net0: flags=100001004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4,PHYSRUNNING> mtu 1500 index 2

        inet 172.16.33.120 netmask ffffff00 broadcast 172.16.33.255

        ether 0:c:29:1b:7a:7b

net1: flags=100001004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4,PHYSRUNNING> mtu 1500 index 3

        inet 192.168.65.111 netmask ffffff00 broadcast 192.168.65.255

        ether 0:50:56:21:49:12

lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1

        inet6 ::1/128

net0: flags=120002004841<UP,RUNNING,MULTICAST,DHCP,IPv6,PHYSRUNNING> mtu 1500 index 2

        inet6 fe80::20c:29ff:fe1b:7a7b/10

        ether 0:c:29:1b:7a:7b

net1: flags=120002004841<UP,RUNNING,MULTICAST,DHCP,IPv6,PHYSRUNNING> mtu 1500 index 3

        inet6 fe80::250:56ff:fe21:4912/10

        ether 0:50:56:21:49:12

root@s11node1:~#

root@s11node1:~# ipadm show-addr

ADDROBJ           TYPE     STATE        ADDR

lo0/v4            static   ok           127.0.0.1/8

net0/v4           dhcp     ok           172.16.33.120/24

net1/v4           dhcp     ok           192.168.65.111/24

lo0/v6            static   ok           ::1/128

net0/v6           addrconf ok           fe80::20c:29ff:fe1b:7a7b/10

net1/v6           addrconf ok           fe80::250:56ff:fe21:4912/10

root@s11node1:~#


Step 2. Assign a static IP to an interface.

Let's assign 172.16.33.99 to net0 interface to manually add a static IP to an interface configured with DHCP IP.


syntax:

ipadm create-addr [-t] [-T static] [-d]

          -a {local|remote}=addr[/prefixlen],... addrobj | interface

          


root@s11node1:~# ipadm create-addr -T static -a 172.16.33.99/24 net0/testvip

root@s11node1:~# ipadm show-if

IFNAME     CLASS    STATE    ACTIVE OVER

lo0        loopback ok       yes    --

net0       ip       ok       yes    --

net1       ip       ok       yes    --

root@s11node1:~# ipadm show-addr

ADDROBJ           TYPE     STATE        ADDR

lo0/v4            static   ok           127.0.0.1/8

net0/v4           dhcp     ok           172.16.33.120/24

net0/testvip      static   ok           172.16.33.99/24

net1/v4           dhcp     ok           192.168.65.111/24

lo0/v6            static   ok           ::1/128

net0/v6           addrconf ok           fe80::20c:29ff:fe1b:7a7b/10

net1/v6           addrconf ok           fe80::250:56ff:fe21:4912/10

root@s11node1:~#


root@s11node1:~# ifconfig -a

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1

        inet 127.0.0.1 netmask ff000000

net0: flags=100001004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4,PHYSRUNNING> mtu 1500 index 2

        inet 172.16.33.120 netmask ffffff00 broadcast 172.16.33.255

        ether 0:c:29:1b:7a:7b

net0:1: flags=100001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,PHYSRUNNING> mtu 1500 index 2

        inet 172.16.33.99 netmask ffffff00 broadcast 172.16.33.255

net1: flags=100001004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4,PHYSRUNNING> mtu 1500 index 3

        inet 192.168.65.111 netmask ffffff00 broadcast 192.168.65.255

        ether 0:50:56:21:49:12

lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1

        inet6 ::1/128

net0: flags=120002004841<UP,RUNNING,MULTICAST,DHCP,IPv6,PHYSRUNNING> mtu 1500 index 2

        inet6 fe80::20c:29ff:fe1b:7a7b/10

        ether 0:c:29:1b:7a:7b

net1: flags=120002004841<UP,RUNNING,MULTICAST,DHCP,IPv6,PHYSRUNNING> mtu 1500 index 3

        inet6 fe80::250:56ff:fe21:4912/10

        ether 0:50:56:21:49:12

root@s11node1:~#



The above proves that we can assign additional public vip to an existing DHCP configured interface.




How To Remove A Static IP From The Network Interface


Step 1: Get the AddrObj name of the IP.


root@s11node1:~# ipadm show-addr

ADDROBJ           TYPE     STATE        ADDR

lo0/v4            static   ok           127.0.0.1/8

net0/v4           dhcp     ok           172.16.33.120/24

net0/testvip      static   ok           172.16.33.99/24

net1/v4           dhcp     ok           192.168.65.111/24

lo0/v6            static   ok           ::1/128

net0/v6           addrconf ok           fe80::20c:29ff:fe1b:7a7b/10

net1/v6           addrconf ok           fe80::250:56ff:fe21:4912/10

root@s11node1:~#


Step 2: Remove the IP configuration via the AddrObj name.


root@s11node1:~# ipadm delete-addr net0/testvip

root@s11node1:~# ipadm show-addr

ADDROBJ           TYPE     STATE        ADDR

lo0/v4            static   ok           127.0.0.1/8

net0/v4           dhcp     ok           172.16.33.120/24

net1/v4           dhcp     ok           192.168.65.111/24

lo0/v6            static   ok           ::1/128

net0/v6           addrconf ok           fe80::20c:29ff:fe1b:7a7b/10

net1/v6           addrconf ok           fe80::250:56ff:fe21:4912/10

root@s11node1:~#