Different Netmasks for jails

Roger Gujord roger at gujord.com
Fri Jun 29 07:29:18 UTC 2007


Norberto Meijome wrote:
> On Thu, 28 Jun 2007 12:00:05 +0200
> Roger Gujord <roger at gujord.com> wrote:
>
>   
>> How can I have a netmask like 255.255.255.128 for one jail and a netmask 
>> like 255.255.255.240 for another jail without creating static aliases at 
>> hosts boot-time in /etc/rc.conf ?
>> I would like the /etc/rc.d/jail to create the network aliases according 
>> to the jails respective network mask. I see that /etc/rc.d/jail sets the 
>> netmask to 255.255.255.255 for all network aliases.
>>     
>
> Hi :)
>
> I'm pretty sure this is the same FAQ as seen in questions@ / net@ wrt netmasks
> of aliases. In short, if your aliased interfaces are in the *same* subnet as
> your main IP (eg, the main IP's subnet includes all the aliased subnets), they
> will be /32. 
>   
Thanks for your answer Norberto :-)
If I understand you correctly, you are saying that the same netmask as 
the one for the hosts main IP will apply to all jails and therefore 
there is no need to specify a netmask other than /32 for each jail in 
the same subnet.
But this is not my case. I have two different subnets in the same 
IP-range with different netmasks (of course) and also another IP-range.

-------------------------------------------------------
Subnet ID          Broadcast Address    Subnet Mask
-------------------------------------------------------
192.168.1.0  /25   192.168.1.127        255.255.255.128
192.168.1.48 /28   192.168.1.62         255.255.255.240
192.168.2.96 /27   192.168.2.127        255.255.255.224


I'm trying to configure jails to run in all three subnets on the same host:
mainHost 192.168.1.1/25
jailHostA 192.168.1.2/25
jailHostB 192.168.1.54/28
jailHostC 192.168.2.100/27

I guess the jailHostA is OK since it's running in the same subnet as the 
mainHost. But how do I configure jailHostB and C without creating a 
static aliased interface (in /etc/rc.conf) when all jails are started up 
with netmask /32 (from /etc/rc.d/jail) ?

Thanks! :-)

--Roger



More information about the freebsd-jail mailing list