How to setup two NICs (and access both from Jail)

Status
Not open for further replies.

mattmac24

Dabbler
Joined
Jun 27, 2011
Messages
21
Hi,

I need some help with network settings. Basically i have two Network connections going into my FreeNAS box and i need to send all traffic to a specific IP over one of the connections, and the rest over the other connection. I have setup the static route fine on the Host, the problem is that inside the Jail i cant seem to access the second connection at all.

1st Connection:
Gateway: 192.168.0.1
FreeNAS IP: 192.168.0.5
NetMask: 255.255.255.0

2nd Router:
Gateway: 192.168.1.1
FreeNAS IP: 192.168.1.2
NetMask: 255.255.255.0

Jail Network settings:
IP: 192.168.0.6
NetMask: 255.255.255.0

I have configured 192.168.0.1 to be the default route from the web ui.
Inside the host i can ping 192.168.0.1 and 192.168.1.1
Inside the jail i can ping 192.168.0.1 but not 192.168.1.1

i have full control of the routers on both connections. Can somebody please tell me how i should configure my network settings to get this to work.

Thanks :)
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
There was just a post here about how to do this a couple of weeks ago. It should either be here in this section or possibly in the plugins section. William Grzybowski posted the answer, that should help you search for it.
 

mattmac24

Dabbler
Joined
Jun 27, 2011
Messages
21
There was just a post here about how to do this a couple of weeks ago. It should either be here in this section or possibly in the plugins section. William Grzybowski posted the answer, that should help you search for it.

Thanks, found his command. For anybody else who wants to know (Inside the host):

Code:
ifconfig ifname0 vnet $jailid

then to assign your new interface a ip address (Inside the jail):
Code:
ifconfig ifname0 inet IP_Address


this also removes the interface from the host however and needs to be setup again after each reboot. Also any static routes defined in the web GUI are not followed by the Jail.
 

mattmac24

Dabbler
Joined
Jun 27, 2011
Messages
21
Ok so in an attempt for a cleaner solution i have modified /conf/base/etc/rc.conf and added the following:
Code:
cloned_interfaces="bridge1"
ifconfig_bridge1="inet 192.168.1.1 netmask 255.255.255.0 up"
jail_Jail_exec_prestart5="ifconfig epair1 create"
jail_Jail_exec_prestart6="ifconfig bridge1 addm epair1a"
jail_Jail_exec_prestart7="ifconfig epair1a up"
jail_Jail_exec_earlypoststart5="ifconfig epair1b vnet Jail"
jail_Jail_exec_afterstart5="ifconfig epair1b 192.168.1.3 netmask 255.255.255.0 up"
jail_Jail_exec_afterstart6="route add default 192.168.1.1"
jail_Jail_exec_poststop5="ifconfig bridge1 deletem epair1a"
jail_Jail_exec_poststop6="ifconfig epair1a destroy"


except the lines are not carried across to /etc/rc.conf after a reboot, except for
Code:
ifconfig_bridge1="inet 192.168.1.1 netmask 255.255.255.0 up"
which makes it across. Secondarily when running the commands manually everything appears to be setup nicely except i still cant ping 192.168.1.1 from my Jail. im attempting to follow the guide i found HERE.

What i really want to do is find the setup files for the Jail and mirror the 1st connection to allow a second, however i cant find them anywhere(I think they are inside the db which i am not sure how to access/i dont think i really should modify it anyway)
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
What i really want to do is find the setup files for the Jail and mirror the 1st connection to allow a second, however i cant find them anywhere(I think they are inside the db which i am not sure how to access/i dont think i really should modify it anyway)

I explained this in another thread. Those files get created from settings in the database, so we need to request (open a ticket) to have them add extra settings for the jail to the GUI.
 
Status
Not open for further replies.
Top