adding first very very basic old-school vlan support
This commit is contained in:
parent
5363feff09
commit
30ac6534a3
|
@ -11,20 +11,26 @@ fi
|
||||||
|
|
||||||
LOOPBACKIP=$(ip -4 addr show dev lo | grep -Po 'inet \K[\d.]+' | grep -v "^127.0.0.1$")
|
LOOPBACKIP=$(ip -4 addr show dev lo | grep -Po 'inet \K[\d.]+' | grep -v "^127.0.0.1$")
|
||||||
BRIDGE=br${CLUSTER}
|
BRIDGE=br${CLUSTER}
|
||||||
VXLAN=vxlan${CLUSTER}
|
VIF=vxlan${CLUSTER}
|
||||||
VNI=${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}
|
ip link set up ${IFACE}
|
||||||
|
|
||||||
if ! ip link show dev ${VXLAN} &>/dev/null; then
|
if ! ip link show dev ${VIF} &>/dev/null; then
|
||||||
ip link add ${VXLAN} type vxlan id ${VNI} dstport 4789 local ${LOOPBACKIP} nolearning
|
if [ -z ${PARENTIF:=""} ]
|
||||||
ip link set up ${VXLAN}
|
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
|
fi
|
||||||
|
|
||||||
if ! ip link show dev ${BRIDGE} &>/dev/null; then
|
if ! ip link show dev ${BRIDGE} &>/dev/null; then
|
||||||
brctl addbr ${BRIDGE}
|
brctl addbr ${BRIDGE}
|
||||||
brctl stp ${BRIDGE} off
|
brctl stp ${BRIDGE} off
|
||||||
brctl addif ${BRIDGE} ${VXLAN}
|
brctl addif ${BRIDGE} ${VIF}
|
||||||
ip link set up dev ${BRIDGE}
|
ip link set up dev ${BRIDGE}
|
||||||
bridge vlan del dev ${BRIDGE} vid 1 self
|
bridge vlan del dev ${BRIDGE} vid 1 self
|
||||||
echo 1 >/sys/class/net/${BRIDGE}/bridge/vlan_filtering
|
echo 1 >/sys/class/net/${BRIDGE}/bridge/vlan_filtering
|
||||||
|
|
Loading…
Reference in New Issue