zfs create -o mountpoint=/zones rpool/zones mkdir /export/builds cat > dhcp.cmd <<EOT create -b set zonepath=/zones/dhcp set brand=dpkg set autoboot=true set ip-type=exclusive add fs set dir="/export/home/admin" set special="/export/home/admin" set type="lofs" end add fs set dir="/export/builds" set special="/export/builds" set type="lofs" end add net set physical="iz1" set global-nic="vsw0" add property (name=ip,value="192.168.0.1") add property (name=netmask,value="255.255.255.0") add property (name=gateway,value="192.168.0.254") add property (name=primary,value="true") end add attr set name="resolvers" set type="string" set value="8.8.8.8" end verify commit EOT zonecfg -z dhcp -f dhcp.cmd zoneadm -z dhcp install && zoneadm -z dhcp boot zlogin dhcp
Inside the dhcp zone:
apt install isc-dhcp-server -y mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bckp cat > /etc/dhcp/dhcpd.conf <<EOT # A slightly different configuration for an internal subnet. subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.100 192.168.0.200; option subnet-mask 255.255.255.0; option domain-name-servers 8.8.8.8; # option domain-name "internal.example.org"; option routers 192.168.0.254; option broadcast-address 192.168.0.255; default-lease-time 600; max-lease-time 7200; } EOT cat > /etc/default/isc-dhcp-server <<EOT # Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server) # Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf). #DHCPDv4_CONF=/etc/dhcp/dhcpd.conf #DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf # Path to dhcpd's PID file (default: /var/run/dhcpd.pid). #DHCPDv4_PID=/var/run/dhcpd.pid #DHCPDv6_PID=/var/run/dhcpd6.pid # Additional options to start dhcpd with. # Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead #OPTIONS="" # On what interfaces should the DHCP server (dhcpd) serve DHCP requests? # Separate multiple interfaces with spaces, e.g. "eth0 eth1". INTERFACESv4="iz1" INTERFACESv6="" EOT svcadm enable isc-dhcp-server exit