wip
This commit is contained in:
parent
9e2dc962bc
commit
76caaddbb2
1 changed files with 13 additions and 9 deletions
|
@ -32,24 +32,28 @@ def systemd_networkd_networks(metadata):
|
||||||
'Address': {
|
'Address': {
|
||||||
'Address': metadata.get('wireguard/my_ip'),
|
'Address': metadata.get('wireguard/my_ip'),
|
||||||
},
|
},
|
||||||
'Route': {
|
|
||||||
'Destination': str(ip_interface(metadata.get('wireguard/my_ip')).network),
|
|
||||||
'GatewayOnlink': 'yes',
|
|
||||||
},
|
|
||||||
'Network': {
|
'Network': {
|
||||||
'DHCP': 'no',
|
'DHCP': 'no',
|
||||||
'IPForward': 'yes',
|
'IPForward': 'yes',
|
||||||
'IPMasquerade': 'yes',
|
#'IPMasquerade': 'yes',
|
||||||
'IPv6AcceptRA': 'no',
|
'IPv6AcceptRA': 'no',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for peer in metadata.get('wireguard/peers').values():
|
for peer, config in metadata.get('wireguard/peers').items():
|
||||||
for route in peer.get('route', []):
|
wg0.update({
|
||||||
|
f'Route#{peer}': {
|
||||||
|
'Destination': str(ip_interface(repo.get_node(peer).metadata.get(f'wireguard/my_ip')).ip),
|
||||||
|
'Gateway': str(ip_interface(metadata.get('wireguard/my_ip')).ip),
|
||||||
|
'GatewayOnlink': 'yes',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
for route in config.get('route', []):
|
||||||
wg0.update({
|
wg0.update({
|
||||||
f'Route#{route}': {
|
f'Route#{peer}_{route}': {
|
||||||
'Gateway': str(ip_interface(metadata.get('wireguard/my_ip')).ip),
|
|
||||||
'Destination': route,
|
'Destination': route,
|
||||||
|
'Gateway': str(ip_interface(repo.get_node(peer).metadata.get(f'wireguard/my_ip')).ip),
|
||||||
|
'GatewayOnlink': 'yes',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue