I setup a jail with
like in https://docs.freebsd.org/en/books/handbook/jails/#creating-vnet-jail
but when I run enter the jail with
my network configuration is:
note re0 is my network card.
bsdinstall jail /jails/myjail
as in https://freebsdfoundation.org/freebsd-project/resources/introduction-to-freebsd-jails, and setup the /etc/jail.conf contains the following
Code:
myjail {
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.consolelog = "/var/log/jail_console_${name}.log";
allow.raw_sockets;
exec.clean;
mount.devfs;
devfs_ruleset = 5;
path = "/jails/myjail";
host.hostname = "${name}";
$id = "154";
$ip = "192.168.1.${id}/24";
$gateway = "192.168.1.1";
$bridge = "bridge0";
$epair = "epair${id}";
vnet;
vnet.interface = "${epair}b";
exec.prestart = "/sbin/ifconfig ${epair} create up";
exec.prestart += "/sbin/ifconfig ${epair}a inet $ip up descr jail:${name}";
exec.prestart += "/sbin/ifconfig ${bridge} addm ${epair}a up";
exec.start += "/sbin/ifconfig ${epair}b ${ip} up";
exec.start += "/sbin/route add default ${gateway}";
exec.poststop = "/sbin/ifconfig ${bridge} deletem ${epair}a";
exec.poststop += "/sbin/ifconfig ${epair}a destroy";
}
but when I run enter the jail with
jexec
, and try to test network with ping 1.1.1.1
, I get host unreachable error.my network configuration is:
Code:
ifconfig bridge create
ifconfig bridge0 addm re0
ifconfig bridge0 up