The global zone performs routing and NAT, so you need to connect the global zone to both the private virtual network and the physical NIC. You connect the global zone to the physical NIC by configuring the primary interface in the global zone. You connect the global zone to the private virtual network by creating vnic0 over the etherstub ether0.
# dladm create-etherstub ether0
# dladm create-vnic -l ether0 vnic0 # ipadm create-ip vnic0 # ipadm create-addr -a 192.0.2.33/27 vnic0
The VNIC vnic0 acts as the default router for the zones.
global# zonecfg -z zone1 Use 'create' to begin configuring a new zone. zonecfg:zone1> create -t SYSsolaris zonecfg:zone1> select anet linkname=net0 zonecfg:zone1:anet> set lower-link=ether0 zonecfg:zone1:anet> set allowed-address=192.0.2.34/27 zonecfg:zone1:anet> set defrouter=192.0.2.33/27 zonecfg:zone1:anet> end zonecfg:zone1> commit zonecfg:zone1> exit
global# zoneadm -z zone1 install global# zoneadm -z zone1 boot
global# zlogin -C zone1
global# zonecfg -z zone2 zonecfg:zone2> select anet linkname=net0 zonecfg:zone2:anet> set lower-link=ether0 zonecfg:zone2:anet> set allowed-address=192.0.2.35/27 zonecfg:zone2:anet> set defrouter=192.0.2.33/27 zonecfg:zone2:anet> end zonecfg:zone2> commit zonecfg:zone2> exit
global# zoneadm -z zone2 reboot global# zlogin zone2
global# zonecfg -z zone3 zonecfg:zone3> select anet linkname=net0 zonecfg:zone3:anet> set lower-link=ether0 zonecfg:zone3:anet> end zonecfg:zone3> commit zonecfg:zone3> exit
global# zoneadm -z zone3 apply global# zlogin zone3 zone3# ipadm create-ip net0 zone3# ipadm create-addr -a 192.0.2.36/27 net0/v4 zone3# route -p add default 192.0.2.33/27
You can enable the private virtual network to send network traffic outside the system by enabling IP forwarding and network address translation (NAT) in the global zone.
global# ipadm set-ifprop -p forwarding=on -m ipv4 net0 global# ipadm set-ifprop -p forwarding=on -m ipv4 vnic0
global# cat /etc/ipf/ipnat.conf map net0 192.0.2.0/2 -> 0/32 portmap tcp/udp auto map net0 192.0.2.0/27 -> 0/32
global# svcadm enable network/ipfilter
# ping 192.0.2.1/27