Updates vm-infra-bridge iptables vlan

This change corrects the vm-infra-bridge creation script to set
the iptable rule for masquerade to use the host oam vlan and
updates the vlans to match the multi-tenant site configuration.

Change-Id: If288ed63628658f4e461f512f853b384f0eaeba4
This commit is contained in:
Egler, Jess (je808k) 2021-05-19 15:02:23 -05:00 committed by Andrii Ostapenko
parent 2946a13806
commit 6f6a7d46dc
3 changed files with 12 additions and 12 deletions

View File

@ -44,10 +44,10 @@
# is to ensure that the octet is within the range of the OAM last octet.
# TODO : Need to make the modulo value configurable for future release.
mgmtoctet=$(($octet % 44))
vm_ip_address=$(awk -F"." '{print $1"."$2"."$3"."}'<<<"REPLACEMENT_VM_NETWORK")${mgmtoctet}
echo "Going to use ${vm_ip_address}"
vm_infra_ip_address=$(awk -F"." '{print $1"."$2"."$3"."}'<<<"REPLACEMENT_VM_NETWORK")${mgmtoctet}
echo "Going to use ${vm_infra_ip_address}"
# convert the subnet information to CIDR format
vm_ip_cidr=$(awk -F. '{
vm_infra_ip_cidr=$(awk -F. '{
split($0, octets)
for (i in octets) {
mask += 8 - log(2**8 - octets[i])/log(2);
@ -58,9 +58,9 @@
if ! brctl show | grep -q vm-infra-bridge; then
brctl addbr vm-infra-bridge
ip link set vm-infra-bridge up
ip addr add ${vm_ip_address}${vm_ip_cidr} dev vm-infra-bridge
ip addr add ${vm_infra_ip_address}${vm_infra_ip_cidr} dev vm-infra-bridge
brctl addif vm-infra-bridge REPLACEMENT_VM_INFRA_INTF
fi;
# add iptables postrouting nat
iptables -t nat -A POSTROUTING -s REPLACEMENT_VM_NETWORK${vm_ip_cidr} -o REPLACEMENT_VM_INFRA_INTF -j MASQUERADE
iptables -t nat -A POSTROUTING -s REPLACEMENT_VM_NETWORK${vm_infra_ip_cidr} -o REPLACEMENT_MGMT_INTF -j MASQUERADE
exit 0

View File

@ -44,10 +44,10 @@
# is to ensure that the octet is within the range of the OAM last octet.
# TODO : Need to make the modulo value configurable for future release.
mgmtoctet=$(($octet % 44))
vm_ip_address=$(awk -F"." '{print $1"."$2"."$3"."}'<<<"REPLACEMENT_VM_NETWORK")${mgmtoctet}
echo "Going to use ${vm_ip_address}"
vm_infra_ip_address=$(awk -F"." '{print $1"."$2"."$3"."}'<<<"REPLACEMENT_VM_NETWORK")${mgmtoctet}
echo "Going to use ${vm_infra_ip_address}"
# convert the subnet information to CIDR format
vm_ip_cidr=$(awk -F. '{
vm_infra_ip_cidr=$(awk -F. '{
split($0, octets)
for (i in octets) {
mask += 8 - log(2**8 - octets[i])/log(2);
@ -58,9 +58,9 @@
if ! brctl show | grep -q vm-infra-bridge; then
brctl addbr vm-infra-bridge
ip link set vm-infra-bridge up
ip addr add ${vm_ip_address}${vm_ip_cidr} dev vm-infra-bridge
ip addr add ${vm_infra_ip_address}${vm_infra_ip_cidr} dev vm-infra-bridge
brctl addif vm-infra-bridge REPLACEMENT_VM_INFRA_INTF
fi;
# add iptables postrouting nat
iptables -t nat -A POSTROUTING -s REPLACEMENT_VM_NETWORK${vm_ip_cidr} -o REPLACEMENT_VM_INFRA_INTF -j MASQUERADE
iptables -t nat -A POSTROUTING -s REPLACEMENT_VM_NETWORK${vm_infra_ip_cidr} -o REPLACEMENT_MGMT_INTF -j MASQUERADE
exit 0

View File

@ -6,7 +6,7 @@ metadata:
airshipit.org/deploy-k8s: "false"
spec:
vm_infra_bridge:
host_oam_interface: bond0.41
vm_interface: bond0.45
host_oam_interface: bond0.61
vm_interface: bond0.66
vm_network: 192.168.0.0
vm_network_subnet_mask: 255.255.240.0