Properly fix IPv4 no-DHCP networking

This commit is contained in:
Joshua Boniface 2020-01-06 22:31:37 -05:00
parent 589b2b1677
commit f326fd99e2
1 changed files with 6 additions and 3 deletions

View File

@ -660,7 +660,6 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
'--leasefile-ro', '--leasefile-ro',
'--dhcp-script={}/pvcd/dnsmasq-zookeeper-leases.py'.format(os.getcwd()), '--dhcp-script={}/pvcd/dnsmasq-zookeeper-leases.py'.format(os.getcwd()),
'--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir), '--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir),
'--interface={}'.format(self.bridge_nic),
'--bind-interfaces', '--bind-interfaces',
] ]
dhcp_configuration_v4 = [ dhcp_configuration_v4 = [
@ -669,6 +668,8 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
'--auth-peer={}'.format(self.ip4_gateway), '--auth-peer={}'.format(self.ip4_gateway),
'--auth-server={}'.format(self.ip4_gateway), '--auth-server={}'.format(self.ip4_gateway),
'--auth-sec-servers={}'.format(self.ip4_gateway), '--auth-sec-servers={}'.format(self.ip4_gateway),
]
dhcp_configuration_v4_dhcp = [
'--dhcp-option=option:ntp-server,{}'.format(self.ip4_gateway), '--dhcp-option=option:ntp-server,{}'.format(self.ip4_gateway),
'--dhcp-range={},{},48h'.format(self.dhcp4_start, self.dhcp4_end), '--dhcp-range={},{},48h'.format(self.dhcp4_start, self.dhcp4_end),
] ]
@ -690,14 +691,16 @@ add rule inet filter forward ip6 saddr {netaddr6} counter jump {vxlannic}-out
# Assemble the DHCP configuration # Assemble the DHCP configuration
dhcp_configuration = dhcp_configuration_base dhcp_configuration = dhcp_configuration_base
if self.dhcp4_flag:
dhcp_configuration += dhcp_configuration_v4
if self.dhcp6_flag: if self.dhcp6_flag:
dhcp_configuration += dhcp_configuration_v6 dhcp_configuration += dhcp_configuration_v6
if self.dhcp4_flag: if self.dhcp4_flag:
dhcp_configuration += dhcp_configuration_v6_dualstack dhcp_configuration += dhcp_configuration_v6_dualstack
else: else:
dhcp_configuration += dhcp_configuration_v6_only dhcp_configuration += dhcp_configuration_v6_only
else:
dhcp_configuration += dhcp_configuration_v4
if self.dhcp4_flag:
dhcp_configuration += dhcp_configuration_v4_dhcp
# Start the dnsmasq process in a thread # Start the dnsmasq process in a thread
print('/usr/sbin/dnsmasq {}'.format(' '.join(dhcp_configuration))) print('/usr/sbin/dnsmasq {}'.format(' '.join(dhcp_configuration)))