24 lines
382 B
Bash
Executable File
24 lines
382 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# tap0 -> clients (vlan: 2)
|
|
# tap1 -> wan (vlan: 3)
|
|
|
|
VLAN=2
|
|
BRIDGE=switch
|
|
|
|
ifname=$1
|
|
|
|
[ $ifname = "tap1" ] && VLAN=3
|
|
|
|
# associate tap interface with bridge
|
|
ip link set dev $ifname up
|
|
ip link set dev $ifname master $BRIDGE
|
|
|
|
# delete standard vlan
|
|
bridge vlan del dev $ifname vid 1
|
|
|
|
# correctly tag interface
|
|
bridge vlan add dev $ifname vid $VLAN pvid untagged
|