Hello,
I am attempting to use vnet (plus epair and bridge) within a jail but I am unable to make the jail reachable on my network.
I'm relatively new to FreeBSD and jails and most certainly doing something incorrectly.
The process I am following:
This interface works as expected, I can SSH into the host and download packages from the internet.
The resulting bridge looks like:
At this point, I can ping the bridge from within the jail:
But cannot ping the default router:
I am attempting to use vnet (plus epair and bridge) within a jail but I am unable to make the jail reachable on my network.
I'm relatively new to FreeBSD and jails and most certainly doing something incorrectly.
The process I am following:
1. Setup networking on host using interface hn0
Relevant portion of/etc/rc.conf:
Code:
ifconfig_hn0="inet 192.168.1.124 netmask 255.255.248.0"
defaultrouter="192.168.1.1"
This interface works as expected, I can SSH into the host and download packages from the internet.
2. Create epair and bridge interfaces
Code:
# ifconfig epair0 create up
# ifconfig bridge create up
# ifconfig bridge0 inet 192.168.1.224 netmask 255.255.248.0 addm hn0 addm epair0a
The resulting bridge looks like:
Code:
# ifconfig bridge0
bridge0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=0
ether 58:9c:fc:10:ff:86
inet 192.168.1.224 netmask 0xfffff800 broadcast 192.168.7.255
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: epair0a flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 3 priority 128 path cost 2000
member: hn0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 2 priority 128 path cost 2000
groups: bridge
nd6 options=9<PERFORMNUD,IFDISABLED>
2. Create a thick jail at /opt/jail/test
The jail config at/etc/jail.conf.d/test.conf looks like:
Code:
test {
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_console_test.log";
allow.raw_sockets;
exec.clean;
mount.devfs;
host.hostname = "testjail";
path = "/opt/jail/test";
vnet;
vnet.interface = "epair0b";
allow.set_hostname = 1;
}
2. Start jail and configure network
Code:
# service jail start test
# jexec test ifconfig epair0b inet 192.168.1.210 netmask 255.255.248.0 up
# jexec test ifconfig epair0b inet
# jexec test route add default 192.168.1.1
At this point, I can ping the bridge from within the jail:
Code:
# jexec test ping -c 1 192.168.1.224
PING 192.168.1.224 (192.168.1.224): 56 data bytes
64 bytes from 192.168.1.224: icmp_seq=0 ttl=64 time=0.394 ms
--- 192.168.1.224 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.394/0.394/0.394/0.000 ms
But cannot ping the default router:
Code:
# jexec test ping -c 1 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
--- 192.168.1.1 ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss