bundles/systemd-networkd: proper config
This commit is contained in:
parent
fbb4e2f7a5
commit
5e7c7671e0
3 changed files with 46 additions and 24 deletions
|
@ -1,6 +1,35 @@
|
|||
<%
|
||||
from ipaddress import ip_network
|
||||
%>\
|
||||
[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
|
||||
|
||||
[Network]
|
||||
% if config.get('dhcp', False):
|
||||
DHCP=yes
|
||||
|
@ -11,23 +40,6 @@ DHCP=no
|
|||
IPv6AcceptRA=no
|
||||
% endif
|
||||
|
||||
% for addr in sorted(config.get('ip_addresses', set())):
|
||||
Address=${addr}
|
||||
% endfor
|
||||
|
||||
% if config.get('ip4_masquerade_outgoing', False):
|
||||
IPMasquerade=yes
|
||||
IPForward=ipv4
|
||||
% if config.get('forwarding', False):
|
||||
IPForward=yes
|
||||
%endif
|
||||
|
||||
% if 'ip6_gateway' in config:
|
||||
[Route]
|
||||
Gateway=${config['ip6_gateway']}
|
||||
GatewayOnLink=yes
|
||||
% endif
|
||||
|
||||
% if 'ip4_gateway' in config:
|
||||
[Route]
|
||||
Gateway=${config['ip4_gateway']}
|
||||
GatewayOnLink=yes
|
||||
% endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue