From 46c68b42bdcd0c4831faa2829906111c3761f132 Mon Sep 17 00:00:00 2001 From: Damien Date: Thu, 23 Apr 2026 16:20:29 +0000 Subject: [PATCH] Move campus host config into /etc/network/interfaces Make hosts/campus-host{1,2}_interfaces the source of truth for the campus host IP and default route, and have clab simply invoke 'ifup eth1' at container start to apply it. Previously the bound interfaces file was unused and the real config lived in the YAML exec block, which was misleading. BusyBox ifup in the network-multitool image needs 'address' plus 'netmask' rather than a CIDR, so split the address accordingly. Also add 'post-up ip route replace default via ' so the fabric default overrides the management DHCP default even when one is already installed. --- evpn-lab.clab.yml | 8 ++------ hosts/campus-host1_interfaces | 4 +++- hosts/campus-host2_interfaces | 4 +++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/evpn-lab.clab.yml b/evpn-lab.clab.yml index 5c839b8..2383f4b 100644 --- a/evpn-lab.clab.yml +++ b/evpn-lab.clab.yml @@ -277,9 +277,7 @@ topology: binds: - hosts/campus-host1_interfaces:/etc/network/interfaces exec: - - ip link set dev eth1 up - - ip addr add 10.60.60.101/24 dev eth1 - - ip route replace default via 10.60.60.1 + - ifup eth1 campus-host2: kind: linux @@ -290,9 +288,7 @@ topology: binds: - hosts/campus-host2_interfaces:/etc/network/interfaces exec: - - ip link set dev eth1 up - - ip addr add 10.60.70.102/24 dev eth1 - - ip route replace default via 10.60.70.1 + - ifup eth1 links: # ===================================================== diff --git a/hosts/campus-host1_interfaces b/hosts/campus-host1_interfaces index 984b20c..c12d792 100644 --- a/hosts/campus-host1_interfaces +++ b/hosts/campus-host1_interfaces @@ -3,5 +3,7 @@ iface lo inet loopback auto eth1 iface eth1 inet static - address 10.60.60.101/24 + address 10.60.60.101 + netmask 255.255.255.0 gateway 10.60.60.1 + post-up ip route replace default via 10.60.60.1 diff --git a/hosts/campus-host2_interfaces b/hosts/campus-host2_interfaces index b837b64..64ab3b9 100644 --- a/hosts/campus-host2_interfaces +++ b/hosts/campus-host2_interfaces @@ -3,5 +3,7 @@ iface lo inet loopback auto eth1 iface eth1 inet static - address 10.60.70.102/24 + address 10.60.70.102 + netmask 255.255.255.0 gateway 10.60.70.1 + post-up ip route replace default via 10.60.70.1