Adjust flat networking

This adjusts the VM networking to only create the additional veth pair for the
flat bridge.  Without this the other bridges can get IPs other than those
statically assigned by the DHCP server.  This also adjusts the range to exclude
the statically assigned ranges.

Change-Id: I289e808b5acb68b1c51e05cbe7d914077c20ba1a
This commit is contained in:
d34dh0r53 2018-06-01 15:40:44 -05:00
parent 32194adb72
commit 358be0158e
2 changed files with 4 additions and 2 deletions

View File

@ -20,7 +20,7 @@ dhcp_list:
gateway: 10.0.2.1 # Gateway gateway: 10.0.2.1 # Gateway
dns: 8.8.8.8 # DNS dns: 8.8.8.8 # DNS
subnet: 10.0.0.0 # Subnet mask subnet: 10.0.0.0 # Subnet mask
range_start: 10.0.2.3 # Start of DHCP range range_start: 10.0.2.160 # Start of DHCP range
range_end: 10.0.3.254 # End of DHCP range range_end: 10.0.3.254 # End of DHCP range
broadcast: 10.0.3.255 # Network Broadcast address broadcast: 10.0.3.255 # Network Broadcast address
default_lease_time: 21600 # Subnet Default lease time - The default is used if this is not defined default_lease_time: 21600 # Subnet Default lease time - The default is used if this is not defined

View File

@ -16,7 +16,7 @@ iface br-{{ key }} inet {{ value.inet_type }}
bridge_waitport 10 bridge_waitport 10
bridge_fd 0 bridge_fd 0
offload-sg off offload-sg off
{% if value.iface is defined %} {% if value.iface is defined and key == "flat" %}
pre-up ip link add br-veth-{{ key }} type veth peer name v{{ value.iface }} || true pre-up ip link add br-veth-{{ key }} type veth peer name v{{ value.iface }} || true
# Set both ends UP # Set both ends UP
pre-up ip link set br-veth-{{ key }} up pre-up ip link set br-veth-{{ key }} up
@ -24,6 +24,8 @@ iface br-{{ key }} inet {{ value.inet_type }}
# Delete veth pair on DOWN # Delete veth pair on DOWN
post-down ip link del br-vlan-veth || true post-down ip link del br-vlan-veth || true
bridge_ports {{ value.iface }} br-veth-{{ key }} bridge_ports {{ value.iface }} br-veth-{{ key }}
{% elif value.iface is defined %}
bridge_ports {{ value.iface | default('none') }}
{% else %} {% else %}
bridge_ports none bridge_ports none
{% endif %} {% endif %}