bundlewrap/bundles/systemd-networkd/files/template.network

46 lines
646 B
SYSTEMD
Raw Normal View History

<%
from ipaddress import ip_network
%>\
2020-06-06 08:18:25 +00:00
[Match]
Name=${interface}
% for addr in sorted(config.get('ips', set())):
[Address]
<%
if '/' in addr:
ip, prefix = addr.split('/')
else:
ip = addr
prefix = '32'
%>\
Address=${ip}/${prefix}
% endfor
% if 'gateway4' in config:
[Route]
Gateway=${config['gateway4']}
GatewayOnLink=yes
% endif
% if 'gateway6' in config:
[Route]
Gateway=${config['gateway6']}
GatewayOnLink=yes
% endif
2020-06-06 08:18:25 +00:00
[Network]
% if config.get('dhcp', False):
DHCP=yes
IPv6AcceptRA=yes
UseHostname=no
% else:
DHCP=no
IPv6AcceptRA=no
% endif
% if config.get('forwarding', False):
IPForward=yes
2020-06-06 08:18:25 +00:00
%endif