2020-11-09 13:48:19 +00:00
|
|
|
<%
|
|
|
|
from ipaddress import ip_network
|
|
|
|
%>\
|
2020-06-06 08:18:25 +00:00
|
|
|
[Match]
|
|
|
|
Name=${interface}
|
|
|
|
|
2020-11-09 13:48:19 +00:00
|
|
|
% 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']}
|
2020-11-09 15:38:35 +00:00
|
|
|
GatewayOnlink=yes
|
2020-11-09 13:48:19 +00:00
|
|
|
% endif
|
|
|
|
|
|
|
|
% if 'gateway6' in config:
|
|
|
|
[Route]
|
|
|
|
Gateway=${config['gateway6']}
|
2020-11-09 15:38:35 +00:00
|
|
|
GatewayOnlink=yes
|
2020-11-09 13:48:19 +00:00
|
|
|
% endif
|
|
|
|
|
2020-06-06 08:18:25 +00:00
|
|
|
[Network]
|
|
|
|
DHCP=no
|
|
|
|
IPv6AcceptRA=no
|
|
|
|
|
2020-11-09 13:48:19 +00:00
|
|
|
% if config.get('forwarding', False):
|
|
|
|
IPForward=yes
|
2020-06-06 08:18:25 +00:00
|
|
|
%endif
|