aboutsummaryrefslogtreecommitdiffstats
path: root/templates/jail_confs/_epl_network.j2
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-12-24 18:26:16 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-12-24 18:26:16 +0200
commita8b7aaff8d89a0933a3abd70426dd2ec465425eb (patch)
treecd3b23eca7e5b112c5239ca403474fb123163f11 /templates/jail_confs/_epl_network.j2
parentd77e686d06916156700c5f298b5edb4ba3e9642b (diff)
Refactor jail.conf.d template
Diffstat (limited to 'templates/jail_confs/_epl_network.j2')
-rw-r--r--templates/jail_confs/_epl_network.j217
1 files changed, 17 insertions, 0 deletions
diff --git a/templates/jail_confs/_epl_network.j2 b/templates/jail_confs/_epl_network.j2
new file mode 100644
index 0000000..e80aebe
--- /dev/null
+++ b/templates/jail_confs/_epl_network.j2
@@ -0,0 +1,17 @@
+## _epl_network begin
+exec.prestart += "ifconfig epair{{ jail.num }}000 create || echo 'Failed to create epair{{ jail.num }}000'";
+exec.prestart += "ifconfig epair{{ jail.num }}000a name epl{{ jail.num }}a";
+exec.prestart += "ifconfig epair{{ jail.num }}000b name epl{{ jail.num }}b";
+exec.prestart += "ifconfig epl{{ jail.num }}b ether random";
+exec.prestart += "ifconfig brlan0 addm epl{{ jail.num }}a";
+
+exec.poststart += "ifconfig epl{{ jail.num }}b vnet ${name}";
+exec.poststart += "jexec ${name} ifconfig epl{{ jail.num }}b up";
+exec.poststart += "ifconfig epl{{ jail.num }}a up";
+exec.poststart += "jexec ${name} ifconfig epl{{ jail.num }}b 192.168.2.{{ jail.num }}/16";
+exec.poststart += "jexec ${name} route delete default || echo 'No default route to delete'";
+
+exec.poststart += "jexec ${name} route add 10.6.210.0/24 {{ lan_ipv4_gateway }} || echo 'Failed to add Wireguard return route'";
+
+exec.poststop += "ifconfig epl{{ jail.num }}a destroy";
+## _epl_network end