Ferrets家的Wordpress

multiwan

OpenWRT上使用macvlan

2012年2月11日 by Ferrets Leave a Comment

这个东西是多拨的基础,嗯,虽然我对多拨没有兴趣,但是对这个单线多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好了~

Posted in: OpenWrt Tagged: macvlan, multiwan, OpenWrt

日历

2021年4月
一二三四五六日
 1234
567891011
12131415161718
19202122232425
2627282930 
« 2月    

分类

  • Android
  • docker
  • Linux
  • OpenWrt
  • PHP
  • RaspberryPi
  • RouterOS
  • Windows
  • 吐槽
  • 搭建服务
  • 未分类
  • 生活
  • 网络

近期文章

  • windows无法解析域名
  • 在openwrt路由上运行shairplay作为远程音箱
  • 建立私有docker镜像源
  • RouterOS上抵挡扫描的防火墙策略
  • Windows Server作为Mikrotik设备管理员的3A服务器
  • 使用ipv6连接Proxmox VE
  • 根据audit.log来放通SELinux的拦截
  • 使用PXE从NFS服务器启动Debian Linux
  • 在运行ArchlinuxARM的PogoPlug上打开CPU的AES硬件加速
  • 增大mysql/mariadb的最大连接数

友链

  • ntzyz's space
  • Openwrt中文论坛
  • SNGR
  • Trevikids行止由心
  • 煎蛋

文章归档

功能

  • 登录
  • 条目feed
  • 评论feed
  • WordPress.org

Copyright © 2021 Ferrets家的Wordpress.

Beta WordPress Theme by themehall.com