From ca51082938b231ce53d1b01d3422ce67ecd7a5f0 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Tue, 26 Apr 2022 15:43:11 +0200 Subject: [PATCH] Name interfaces using mactab --- gen_disks.sh | 1 + gen_machines.py | 1 + templates/interfaces | 12 +----------- templates/mactab | 5 +++++ 4 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 templates/mactab diff --git a/gen_disks.sh b/gen_disks.sh index 57e689f..8fd6659 100755 --- a/gen_disks.sh +++ b/gen_disks.sh @@ -23,6 +23,7 @@ for dir in output/*/; do interfaces /etc/network/interfaces hosts /etc/hosts hostname /etc/hostname + mactab /etc/mactab END umount "$mount" losetup -d "$loop" diff --git a/gen_machines.py b/gen_machines.py index c298b1e..032d9f1 100755 --- a/gen_machines.py +++ b/gen_machines.py @@ -29,6 +29,7 @@ class Computer: 'bird.conf', 'hosts', 'hostname', + 'mactab', ] context = {'c': self} diff --git a/templates/interfaces b/templates/interfaces index 4ed1140..303535e 100644 --- a/templates/interfaces +++ b/templates/interfaces @@ -1,19 +1,9 @@ auto lo iface lo inet loopback -{# auto {% for x in range(len(c.bridges)) %} eth{{x}} {% endfor %} #} -auto /eth* -mapping eth* - script TODO/get-mac-address.sh -{% for br in c.bridges %} - map 52:54:00:17:{{ '%02x:%02x' % (c.num, br.num) }} net_{{br.num}} -{% endfor %} - {% for br in c.bridges %} +auto net_{{ br.num }} iface net_{{br.num}} inet static address 172.23.{{ br.num }}.{{ c.num }}/24 {% endfor %} - - - diff --git a/templates/mactab b/templates/mactab new file mode 100644 index 0000000..7b0e70a --- /dev/null +++ b/templates/mactab @@ -0,0 +1,5 @@ +{% for br in c.bridges %} +net_{{ br.num }} 52:54:00:17:{{ '%02x:%02x' % (c.num, br.num) }} +{% endfor %} + +