Большое спасибо, Etch!
Вот так всё работает:ip_tap0="192.168.0.10"
ip_tap1="192.168.1.20"
ip_tap2="192.168.2.30"
killall -9 vde_switch
# reset interfaces
ip link del tap0 2>/dev/null || :
ip link del tap1 2>/dev/null || :
ip link del tap2 2>/dev/null || :
# create interfaces
#vde_tunctl -t tap0
#vde_tunctl -t tap1
#vde_tunctl -t tap2
tunctl -u user -t tap0
tunctl -u user -t tap1
tunctl -u user -t tap2
# assign addresses
ip addr add $ip_tap0/24 dev tap0
ip addr add $ip_tap1/24 dev tap1
ip addr add $ip_tap2/24 dev tap2
# put ifs up
ip link set tap0 up
ip link set tap1 up
ip link set tap2 up
# lower priority of kernel local table to 500
ip rule del pref 0 lookup local 2>/dev/null || :
ip rule del pref 500 lookup local 2>/dev/null || :
ip rule add pref 500 lookup local
# on rx side handle packets by local table, so we can receive them
ip rule del pref 10 2>/dev/null || :
ip rule del pref 11 2>/dev/null || :
ip rule del pref 12 2>/dev/null || :
ip rule add pref 10 iif tap0 lookup local
ip rule add pref 11 iif tap1 lookup local
ip rule add pref 12 iif tap2 lookup local
# tx
ip rule del pref 100 2>/dev/null || :
ip rule del pref 101 2>/dev/null || :
ip rule del pref 102 2>/dev/null || :
ip rule add pref 100 from $ip_tap0 lookup 100
ip rule add pref 101 from $ip_tap1 lookup 101
ip rule add pref 102 from $ip_tap2 lookup 102
ip route flush table 100
ip route flush table 101
ip route flush table 102
ip route add default dev tap0 protocol static table 100
ip route add default dev tap1 protocol static table 101
ip route add default dev tap2 protocol static table 102
ip route flush cache
# ensure (visually) we've set up it ok
echo
echo " >>> rules:"
ip rule
echo
echo " >>> tap(0|1) routing table:"
ip route show table all | grep '\<tap\(0\|1\)\>'
# tx path
echo
echo " >>> checking routing for tx path:"
ip route get $ip_tap0 connected
ip route get $ip_tap1 connected
ip route get $ip_tap2 connected
# rx path
echo
echo " >>> checking routing for rx path:"
ip route get from $ip_tap1 to $ip_tap0 iif tap0
ip route get from $ip_tap2 to $ip_tap0 iif tap0
# start switch and connect switch-tap0 and switch-tap1
echo
echo " >>> ready to start vde_switch and connect wires..."
vde_switch &
vde_plug2tap tap0 &
vde_plug2tap tap1 &
vde_plug2tap tap2 &
# for test
konsole -e tcpdump -i tap0
konsole -e ping $ip_tap1 -I $ip_tap0
konsole -e ping $ip_tap2 -I $ip_tap0