mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-11-02 14:51:05 +00:00
This add support to enable vlan aware bridge,
and management interfaces
example: 1 bridge and 1 administration port on vlan 100
auto vmbr0
iface vmbr0 inet manual
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_vlan_aware yes
bridge_vids 10-15
auto vmbr0.100
iface vmbr0.100 inet static
address X.X.X.X
netmask 255.255.255.0
gateway X.X.X.X
bridge_vids is optional, and allow on the specified vlans.(current take 1 value or range, need to be improve with list)
If not specified, the allowed vlan are 2-4094.
vlan 1 is the default pvid. (all untagged traffic is going to this vlan).
scripts:
- /etc/network/if-up.d/bridgevlan
manage bridge vlan aware configuration
- /etc/network/if-up.d/bridgevlanport
manage bridge vlan admin port
-/etc/network/if-pre-up.d/vlan
-/etc/network/if-post-down.d/vlan
replace current vlan package, without vconfig usage and cleanups
It's only needed to create vlan interface from bridge_ports.
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
41 lines
1.1 KiB
Bash
Executable File
41 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Most of this stuff is to enable vlans, it's really only needed by bridge_utils
|
|
case "$IFACE" in
|
|
# Ignore any alias (#272891) which uses <interface>:<alabel>
|
|
*:*)
|
|
exit 0
|
|
;;
|
|
vlan[0-9]*)
|
|
VLANID=`echo $IFACE|sed "s/vlan*//"`
|
|
;;
|
|
*.[0-9]*)
|
|
# Silently ignore interfaces which ifupdown handles on its own
|
|
# If IF_BRIDGE_PORTS is set, probably we're called by bridge-utils
|
|
[ -z "$IF_VLAN_RAW_DEVICE" -a -z "$IF_BRIDGE_PORTS" ] && exit 0
|
|
VLANID=`echo $IFACE|sed "s/[a-zA-Z0-9]*\.//g"`
|
|
IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\([a-zA-Z0-9]*\)\..*/\1/"`
|
|
;;
|
|
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
if [ -n "$IF_VLAN_RAW_DEVICE" ]; then
|
|
if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null; then
|
|
echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE"
|
|
exit 1
|
|
fi
|
|
if [ ! -e "/sys/class/net/$IFACE" ]; then
|
|
ip link set up dev $IF_VLAN_RAW_DEVICE
|
|
ip link add link $IF_VLAN_RAW_DEVICE name $IFACE type vlan id $VLANID
|
|
fi
|
|
|
|
fi
|
|
|
|
# This is not vlan specific, and should actually go somewhere else.
|
|
if [ -n "$IF_HW_MAC_ADDRESS" ]; then
|
|
ip link set $IFACE address $IF_HW_MAC_ADDRESS
|
|
fi
|