From dca13263e258853b84580ae496461ac7778a27e3 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Fri, 8 Jan 2021 16:09:59 +0100 Subject: [PATCH] bundles/systemd-networkd: add option for setting static routes --- .../files/template-iface-nodhcp.network | 10 ++++++++-- nodes/home/downloadhelper.py | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bundles/systemd-networkd/files/template-iface-nodhcp.network b/bundles/systemd-networkd/files/template-iface-nodhcp.network index 4efb79e..cf36211 100644 --- a/bundles/systemd-networkd/files/template-iface-nodhcp.network +++ b/bundles/systemd-networkd/files/template-iface-nodhcp.network @@ -16,19 +16,25 @@ Name=${interface} Address=${ip}/${prefix} % endfor +% for route in config.get('routes', {}): +[Route] +Gateway=${route['via']} +Destination=${route['to']} +GatewayOnlink=yes +% endfor % if 'gateway4' in config: [Route] Gateway=${config['gateway4']} GatewayOnlink=yes -% endif +% endif % if 'gateway6' in config: [Route] Gateway=${config['gateway6']} GatewayOnlink=yes -% endif +% endif [Network] DHCP=no IPv6AcceptRA=no diff --git a/nodes/home/downloadhelper.py b/nodes/home/downloadhelper.py index 68a36e6..108ff1c 100644 --- a/nodes/home/downloadhelper.py +++ b/nodes/home/downloadhelper.py @@ -16,6 +16,13 @@ nodes['home.downloadhelper'] = { 'ips': { '172.19.138.27/24', }, + 'routes': [ + { + # VPN + 'to': '172.19.136.0/22', + 'via': '172.19.138.1', + }, + ], }, }, 'backups': {