bundles/systemd-networkd: add option for setting static routes

This commit is contained in:
Franzi 2021-01-08 16:09:59 +01:00
parent 17510b783c
commit dca13263e2
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 15 additions and 2 deletions

View file

@ -16,19 +16,25 @@ Name=${interface}
Address=${ip}/${prefix} Address=${ip}/${prefix}
% endfor % endfor
% for route in config.get('routes', {}):
[Route]
Gateway=${route['via']}
Destination=${route['to']}
GatewayOnlink=yes
% endfor
% if 'gateway4' in config: % if 'gateway4' in config:
[Route] [Route]
Gateway=${config['gateway4']} Gateway=${config['gateway4']}
GatewayOnlink=yes GatewayOnlink=yes
% endif
% endif
% if 'gateway6' in config: % if 'gateway6' in config:
[Route] [Route]
Gateway=${config['gateway6']} Gateway=${config['gateway6']}
GatewayOnlink=yes GatewayOnlink=yes
% endif
% endif
[Network] [Network]
DHCP=no DHCP=no
IPv6AcceptRA=no IPv6AcceptRA=no

View file

@ -16,6 +16,13 @@ nodes['home.downloadhelper'] = {
'ips': { 'ips': {
'172.19.138.27/24', '172.19.138.27/24',
}, },
'routes': [
{
# VPN
'to': '172.19.136.0/22',
'via': '172.19.138.1',
},
],
}, },
}, },
'backups': { 'backups': {