...
Code Block |
---|
zonecfg -z t4
zonecfg:t4> create -t SUNWdpkg
zonecfg:t4> set zonepath=/zones/t4
zonecfg:t4> add net
zonecfg:t4:net> set address=172.16.92.4/16
zonecfg:t4:net> set defrouter=172.16.90.1
zonecfg:t4:net> set physical=e1000g0
zonecfg:t4:net> end
zonecfg:t4> add fs
zonecfg:t4:fs> set dir=/export/home/admin
zonecfg:t4:fs> set special=/export/home/admin
zonecfg:t4:fs> set type=lofs
zonecfg:t4:fs> end
zonecfg:t4> add fs
zonecfg:t4:fs> set dir=/export/builds
zonecfg:t4:fs> set special=/export/builds
zonecfg:t4:fs> set type=lofs
zonecfg:t4:fs> end
zonecfg:t4> commit
zonecfg:t4> verify
zonecfg:t4> exit |
In this example we configured a shared IP-address, this means that the zone will share the IP stack with the host system. From time to time you may want to assign an exclusive IP-address.
In this case the net block could look like:
Code Block |
---|
|
zonecfg:t4> set ip-type="exclusive"
zonecfg:t4> add net
zonecfg:t4:net> set physical=vnic0
zonecfg:t4:net> set mac-addr=""
zonecfg:t4:net> set global-nic="vsw0"
zonecfg:t4:net> add property (name="gateway",value="172.16.0.1")
zonecfg:t4:net> add property (name="netmask",value="255.255.255.0")
zonecfg:t4:net> add property (name="ip",value="172.16.0.2")
zonecfg:t4:net> add property (name="primary",value="true")
zonecfg:t4:net> end
|
Like above we need to specify a link that will be used by the zone (vnic0). We mean that the nic is virtual (aka vnic) which has a parent interface, in this example it is a virtual switch (vsw0) or etherstub that is marked as global-nic. So, you MUST configure this virtual switch or etherstub (as described in How to configure NAT with etherstub) before use it for zone configuration. We can generate some MAC-address for the new NIC or leave this field empty, it will be filled automatically. Also we need to specify network properties (gateway, usualy it is IP-address in the host; netmask; ip is the address that will be assigned to the NIC inside the zone)
Also you can add a name server to the zone:
Code Block |
---|
|
zonecfg:t4> add attr
zonecfg:t4:attr> set name=resolvers
zonecfg:t4:attr> set type=string
zonecfg:t4:attr> set value="192.168.0.1"
zonecfg:t4:attr> end |
Since the version of DilOS 2.0.2.94 you can use IPv6, DHCP and domain name in the zone.
Code Block |
---|
|
zonecfg:t4> set ip-type="exclusive"
zonecfg:t4> add net
zonecfg:t4:net> set physical=vnic0
zonecfg:t4:net> set global-nic="vsw0"
zonecfg:t4:net> add property (name="ip",value="dhcp")
zonecfg:t4:net> add property (name="primary",value="true")
zonecfg:t4:net> end |
Configuring IPv6 in a non-global zone:
Code Block |
---|
|
zonecfg:ltest01> set ip-type="exclusive"
zonecfg:ltest01> add net
zonecfg:ltest01:net> set physical=vnic0
zonecfg:ltest01:net> set global-nic=atge0
zonecfg:ltest01:net> add property (name="ip",value="dhcp")
zonecfg:ltest01:net> add property (name="ip6",value="2001:b08:4:4::10")
zonecfg:ltest01:net> add property (name="prefix",value="64")
zonecfg:ltest01:net> end
|
...