Static dual stack networking on OmniOS Solaris Zones
278 words, 2 minutes
On my OmniOS zones, I don’t use DHCP. Mostly because I don’t have that
many of those; DHCP would be overkill and another service to manage.
For those configured using IPv4 only, the zadm
utility can configure
the network stack from a JSON file. But I had that zone where I needed
both IPv4 and IPv6 configured and couldn’t have it working via zadm
.
So I configured it from within the zone.
My JSON file for a Solaris Zone generally contains
"ip-type" : "exclusive",
"net" : [
{
"allowed-address" : "192.0.2.101/24",
"defrouter" : "192.0.2.1",
"global-nic" : "private0",
"physical" : "zone0"
}
],
"resolvers" : [
"192.0.2.1"
],
This configures an IPv4 address and a default gateway for the zone.
But I just failed getting a proper syntax to actually configure both an IPv4 and an IPv6 addresses for the zones. Whether I used JSON arrays or lists, whether I dropped “allowed-address” and “defrouter” and used “ips”, whether I tried what I found on various Solaris, illumos, OmniOS and SmartOS documentation, forums and blogs.
So I went removing the auto-configuration parts. The dual stack networking zone looks like:
"ip-type" : "exclusive",
"net" : [
{
"global-nic" : "private0",
"physical" : "zone0"
}
],
"resolvers" : [
"192.0.2.1"
],
When the zone is started, I simply log in using zlogin
and configure
it as I would do with any OmniOS server:
# ipadm create-addr -T static -a local=192.0.2.101/24 zone0/v4
# ipadm create-addr -T addrconf zone0/v6auto
# ipadm create-addr -T static -a local=2001:0DB8::101/64 zone0/v6
# route -p add -inet default 192.0.2.1
# route -p add -inet6 default 2001:0DB8::1
I can now have daemons listening to IPv4 and/or IPv6 on this zone.