FreeBSD Jails on a laptop with DHCP
Each jail in FreeBSD needs its own IP to be run. This presents a problem
when jails need to be run on a host which does DHCP i.e. a laptop.
Fortunately the solution is not that difficult. In this example we assume we do
dhcp on rl0, use pf as firewall and use the 10.1.1.0/24 range for the
jails. Basic knowledge of jails and pf is assumed.
The following steps have to performed:
- ifconfig lo1 create
- ifconfig lo1 inet 10.1.1.1 netmask 255.255.255.0
- install the jail as you usually do.
- add the line: nat on rl0 from 10.1.1.0/24 to any -> (rl0)
to
your pf.conf and load the new rule set. This allows the jail to make
connections to the outside world. To reach the jail from the outside you have
to use rdr rules to forward ports.
- Start the jail with the 10.1.1.1 address.