Private jail IP addresses and reverse NAT is what you need, as Konstantin

There's no need to assign IP to jails each time you change networks just
forward traffic to desired jail with PF based on localip:port and setup
reverse NAT so that you get the connection from your jails.

I have setup like this but I'm using Qjail, not sure how the config looks
if you're using base jail binary, I've never used it nor I intend too.

On Sun, Sep 4, 2016 at 6:43 PM, James Lodge <> wrote:

> > On 4 Sep 2016, at 17:32, Grzegorz Junka <> wrote:
> >
> > Probably it would, I didn't try. Is this is the proper way of solving
> this issue?
> >
> >
> >> On 03/09/2016 15:49, James Lodge wrote:
> >> Would PF and NAT not work for you? NAT to the WLAN0 IP (DHCP assigned)
> using PF macros and have a separate subnet for your jails? This would be
> PAT so you might have issues with accessing services inbound if you're
> using the same port in multiple jails. Just an idea.....
> >>
> >> Sent from my iPad
> >>
> >>>> On 3 Sep 2016, at 16:33, James Gritton <> wrote:
> >>>>
> >>>> On 2016-09-02 15:08, Grzegorz Junka wrote:
> >>>> I am using a jail on my laptop and I often connect to different
> >>>> WiFi's, which of course assign different IPs to my laptop. I set up
> >>>> the jail by adding an alias to wlan0 and I need to update the IP every
> >>>> time I switch the WiFi network. Is it possible to create a jail with
> >>>> IP assigned dynamically, e.g. from DHCP, or at least switch between
> >>>> predefined IPs more easily than by editing /etc/jail.conf?
> >>> You can always add addresses later.  I would create the jail without
> any IP address specified in jail.conf, and then have a exec.poststart
> script that sets the address using something like "jail -m name=foo
> ip4.addr=".  And similarly when the network switches, it would need
> to trigger a similar script that resets the address.
> >>>
> >>> It's a little more complicated that than though: network daemons will
> be bound to the old address after the switch, so you'll need to run the
> proper service(8) commands to restart those, in the right order.  Or
> depending on the service, maybe a kick of some sort (like a kill -1) would
> do the trick.
> >>>
> >>> And at start time, if the jail has no IP address of its own, anything
> it runs will use the regular system IP addresses.  That's definitely not
> what you want.  Unfortunately, jail(8) doesn't have a way to run a script
> in the system environment after the jail is created but before exec.start
> is run.  That would be the right place to set the initial address.  So
> barring that, you may want to have network services not started up at all,
> until this poststart script sets the address.  So it's still not a simple
> issue.
> >>>
> >>> - Jamie
> >>> _______________________________________________
> >>> mailing list
> >>>
> >>> To unsubscribe, send any mail to "
> "
> >
> > _______________________________________________
> > mailing list
> >
> > To unsubscribe, send any mail to ""
> There are many way to handle it, using NAT would be the easiest and the
> way products like VirtualBox and VMware workstation handles it's on a
> desktop/laptop.
> _______________________________________________
> mailing list
> To unsubscribe, send any mail to ""
_______________________________________________ mailing list
To unsubscribe, send any mail to ""

Reply via email to