======================================= FreeBSD vnet jails with LAN and WAN and One NIC ======================================= I usually have a host with multiple ethernet ports and use one for LAN and another for WAN. Sometimes you only have one NIC (such as on a laptop sandbox) and you need to create a LAN for the jails and host. In this example you should have access to multiple WAN ip addresses. ======================================= host /etc/rc.conf --------------------------------------- exec.clean; exec.start = "/bin/sh /etc/rc"; exec.stop = "/bin/sh /etc/rc.shutdown"; allow.raw_sockets = 1; mount.devfs; path = "/export/jail/${name}/root"; exec.consolelog = "/var/log/jail_${name}.log"; rocco { vnet; # LAN exec.prestart = "ifconfig epair11 create up"; exec.prestart += "ifconfig bridge0 addm epair11a"; # WAN exec.prestart += "ifconfig epair12 create up"; exec.prestart += "ifconfig bridge1 addm epair12a"; vnet.interface = "epair11b"; vnet.interface += "epair12b"; exec.poststop = "ifconfig bridge0 deletem epair11a"; exec.poststop += "ifconfig bridge1 deletem epair12a"; exec.poststop += "ifconfig epair11a destroy"; exec.poststop += "ifconfig epair12a destroy"; } bruno { vnet; # LAN exec.prestart = "ifconfig epair21 create up"; exec.prestart += "ifconfig bridge0 addm epair21a"; # WAN exec.prestart += "ifconfig epair22 create up"; exec.prestart += "ifconfig bridge1 addm epair22a"; vnet.interface = "epair21b"; vnet.interface += "epair22b"; exec.poststop = "ifconfig bridge0 deletem epair21a"; exec.poststop += "ifconfig bridge1 deletem epair22a"; exec.poststop += "ifconfig epair21a destroy"; exec.poststop += "ifconfig epair22a destroy"; } ======================================= host /etc/rc.conf --------------------------------------- hostname="mario" ifconfig_bridge0="inet 192.168.100.106 netmask 255.255.255.0 up" ifconfig_bridge1="inet 100.100.100.106 netmask 255.255.255.248 addm em0 up" defaultrouter="100.100.100.105" ifconfig_em0="up" cloned_interfaces="bridge0 bridge1" jail_enable="YES" jail_list="rocco bruno" ======================================= rocco /etc/rc.conf --------------------------------------- hostname="rocco" ifconfig_epair11b="inet 192.168.100.107 netmask 255.255.255.0" ifconfig_epair12b="inet 100.100.100.107 netmask 255.255.255.248" defaultrouter="100.100.100.105" ======================================= bruno /etc/rc.conf --------------------------------------- hostname="bruno" ifconfig_epair21b="inet 192.168.100.108 netmask 255.255.255.0" ifconfig_epair22b="inet 100.100.100.108 netmask 255.255.255.248" defaultrouter="100.100.100.105" --------------------------------------- Set up your firewall accordingly on the host and in the jails ======================================= done =======================================