Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Sep 2014 12:28:33 -0500
From:      dweimer <dweimer@dweimer.net>
To:        Fbsd8 <fbsd8@a1poweruser.com>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: FreeBSD 10 Multiple IPs in a jail
Message-ID:  <2da1b5a5a27199828a8cf5595962262e@dweimer.net>
In-Reply-To: <541B120D.1000606@a1poweruser.com>
References:  <480aebf1080d12f717695748ef92b4d4@dweimer.net> <541B120D.1000606@a1poweruser.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 09/18/2014 12:10 pm, Fbsd8 wrote:
> dweimer wrote:
>> I know that we can now do multiple IPs in a jail, and I have a 
>> configuration that works for it.
>> 
>> jail.conf:
>> testjail {
>>         jid = 100;
>>         host.hostname = testjail.local;
>>         ip4.addr = 'em0|10.20.190.190/24';
>>         ip4.addr += 'em0|10.20.190.191/24';
>>         path = /jails/devel/ROOT;
>>         allow.mount.devfs;
>>         mount.devfs;
>>         allow.sysvipc;
>>         exec.start = "/bin/sh /etc/rc";
>>         exec.stop = "/bin/sh /etc/rc.shutdown";
>>         exec.prestart = "/jails/devel/prestart.sh";
>>         exec.poststop = "/jails/devel/poststop.sh";
>>         exec.consolelog = "/jails/devel/console.log";
>> }
>> 
>> This works great, my question is now that I have this figured out and 
>> I am done testing it, how can I apply it to a running jail without 
>> rebooting the jail?
>> 
>> I tried using:
>>   jail -n testjail -m 'ip4.addr='em0|10.20.190.191/24'
>>   This replaces the IP on the jail.
>> 
>> Then I tried using:
>>   jail -n testjail -m 'ip4.addr+='em0|10.20.190.191/24'
>>   I get an error "unknown parameter ip4.addr+"
>> 
>> Am I stuck waiting until after hours to add the secondary IP when I 
>> can reboot the production jail?  Or is there another way I haven't 
>> figured out yet to add the secondary IP to the running jail?
>> 
> 
> How about
> jail -n testjail -m 
> 'ip4.addr='em0|10.20.190.190/24,em0|10.20.190.191/24'

That's the ticket, thanks.

Just an FYI ran first time without errors but didn't add it to the jail.
Then I tried "ifconfig em0 alias 10.20.190.191/24" on the host 
(10.20.190.190 was in the original jails configuration) and ran it a 
second time, and success, at least in my test environment, time to try 
and repeat on the production server.

-- 
Thanks,
    Dean E. Weimer
    http://www.dweimer.net/



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?2da1b5a5a27199828a8cf5595962262e>