Skip to content

Instantly share code, notes, and snippets.

@hyvanix
Last active October 4, 2020 15:17
Show Gist options
  • Save hyvanix/966a680b79a547133bba9495a60720dc to your computer and use it in GitHub Desktop.
Save hyvanix/966a680b79a547133bba9495a60720dc to your computer and use it in GitHub Desktop.
Create a "private virtual network" on OmniOS and install a zone into
the "private virtual network" with internet connectivity.
More info: https://docs.oracle.com/cd/E26502_01/html/E28992/ggiyq.html#ggkfr
----------------------------
install zadm & illumos brand
----------------------------
global# pkg install zadm brand/illumos
--------------------------------------
create a zfs mountpoint to store zones
--------------------------------------
global# zfs create -o mountpoint=/zones rpool/zones
---------------------------------
setup etherstub, forwarding & nat
---------------------------------
global# dladm create-etherstub stub0
global# dladm create-vnic -l stub0 stub0_eth0
global# ipadm create-if stub0_eth0
global# ipadm create-addr -T static -a 192.168.10.1/24 stub0_eth0/v4
global# svcadm enable ipv4-forwarding
global# ipadm set-ifprop -p forwarding=on -m ipv4 stub0_eth0
global# ipadm set-ifprop -p forwarding=on -m ipv4 e1000g0
global# cat << EOF > /etc/ipf/ipnat.conf
map e1000g0 192.168.10.0/24 -> 0/32 portmap tcp/udp auto
map e1000g0 192.168.10.0/24 -> 0/32
EOF
global# svcadm enable ipfilter
------------
create zone1
------------
global# zadm create -b illumos -i be74174d zone1
---------------------------------------------------
{
"autoboot" : "false",
"bootargs" : "",
"brand" : "illumos",
"fs-allowed" : "",
"hostid" : "",
"ip-type" : "exclusive",
"limitpriv" : "default",
"net" : [
{
"global-nic" : "stub0",
"physical" : "zone10",
"allowed-address" : "192.168.10.11/24",
"defrouter" : "192.168.10.1"
}
],
"pool" : "",
"resolvers" : [
"1.1.1.1",
"1.0.0.1"
],
"scheduling-class" : "",
"zonename" : "zone1",
"zonepath" : "/zones/zone1"
}
---------------------------------------------------
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 159M 100 159M 0 0 2934k 0 0:00:55 0:00:55 --:--:-- 3171k
checking image checksum...
A ZFS file system has been created for this zone.
Installing zone from ZFS stream
------------------------
start and login to zone1
------------------------
global# zadm start zone1
global# zlogin zone1
---------------
test networking
---------------
zone1# ping 192.168.10.11
192.168.10.11 is alive
zone1# ping 192.168.10.1
192.168.10.1 is alive
zone1# ping 1.1.1.1
1.1.1.1 is alive
that's all folks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment