mirror of
https://github.com/CloudNebulaProject/zmgr.git
synced 2026-04-10 13:10:42 +00:00
30 lines
464 B
Bash
30 lines
464 B
Bash
|
|
#!/usr/bin/bash
|
||
|
|
set -ex
|
||
|
|
|
||
|
|
ZONE=$1
|
||
|
|
ADDRESS="${2}/24"
|
||
|
|
NICNAME="${ZONE}0"
|
||
|
|
INTERNALSTUB="oinetint0"
|
||
|
|
GATEWAY="10.1.0.1"
|
||
|
|
|
||
|
|
if ! dladm show-vnic $NICNAME > /dev/null; then
|
||
|
|
dladm create-vnic -l $INTERNALSTUB $NICNAME
|
||
|
|
fi
|
||
|
|
|
||
|
|
cat <<EOF | zonecfg -z $ZONE
|
||
|
|
create -b
|
||
|
|
set zonepath=/zones/$ZONE
|
||
|
|
set brand=ipkg
|
||
|
|
set autoboot=false
|
||
|
|
set ip-type=exclusive
|
||
|
|
add net
|
||
|
|
set physical=$NICNAME
|
||
|
|
set allowed-address=$ADDRESS
|
||
|
|
set defrouter=$GATEWAY
|
||
|
|
end
|
||
|
|
verify
|
||
|
|
commit
|
||
|
|
EOF
|
||
|
|
|
||
|
|
zoneadm -z $ZONE install
|