Hi folks,
I am using this script to setup networking and a jail and test connectivity to the Internet. Everything works except the last ping 8.8.8.8 from the jail. What could be wrong?
Here is the content of /etc/jail.conf.d/d2d_prod.conf
I am using this script to setup networking and a jail and test connectivity to the Internet. Everything works except the last ping 8.8.8.8 from the jail. What could be wrong?
Bash:
# On host hn0 has ip address 10.0.0.4 and can ping 8.8.8.8
service pf stop
ifconfig bridge create
ifconfig bridge0 inet 192.0.2.254/24 up
ifconfig epair create
jail -c -f /etc/jail.conf.d/d2d_prod.conf
ifconfig bridge0 addm hn0 addm epair0a up
ifconfig epair0a inet 192.0.2.1/24 up
jexec d2d_prod ifconfig epair0b inet 192.0.2.2/24 up
jexec d2d_prod route add default 192.0.2.254 # Also tried 192.0.2.1 as gateway with no success
# Not sure if this is needed but doesn't hurt
ifconfig bridge0 up
ifconfig epair0a up
ifconfig hn0 up
# Throwing spaghetti at the wall at this point
sysctl net.inet.ip.forwarding=1
# All this works
jexec d2d_prod ping -c 4 192.0.2.2
jexec d2d_prod ping -c 4 192.0.2.1
jexec d2d_prod ping -c 4 192.0.2.254
jexec d2d_prod ping -c 4 10.0.0.4
# Doesn't work
jexec d2d_prod ping -c 4 8.8.8.8
Here is the content of /etc/jail.conf.d/d2d_prod.conf
Bash:
d2d_prod {
host.hostname = d2d_prod.example.com;
path = "/usr/jails/d2d_prod";
exec.clean; # Clear environment variables
exec.system_user = "root";
exec.jail_user = "root";
vnet;
vnet.interface = "epair0b";
allow.raw_sockets; # allows pinging
mount.devfs;
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
allow.set_hostname = 1;
}