Greetings!
My FreeBSD box has 2 NIC's installed. I want to use one of the NIC's for the box itself, and dedicate the other one solely to the jails I have created. One of the jails will run a webserver and I want it to be on a different network from the base operating system. To create the jails, I have followed this link, exactly:
http://www.bsdnow.tv/tutorials/jails
I have struggled with this. After months of Googling I have two questions:
1. I think I know how to bind both cards to the base OS. Here are my settings in /etc/rc.conf:
Those aliases on the 172.20.20.x addresses are the jails I would like to be running on a different subnet, like 172.20.40.x, but I can't make it work.
So the first NIC, re0, is used by the main operating system in which the jails are running, and has the IP 172.20.20.32. Everything works great with that. I can install jails and give them IPs on that subnet, as shown by the alias lines above, and everything works great. I have the other IP assigned to 172.20.40.32, and it works great for connecting to the base OS. But if I have a jail that I want to put on a different subnet, such as 172.20.40.0/24, I can do that, and the jail runs, and I can connect to it via SSH, but the jail itself can't connect to the internet, only the local network.
The two NICs are each connected to a pFsense firewall. I know the NICs both function because I can unplug one and access the box from the other at the designated IP address. How do I use multiple NICs and assign them only to a specific jail (and have it work!)?
2. Once I figure out #1, how do I ensure that a particular NIC can only be used for the jail? For example, I noticed that if the jail were not running, for example, 172.20.20.230, and I tried to SSH into that jail using that IP, the SSH session would default to the main FreeBSD box and I would get a login prompt there. How do I keep it from doing that?
Thanks in advance!
My FreeBSD box has 2 NIC's installed. I want to use one of the NIC's for the box itself, and dedicate the other one solely to the jails I have created. One of the jails will run a webserver and I want it to be on a different network from the base operating system. To create the jails, I have followed this link, exactly:
http://www.bsdnow.tv/tutorials/jails
I have struggled with this. After months of Googling I have two questions:
1. I think I know how to bind both cards to the base OS. Here are my settings in /etc/rc.conf:
Code:
ifconfig_re0="DHCP"
hostname="freebsd"
ifconfig_re0_alias0="inet 172.20.20.230 netmask 0xffffff00 broadcast 172.20.20.255"
ifconfig_re0_alias1="inet 172.20.20.231 netmask 0xffffff00 broadcast 172.20.20.255"
ifconfig_re0_alias2="inet 172.20.20.232 netmask 0xffffff00 broadcast 172.20.20.255"
ifconfig_re0_alias3="inet 172.20.20.233 netmask 0xffffff00 broadcast 172.20.20.255"
.
.
.
ifconfig_re1="inet 172.20.40.32 netmask 0xfffffff00 broadcast 172.20.40.255"
ifconfig_re1_alias0="inet 172.20.40.230 netmask 0xffffff00 broadcast 172.20.40.255" <--- used for the jail
Those aliases on the 172.20.20.x addresses are the jails I would like to be running on a different subnet, like 172.20.40.x, but I can't make it work.
So the first NIC, re0, is used by the main operating system in which the jails are running, and has the IP 172.20.20.32. Everything works great with that. I can install jails and give them IPs on that subnet, as shown by the alias lines above, and everything works great. I have the other IP assigned to 172.20.40.32, and it works great for connecting to the base OS. But if I have a jail that I want to put on a different subnet, such as 172.20.40.0/24, I can do that, and the jail runs, and I can connect to it via SSH, but the jail itself can't connect to the internet, only the local network.
The two NICs are each connected to a pFsense firewall. I know the NICs both function because I can unplug one and access the box from the other at the designated IP address. How do I use multiple NICs and assign them only to a specific jail (and have it work!)?
2. Once I figure out #1, how do I ensure that a particular NIC can only be used for the jail? For example, I noticed that if the jail were not running, for example, 172.20.20.230, and I tried to SSH into that jail using that IP, the SSH session would default to the main FreeBSD box and I would get a login prompt there. How do I keep it from doing that?
Thanks in advance!