Here are some commands to create a basic network configuration on Solaris 11.
First of all, the physical network service must be started and the network automagic (nwam) service has to be stopped (for information, nwam is a new solaris 11 service that automates network configuration).
- Check physical network service:
root@S11:~# svcs | grep network/physical online 20:09:37 svc:/network/physical:upgrade online 20:09:45 svc:/network/physical:default
- Check nwam:
root@S11:~# svcs | grep nwam root@S11:~#
If you have to start or stop those services, you can use these commands:
root@S11:~# svcadm disable network/physical:nwam root@S11:~# svcadm enable network/physical:default
In my first example, I run a Solaris 11 x86-64 virtual machine with 3 network interfaces (net0 and net1 are used for my own use, and net2 which is used for this example. A fourth interface net3 will be added to illustrate my second example).
First command is dladm which is use to administer data-links. I use the show-phys option to get physical information of my interfaces:
root@S11:~# dladm show-phys LINK MEDIA STATE SPEED DUPLEX DEVICE net0 Ethernet up 1000 full e1000g0 net1 Ethernet up 1000 full e1000g1 net2 Ethernet unknown 0 unknown e1000g2
There’s another useful option “show-link” which will help you to show your interface status and other information (for example, the MTU).
root@S11:~# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 up -- net1 phys 1500 up -- net2 phys 1500 unknown --
(dladm has a lot of option you can explore with the man page or oracle official documentation : http://docs.oracle.com/cd/E23824_01/)
Ok, now we need to create our interface. In this example, we will create an IP interface (We will see later how to create an IPMP interface).
To do this operation, we will use the “ipadm” tool (ipadm is the tool used to configure the IP protocol).
root@S11:~# ipadm create-ip net2 root@S11:~# dladm show-link LINK CLASS MTU STATE OVER net0 phys 1500 up -- net1 phys 1500 up -- net2 phys 1500 up --
Now the link is up but is not active:
root@S11:~# ipadm show-if IFNAME CLASS STATE ACTIVE OVER lo0 loopback ok yes -- net0 ip ok yes -- net1 ip ok yes -- net2 ip down no --
To finish this basic configuration, we have just to create the address on this interface. We have the choice to use a static configuration or a dynamic one by getting the address from a DHCP Server.
Note that addresses are managed by an address object which is formatted like this : interface/IP protocol
- Dynamic configuration.
root@S11:~# ipadm create-addr -T dhcp net2/v4
Note: if you want to configure which information will be requested by the client to the DHCP server, you can edit the /etc/default/dhcpagent file (especially the PARAM_REQUEST_LIST parameter).
- Static configuration.
root@S11:~# ipadm create-addr -T static -a 192.168.99.102/24 net2/v4
Now the address is up and the routing table has been updated:
root@S11:~# ipadm show-addr ADDROBJ TYPE STATE ADDR lo0/v4 static ok 127.0.0.1/8 net0/v4 dhcp ok 10.0.2.15/24 net1/v4 static ok 192.168.99.101/24 net2/v4 static ok 192.168.99.102/24 lo0/v6 static ok ::1/128 root@S11:~# netstat -r Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ---------- --------- default 10.0.2.2 UG 3 169 net0 10.0.2.0 10.0.2.15 U 3 0 net0 S11 S11 UH 4 310 lo0 192.168.99.0 192.168.99.102 U 3 63 net2 192.168.99.0 192.168.99.101 U 2 1172 net1 Routing Table: IPv6 Destination/Mask Gateway Flags Ref Use If --------------------------- --------------------------- ----- --- ------- ----- S11 S11 UH 2 14 lo0
On the second example, I will show how to configure an IPMP (IP Multipath address). IPMP interface can be used on a RAC configuration to secure network link.
Well, now you know how to configure an IP address on an IP interface, this will be too easy
First, configure two network IP interfaces and configure two IPv4 addresses on it:
root@S11:~# ipadm create-ip net2 root@S11:~# ipadm create-ip net3 root@S11:~# ipadm create-addr -T static -a 192.168.99.102/24 net2/v4 root@S11:~# ipadm create-addr -T static -a 192.168.99.103/24 net3/v4
Next, create an IPMP interface and add it both interfaces you have just configured:
root@S11:~# ipadm create-ipmp ipmp0 root@S11:~# ipadm add-ipmp -i net2 -i net3 ipmp0
At this step, we have an IPMP interface configured with two “slave” interfaces. Final step is to configure an address on this interface:
root@S11:~# ipadm create-addr -T static -a 192.168.99.105/24 ipmp0/v4 root@S11:~# ifconfig ipmp0 ipmp0: flags=8001000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,IPMP> mtu 1500 index 11 inet 192.168.99.105 netmask ffffff00 broadcast 192.168.99.255 groupname ipmp0
Our ipmp address is now configured and active (you can make some tests or “snoop” the ipmp0 interface to view what’s happening on it).
root@S11:~# ipadm show-if IFNAME CLASS STATE ACTIVE OVER lo0 loopback ok yes -- net0 ip ok yes -- net1 ip ok yes -- net2 ip ok yes -- net3 ip ok yes -- ipmp0 ipmp ok yes net2 net3