找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 11077|回复: 12

哪位大侠能帮我讲解一下openwrt里面vlan的划分

[复制链接]
我现在用db120-wg,跑的是openwrt r18xxx
network分配
  1. root@OpenWrt:~# cat /etc/config/network
  2. # Copyright (C) 2008 OpenWrt.org

  3. config interface loopback
  4.         option ifname   lo
  5.         option proto    static
  6.         option ipaddr   127.0.0.1
  7.         option netmask  255.0.0.0

  8. config interface lan
  9.         option type     bridge
  10.         option ifname   eth1
  11.         option proto    static
  12.         option ipaddr   192.168.2.1
  13.         option netmask  255.255.255.0
  14.         option nat      1

  15. config interface wan
  16.         option ifname   eth0
  17.         option proto    dhcp
复制代码
switch分配
  1. root@OpenWrt:~# robocfg show
  2. probing eth1
  3. Switch: enabled
  4. Port 0(W):  DOWN enabled stp: none vlan: 1 mac: 00:00:00:00:00:00
  5. Port 1(4):  DOWN enabled stp: none vlan: 1 mac: 00:00:00:00:00:00
  6. Port 2(3):  DOWN enabled stp: none vlan: 1 mac: 00:00:00:00:00:00
  7. Port 3(2):  DOWN enabled stp: none vlan: 1 mac: 00:00:00:00:00:00
  8. Port 4(1):  DOWN enabled stp: none vlan: 1 mac: 00:00:00:00:00:00
  9. Port 5(C): 100FD enabled stp: none vlan: 1 mac: 00:00:00:00:00:00
  10. VLANs: BCM5325/535x disabled mac_check mac_hash
复制代码
默认状态LAN4,已经是wan口。我想把LAN1,LAN2划分为LAN口,LAN3也划分为WAN口,怎么分配?
  1. # Copyright (C) 2008 OpenWrt.org

  2. config switch eth1
  3.         option vlan0        "0 5*"
  4.         option vlan1        "1 5*"
  5.         option vlan2        "2 5*"
  6.         option vlan3        "3 5*"

  7. config interface loopback
  8.         option ifname   lo
  9.         option proto    static
  10.         option ipaddr   127.0.0.1
  11.         option netmask  255.0.0.0

  12. config interface lan
  13.         option type     bridge
  14.         option ifname   "eth1.0"
  15.         option proto    static
  16.         option ipaddr   192.168.2.1
  17.         option netmask  255.255.255.0
  18.         option nat      1

  19. config interface lan2
  20.         option type     bridge
  21.         option ifname   "eth1.1"
  22.         option proto    static
  23.         option ipaddr   192.168.10.1
  24.         option netmask  255.255.255.0
  25.         option nat      1
  26.                

  27. config interface wan
  28.         option ifname        eth0
  29.         option proto        dhcp

  30. config interface wan2
  31.         option ifname        "eth1.2"
  32.         option proto        dhcp
复制代码
 楼主| | 显示全部楼层
看到有的文章写的是option vlan0        "0 5*"
也要的是option vlan0        "0 5t"

这个*和这个t有撒区别?
回复

使用道具 举报

 楼主| | 显示全部楼层
看到最近的openwrt svn里面vlan划分有问题,需要重新用robocfg分一下
回复

使用道具 举报

是直接运行robocfg?要不要其它参数?
新版的vlan和QoS都有问题
回复

使用道具 举报

 楼主| | 显示全部楼层
robocfg是这样的。但是x-wrt里面设置貌似还是不对。
  1. robocfg switch disable
  2. robocfg vlans enable reset
  3. robocfg vlan 0 ports "0 5t"
  4. robocfg vlan 1 ports "1 5t"
  5. robocfg vlan 2 ports "2 5t"
  6. robocfg vlan 3 ports "3 5t"
  7. robocfg switch enable
复制代码
回复

使用道具 举报

按我的理解,应该如下:

config switch eth1
        option vlan0        "0 5*"
        option vlan1        "1 5*"
        option vlan2        "2 3 5*"
#0口对应lan4,1口对应lan3,2口对应lan2,3口对应lan1
config interface loopback
        option ifname   lo
        option proto    static
        option ipaddr   127.0.0.1
        option netmask  255.0.0.0
config interface lan
        option type     bridge
        option ifname   ’eth1.2‘
        option proto    static
        option ipaddr   192.168.2.1
        option netmask  255.255.255.0
        option nat      1
config interface wan1
        option ifname eth1.0
        option proto        dhcp
config interface wan2
       option ifname  eth1.1
        option proto        dhcp
回复

使用道具 举报

 楼主| | 显示全部楼层
To foureyer
那原本那个eth0呢?不需要了?
你这么分的,都是在eth1 里面的。VLANs: BCM5325/535x
LAN4 是走cpu的
回复

使用道具 举报

 楼主| | 显示全部楼层
划分过vlan后,x-wrt里面network-interface就只能看到eth0了。
  1. # Copyright (C) 2008 OpenWrt.org

  2. config switch eth1
  3.         option vlan0        "0 5*"
  4.         option vlan1        "1 5*"
  5.         option vlan2        "2 3 5*"

  6. config interface loopback
  7.         option ifname   lo
  8.         option proto    static
  9.         option ipaddr   127.0.0.1
  10.         option netmask  255.0.0.0

  11. config interface lan
  12.         option type     bridge
  13.         option ifname   "eth1.2"
  14.         option proto    static
  15.         option ipaddr   192.168.2.1
  16.         option netmask  255.255.255.0
  17.         option nat      1

  18. config interface wan
  19.         option ifname        "eth1.0"
  20.         option proto        dhcp

  21. config interface wan2
  22.         option ifname        "eth1.1"
  23.         option proto        dhcp
复制代码
  1. /etc/init.d/network restart
复制代码
  1. robocfg switch disable
  2. robocfg vlans enable reset
  3. robocfg vlan 0 ports "0 5t"
  4. robocfg vlan 1 ports "1 5t"
  5. robocfg vlan 2 ports "2 3 5t"
  6. robocfg switch enable
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
回复

使用道具 举报

系统默认是有2个lan的,一个是eth1,一个是eth0,eth0是给cpu用的,要划分vlan只能在eth1上划。
回复

使用道具 举报

我的rg100a-aa  刷 openwrt---r17079-openwrt-rg100a-squashfs-bc310.bin这 版本,vlan 也是高的头大, 现在 就是 不能 无线中继
回复

使用道具 举报

 楼主| | 显示全部楼层
系统默认是有2个lan的,一个是eth1,一个是eth0,eth0是给cpu用的,要划分vlan只能在eth1上划。
foureyer 发表于 2009-12-24 18:12



从/etc/config/network里面看出,默认eth0是wan,eth1是lan
eth1 走的是5325芯片,可以划分vlan

但是即使你eth1里面分vlan,robocfg分好。x-wrt里面还是看不到啊。是不是x-wrt的bug?
回复

使用道具 举报

使用18405的Luci没这个问题!
回复

使用道具 举报

求7231-4p的端口映射关系~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-5-10 16:08

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表