Chon · 翀

The Neverland Blog

OpenWrt

Multi WAN

$ opkg update
$ opkg install kmod-macvlan
$ opkg install mwan3 luci-app-mwan3
wan=wan
num=4
username=''
password=''

for i in $(seq 1 $num); do
  uci set network.vwan${i}=interface
  uci set network.vwan${i}.proto=pppoe
  uci set network.vwan${i}.ifname=vwan${i}
  uci set network.vwan${i}.username=${username}
  uci set network.vwan${i}.password=${password}
  uci set network.vwan${i}.metric=${i}
  uci add_list firewall.@zone[1].network=vwan${i}

  ip link add link ${wan} name vwan${i} type macvlan
  ifconfig vwan${i} up
done

uci commit network
/etc/init.d/network restart
# -- mwan begin
wan=wan
num=4
for i in $(seq 1 $num); do
  ip link add link ${wan} name vwan${i} type macvlan
  ifconfig vwan${i} up
done
# -- mwan end