Setting multiple public IPs to a single physical interface and assigning each one to a different jail?

This is more a question about whether what I have in mind is actually feasible, not so much asking how to actually go about doing it.

Right now I use a cloud provider to host several VPSes, each with a certain service on it. I am considering instead renting a dedicated server from my provider and putting each of the VPS services in a jail on the dedicated server. The server will have a single physical interface but I will have the option to pay for additional public IP addresses, and I would like to assign each one to a jail.

So what I am thinking will need to be done is:
1. assign my extra IPs to the interface as aliases ( # ifconfig if1 1.2.3.4 netmask 255.255.255.255 alias)
2. For each jail, configure jail.conf to use the particular public IP I want it to use ( ip4.addr = 1.2.3.4)
3. That's it?

The end goal is to have multiple jails on my single dedicated server, each with its own public IP, and with no special work beyond what you'd do to set up any random jail, and the jail will just be automagically internet accessible in the same way as if it were an ordinary non-jailed server without any extra networking hoops to jump through.

Do I have this right? Or am I just completely off base?
 
I used a configuration like you described in 1-2-3.
It worked for me without any issues.

Optional feature:
jail(8)
Code:
     interface
         A network interface to add    the jail's IP addresses    (ip4.addr and
         ip6.addr) to.  An alias for each address will be added to the in-
         terface before the    jail is    created, and will be removed from the
         interface after the jail is removed.
 
Back
Top