Chinaunix首页 | 论坛 | 博客
  • 博客访问: 695033
  • 博文数量: 79
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1338
  • 用 户 组: 普通用户
  • 注册时间: 2012-06-12 08:51
个人简介

XMU->九天揽月->五湖抓鳖->DSP->driver->kernel/OpenWRT->ISP/RTOS

文章分类

全部博文(79)

文章存档

2020年(2)

2018年(3)

2016年(7)

2015年(42)

2014年(25)

分类: LINUX

2015-05-18 18:54:32

atheros ar71xx是OpenWRT最常见的芯片方案。
以WR841为例,WR841这种简单的方案,switch、lan、wan是绑定的,
switch的port口 0 1 2 3 4
0是固定和cpu的eth0相关联,作为wan口,这个固定是软件更改不了的
1 2 3 4汇聚到port0与cpu的eth1相关联,作为lan口。cpu如何区分是lan还是wan,就通过vlan。
wan的报文没有vlan,而lan口的四个port都会被switch打上vlanid=1的标签到达cpu。

所以再加一个wan2口,只能从lan的4个port中分出一个。
例如用port 2作为wan2口,得为它分配一个新vlanid 2
同时保持port 1 3 4 的vlanid分配为1。
UCI config如下

  1. config interface 'loopback'
  2. option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

    config interface 'lan'
    option ifname 'eth1.1'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'

    config interface 'wan1'
    option ifname 'eth0'
    option proto 'static'
    option ipaddr 1.1.1.1
    option netmask 255.255.255.0

    config interface 'wan2'
    option ifname 'eth1.2'
    option proto 'static'
    option ipaddr 2.2.2.2
    option netmask 255.255.255.0
    option macaddr 'C6:6B:08:65:12:30'

    config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'
    option enable_vlan '2'

    config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '1 3 4 0t' 

    config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '2 0t'
在linux系统,eth1.X缺省含义是专用于接受vlanid=X报文的虚拟接口。

阅读(5468) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~