BastilleBSD / bastille

Bastille is an open-source system for automating deployment and management of containerized applications on FreeBSD.
https://bastillebsd.org
BSD 3-Clause "New" or "Revised" License
854 stars 136 forks source link

[ENHANCEMENT] Allow use of IP addresses already in use #521

Open phyber opened 2 years ago

phyber commented 2 years ago

Is your feature request related to a problem? Please describe.

I run a FreeBSD server on a LAN with many jails for various things. These jails all share the internal IP address on em0, 192.168.5.1, which is also used for accessing SSH on the server and other things running outside of the jails.

This worked fine in the past with ezjail, and currently works with iocage. It's a behaviour supported by FreeBSD (mentioned in jail(8) under ip4.addr with some minor caveats), but Bastille explicitly blocks this behaviour with one of its checks on start, resulting in Error: IP address (192.168.5.1) already in use..

Describe the solution you'd like

If possible I'd like to be able to bypass this check so that the jails can start as normal and use the existing IP addresses as supported by FreeBSD.

Describe alternatives you've considered

It would be possible to use multiple distinct IP addresses as Bastille tries to push you towards (either reachable over the LAN or with rdr over loopback), but this complicates the setup somewhat while starting a jail on an address that already exists "just works".

Additional context

None that I can think of right now.

Elektrokongen commented 1 year ago

I have run into a similar problem where I have multiple IP adresses going to the same host. I then attach each IP to a jail. But after rebooting the host and restarting Bastille, it won't start the jail because it detects that the IP adress are already in use, but it is not. The way I fix it is to change the IP adress in the jail.conf to a fictive IP, restart the jail, then change the IP back, restart the jail again, and then it works as normal again.

bmac2 commented 1 year ago

@cedwards what is your thoughts on this one before I start figuring out how to implement this.