From 066eded4dd588dfc58cbe5357e6e513b47b424bc Mon Sep 17 00:00:00 2001
From: "alexandr.benzonan" <alexandra.benzonana@etu.hesge.ch>
Date: Sat, 8 Apr 2023 16:15:22 +0200
Subject: [PATCH] auto start iface + add variables for gateway

---
 static_iface.j2 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/static_iface.j2 b/static_iface.j2
index b242c1f..27b46a7 100644
--- a/static_iface.j2
+++ b/static_iface.j2
@@ -1,3 +1,4 @@
+auto {{ifname}}
 iface {{ifname}} inet static
     address {{ip}}
     netmask {{netmask}}
@@ -7,12 +8,14 @@ iface {{ifname}} inet static
 {% endif %}
 
 {% if type == "router" %}
+auto {{ifname2}}
 iface {{ifname2}} inet static
     address {{ip2}}
     netmask {{netmask}}
     {% if inventory_hostname == "R1" %}
-    post-up ip route add 3.0.0.0/24 nexthop via 2.0.0.2
+    post-up ip route add 3.0.0.0/24 nexthop via {{gateway}}
     {% else %}
-    post-up ip route add 1.0.0.0/24 nexthop via 2.0.0.1
+    post-up ip route add 1.0.0.0/24 nexthop via {{gateway}}
     {% endif %}
-{% endif %}
\ No newline at end of file
+{% endif %}
+
-- 
GitLab