Cheatsheet for configuring the networking in Solaris 11
There are quite a number of changes in the procedures to configure some of the networking parameters. Many things have changed, that were just editing of a file in the past, have now command-line based tools in order to change their parameters. Before you ask: The reason for this steps are quite simple.
At first ist much easier to script the execution of a command, instead of the editing a file. I wrote a lot of those scripts in the past and from my experiences people have an infinite wisdom in creating ways and means to edit a file in a way that it breaks your automatic edting scripts. Furthermore putting all this configuration statements into SMF has an interesting consequence. In the past, it wasn’t always clear to most people when a change of the configuration got active. At the time of the save, at the restart of the daemon? By using SMF it’s clear. As soon as you type in svcadm refresh. Furthermore ifconfig came totally overloaded with parameters with the time. So dladm and ipadm were a very good move from my perspective.
However i know that this is maybe a strange for an long-time user, and to be honest, i was spelling many curses in front of the display, albeit i see the advantages. So i’m putting up my cheatsheet online. My colleague Detlef is planing something similar. As soon his is ready, i will linking to his as well, as i’m sure it’s more complete.
In the datacenter it’s not that useful, however when you have an Solaris VM for example on your notebook you are using for administrative purposes, it’s really nice.
At first we create the network configuration profiles for the datacenter and the office.
Now we have to fill both with the configuration data. At first the one for the datacenter. I think the values are speaking for themself.
Now we do the same for the office:
Now we can just switch the networking configuration by enabling one of the both profiles:
Let’s switch to the office profile:
Of course the networking configuration is not just the interface configuration but a lot other stuff as well, link the configuration of the DNS. That options are in the location profiles. However i don’t want to activate the profile as well as the location both manually. Thus i configure an automatic activation of such configuration. In my example the datacenter profile configures an IP address of 192.168.1.27, the office profile uses DHCP which results in an IP-address out of the 192.168.1.100-199 range. Thus i’m using this for my automatic location switching. I can configure an activation mode and by choosing conditional-any this location profile will be activated automatically when any of the configured conditions are true. It’s pretty simple in my case: If the IP address is 192.168.1.27, i’m in the datacenter, if not i’m in the office.
So, i’m configuring the location profile for the datacenter first. I think this is speaking for itself again, when you take the information into consideration, i gave you in the last paragraph:
Now i will configure the one for the office:
Okay, let’s try this out. At first we activate the datacenter network configuration profile.
In theory, the resolv.conf should now change to nameserver 192.168.1.1. Let’s check this.
Okay, that was successful. Now we will switch to the network configuration profile office.
We have a look into the resolv.conf again. The nameserver should have switched to 192.168.1.43:
Without that automatic stuff ....
Configuring all this stuff manually isn’t hard as well. Perhaps you have chosen “Automatic” initially at install time in the CUI. So at first we have to get rid of the automatisms.
Okay, now we configure an ip interface called net0 and assign an ip address
Of course we need a defaultrouter. With this command we configure such a persistent default route.
Configuring the dns server is a little bit more complex: