-
Notifications
You must be signed in to change notification settings - Fork 3
/
jail.vnet.bridged.conf
72 lines (63 loc) · 2.04 KB
/
jail.vnet.bridged.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# jail.vnet.bridged.conf
#
# A sample /etc/jail.conf for a VNET jails connected to the same
# layer2 network as the host's physical interface.
#
# |
# |
# +----o----+
# | gateway |
# +----o----+
# | $gwv4/$plen
# |
# +--------+------------+-------------------------------+
# |
# em0 | (ng_ether)
# (=$net)|
# +--------|--------------------------------------------+
# | | |
# | | lower +----------------------------------+ |
# | +-------+ em0br | |
# | +-------+ (ng_bridge) | |
# | | upper +---------+---------+---------+----+ |
# | | | | | |
# | | em0_b1 | em0_b2 | em0_b3 | |
# | em0 | (ng_eiface) | | | |
# | +---o---+ +---o---+ +---o---+ +---o---+ |
# | | Host | |Jail b1| |Jail b2| |Jail b3| |
# | +-------+ +-------+ +-------+ +-------+ |
# | $ipv4/$plen |
# +-----------------------------------------------------+
#
exec.start = "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown";
exec.clean;
mount.devfs;
host.hostname = $name;
path = "/vm/$name";
exec.consolelog = "/var/log/jail_${name}_console.log";
exec.prestart += "cp /etc/resolv.conf $path/etc";
exec.poststop += "rm $path/etc/resolv.conf";
allow.chflags;
$net = "em0";
$gwv4 = "10.0.2.2";
$plen = 24;
vnet;
vnet.interface = "${net}_$name";
exec.prestart += "vnet add $net ${net}_$name";
exec.start += "ifconfig ${net}_$name $ipv4/$plen";
exec.start += "route add default $gwv4";
# workaround
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238326
exec.prestop += "ifconfig ${net}_$name -vnet $name";
exec.poststop += "vnet delete $net ${net}_$name";
b1 {
$ipv4 = "10.0.2.101";
}
b2 {
$ipv4 = "10.0.2.102";
}
b3 {
$ipv4 = "10.0.2.103";
}