This commit is contained in:
mwiegand 2021-10-10 17:15:08 +02:00
parent 42fc425173
commit 4dd42db7f2
3 changed files with 30 additions and 10 deletions

View file

@ -1,8 +1,27 @@
# defaults = { from ipaddress import ip_network, ip_interface
# 'network': {
# 'external': {
# 'gateway4': '172.31.1.1', @metadata_reactor.provides(
# 'gateway6': 'fe80::1', 'systemd/units',
# }, )
# }, def network(metadata):
# } interface = ip_interface(metadata.get('network/internal/ipv4'))
network = ip_interface(f'{interface.ip}/24').network
gateway = network[1]
return {
'systemd': {
'units': {
'internal.network': {
f'Route#hetzner_gateway': {
'Destination': str(gateway),
'Scope': 'link',
},
f'Route#hetzner_network': {
'Destination': str(network),
'Gateway': str(gateway),
},
},
},
},
}

View file

@ -3,6 +3,7 @@
'groups': [ 'groups': [
'backup', 'backup',
'debian-11', 'debian-11',
'hetzner-cloud',
], ],
'bundles': [ 'bundles': [
# 'steam', # 'steam',
@ -20,7 +21,7 @@
'network': { 'network': {
'internal': { 'internal': {
'interface': 'ens10', 'interface': 'ens10',
'ipv4': '10.0.10.3/24', 'ipv4': '10.0.10.3/32',
}, },
'external': { 'external': {
'interface': 'eth0', 'interface': 'eth0',

View file

@ -19,7 +19,7 @@
'network': { 'network': {
'internal': { 'internal': {
'interface': 'ens10', 'interface': 'ens10',
'ipv4': '10.0.10.2/24', 'ipv4': '10.0.10.2/32',
}, },
'external': { 'external': {
'interface': 'eth0', 'interface': 'eth0',