-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjail.vnet.routed.conf
78 lines (69 loc) · 2.15 KB
/
jail.vnet.routed.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
72
73
74
75
76
77
#
# jail.vnet.routed.conf
#
# A sample /etc/jail.conf for a VNET jails connected to the internal
# virtual network where the host acts as a router and/or a NAT box.
#
# |
# |
# +----o----+
# | gateway |
# +----o----+
# |
# |
# +--------+------------+------------------+
# |
# Physical |
# I/F |
# +--------|-------------------------------+
# | +---o---+ |
# | | Host | (Internal gateway) |
# | +---o---+ |
# | vi0 | $gwv4/$plen |
# |(ng_eiface) |
# | | |
# | +------+-----------------------------+ |
# | | vi0br | |
# | | (ng_bridge) | |
# | +-----------+---------+---------+----+ |
# | | | | |
# | vi0_v1 | vi0_v2 | vi0_v3 | |
# | (ng_eiface) | | | |
# | +---o---+ +---o---+ +---o---+ |
# | |Jail v1| |Jail v2| |Jail v3| |
# | +-------+ +-------+ +-------+ |
# | $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 = "vi0";
$gwv4 = "172.31.0.1";
$plen = 24;
vnet;
vnet.interface = "${net}_$name";
exec.prestart += "vnet add -4 $gwv4/$plen $net ${net}_$name";
exec.start += "ifconfig ${net}_$name $ipv4/$plen";
# assume the host has been setup as a router and/or a NAT box.
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";
v1 {
$ipv4 = "172.31.0.101";
}
v2 {
$ipv4 = "172.31.0.102";
}
v3 {
$ipv4 = "172.31.0.103";
}