adding first very very basic old-school vlan support

This commit is contained in:
root 2019-02-14 08:34:11 +00:00
parent 5363feff09
commit 30ac6534a3
1 changed files with 12 additions and 6 deletions

View File

@ -11,20 +11,26 @@ fi
LOOPBACKIP=$(ip -4 addr show dev lo | grep -Po 'inet \K[\d.]+' | grep -v "^127.0.0.1$")
BRIDGE=br${CLUSTER}
VXLAN=vxlan${CLUSTER}
VNI=${CLUSTER}
VIF=vxlan${CLUSTER}
[ -z ${PARENTIF:=""} ] || VIF=vlan${CLUSTER} ### if we have a parentif set we're just going to handle it as a legacy old school vlan
ip link set up ${IFACE}
if ! ip link show dev ${VXLAN} &>/dev/null; then
ip link add ${VXLAN} type vxlan id ${VNI} dstport 4789 local ${LOOPBACKIP} nolearning
ip link set up ${VXLAN}
if ! ip link show dev ${VIF} &>/dev/null; then
if [ -z ${PARENTIF:=""} ]
then
ip link add ${VIF} type vxlan id ${CLUSTER} dstport 4789 local ${LOOPBACKIP} nolearning
else
ip link add link ${PARENTIF} name vlan${CLUSTER} type vlan protocol 802.1q id ${CLUSTER}
fi
ip link set up ${VIF}
fi
if ! ip link show dev ${BRIDGE} &>/dev/null; then
brctl addbr ${BRIDGE}
brctl stp ${BRIDGE} off
brctl addif ${BRIDGE} ${VXLAN}
brctl addif ${BRIDGE} ${VIF}
ip link set up dev ${BRIDGE}
bridge vlan del dev ${BRIDGE} vid 1 self
echo 1 >/sys/class/net/${BRIDGE}/bridge/vlan_filtering