Question : Can I configure additional IP addresses on the same interface in non-global zone? If yes, how?
Answer :
Yes, you can add additional IP addresses on the existing interface configured in the non global zone. In fact the procedure remains the same. To add a secondary shared interface to configured shared ip zone you would use the zonecfg command. Below is an example of adding a second interface in a zone named zone01 that will be persistent upon reboots. In this example, the Interface in the Global Zone is bge0. Additional interface in the configured zone will be bge0:2 and it will be persistent upon reboots.
1. Login into the global zone as root and proceed as follows:
global_zone # zonecfg -z zone01 zonecfg:zone01 > info <---- info shows how the zone is configured now zonename: zone01 zonepath: /zones/zone01 brand: native autoboot: true bootargs: pool: limitpriv: scheduling-class: ip-type: shared hostid: inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr net: address: 10.10.2.3/24 physical: bge0 defrouter not specified
Next we add the second interface:
zonecfg:zone01 > add net zonecfg:zone01 :net> set physical=bge0 zonecfg:zone01 :net> set address=10.10.2.4 zonecfg:zone01 :net> end zonecfg:zone01 > verify zonecfg:zone01 > commit zonecfg:zone01 > info <------- info again will show you the new interface you just added zonename: zone01 zonepath: /zones/zone01 brand: native autoboot: true bootargs: pool: limitpriv: scheduling-class: ip-type: shared hostid: inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr net: address: 10.10.2.3/24 physical: bge0 defrouter not specified net: address: 10.10.2.4 physical: bge0 defrouter not specified zonecfg:zone01 > exit
Then we reboot the the zone zone01 :
globa_zone # zoneadm -z zone01 reboot
Now login into the zone after the reboot and run ifconfig to see the new interface:
# ifconfig -a lo0:1: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 bge0:1: flags=1000843 mtu 1500 index 2 inet 10.10.2.3 netmask ffffff00 broadcast 10.10.2.255 bge0:2: flags=1000843 mtu 1500 index 2 inet 10.10.2.4 netmask ffffff00 broadcast 10.10.2.255
In the global zone we see the new interface added to the bge interface as bge0:2
global_zone # ifconfig -a lo0: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 lo0:1: flags=2001000849 mtu 8232 index 1 zone zone01 inet 127.0.0.1 netmask ff000000 bge0: flags=1000843 mtu 1500 index 2 inet 10.152.24.44 netmask ffffff00 broadcast 10.152.24.255 ether 0:3:ba:e4:7f:b0 bge0:1: flags=1000843 mtu 1500 index 2 zone zone01 inet 10.10.2.3 netmask ffffff00 broadcast 10.10.2.255 bge0:2: flags=1000843 mtu 1500 index 2 zone zone02 inet 10.10.2.4 netmask ffffff00 broadcast 10.10.2.255
This is all you need to do to add the interface. You do not need to do anything in the global zone and it will remain after any reboot.