标签归档:multiwan

OpenWRT上使用macvlan

这个东西是多拨的基础,嗯,虽然我对多拨没有兴趣,但是对这个单线多WAN的技术相当感兴趣,于是稍微研究了一下,折腾了一阵子终于成功了。

参考:

使用macvlan+multiwan 单线多拨 教程 

 

首先,安装软件包:

opkg install kmod-macvlan

会顺便装上另外一些基础包。

然后就是创建虚拟的物理网卡

ip link add link eth1 eth2 type macvlan

ifconfig eth2 hw ether 00:11:22:33:44:55

ifconfig eth2 up

注意上面的eth1对应你打算创建虚拟网卡的物理网卡(就是插着线的个网卡),eth2是新建的虚拟网卡,当然你也可以写成eth3,eth4等,就看你建多少个网卡了。

因为每次重启这个虚拟的网卡都会消失,所以就把自己写的命令加到/etc/rc.local里面去,以便每次启动就自动加载。

接下来就是新建wan口的事情了,比较推荐在luci下操作,因为比较直观,如果想靠命令行的话,就手动修改/etc/config/network,按照以下格式增加wan口。

wan口使用dhcp获得地址:

config ‘interface’ ‘wan2’

option ‘ifname’ ‘eth2’

option ‘proto’ ‘dhcp’

或者是用静态IP:

config ‘interface’ ‘wan2’

option ‘ifname’ ‘eth2’

option ‘proto’ ‘static’

option ‘ipaddr’ ‘192.168.1.51’

option ‘mask’ ‘255.255.255.0’

option ‘gateway’ ‘192.168.1.1’

option ‘dns’ ‘192.168.1.1’

或者是pppoe

config ‘interface’ ‘wan2’

option ‘ifname’ ‘eth2’

option ‘proto’ ‘pppoe’

option ‘username’ ‘username’

option ‘password’ ‘password’

option ‘defaultroute’ ‘1’

option ‘peerdns’ ‘1’

呵呵~想想我们学校……啧~刚好入手一只WZR-HP-AG300H,千兆网口什么的完全不能发挥作用啊,干脆就建10个wan好了~