V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zc362227
V2EX  ›  路由器

求教, RouterOS 路由接交换机划分 VLAN 后 DHCP Server 不工作啦,大神帮忙瞧瞧呗!

  •  
  •   zc362227 · 2019-09-16 09:11:40 +08:00 · 4079 次点击
    这是一个创建于 1656 天前的主题,其中的信息可能已经有所发展或是发生改变。

    设备多了,打算划分几个独立的网络,所以开始研究 VLAN,新入了网件 GS108E,网络环境如下:

    路由:Mikrotik RB750GL ( 5 口,最新系统)

    ether1 => 接 GS108E 8 口

    ether2 => 给隔壁亲戚用

    ether4 => 接无线路由器 LAN 口(主 Wi-Fi,无线路由器已关闭 DHCP )

    ether5 => WAN

    交换机 VLAN 划分: VLAN 10: 1 2 3 4 8t => 接电脑 /NAS/盒子 VLAN 30: 5 6 7 8t => 接 NAS 管理端口

    路由的关键配置如下:

    /interface bridge add name=bridge1

    /interface bridge port add interface=ether1 bridge=bridge1 hw=yes add interface=ether2 bridge=bridge1 hw=yes add interface=ether3 bridge=bridge1 hw=yes add interface=ether4 bridge=bridge1 hw=yes

    /interface ethernet switch vlan add independent-learning=no ports=ether1,ether2 switch=switch1 vlan-id=20 add independent-learning=no ports=ether1,ether3,switch1-cpu switch=switch1 vlan-id=30 add independent-learning=no ports=ether1,ether4 switch=switch1 vlan-id=10

    /interface ethernet switch port set ether1 vlan-mode=secure vlan-header=add-if-missing set ether2 vlan-mode=secure vlan-header=always-strip default-vlan-id=20 set ether3 vlan-mode=secure vlan-header=always-strip default-vlan-id=30 set ether4 vlan-mode=secure vlan-header=always-strip default-vlan-id=10 set switch1-cpu vlan-mode=secure vlan-header=leave-as-is

    /interface vlan add name=vlan10 interface=bridge1 vlan-id=10 comment="LAN" add name=vlan20 interface=bridge1 vlan-id=20 comment="Guest" add name=vlan30 interface=bridge1 vlan-id=30 comment="Management"

    /ip address add address=192.168.10.250/24 interface=vlan10 add address=192.168.20.250/24 interface=vlan20 add address=192.168.30.250/24 interface=vlan30

    /ip dhcp-server add address-pool=pool1 lease-time=1d name="dhcp_lan" interface=vlan10 disabled=no add address-pool=pool2 lease-time=12h name="dhcp_guest" interface=vlan20 disabled=no add address-pool=pool2 lease-time=12h name="dhcp_mg" interface=vlan30 disabled=no

    /ip dhcp-server network add address=192.168.10.0/24 gateway=192.168.10.250 dns-server=192.168.10.250 add address=192.168.20.0/24 gateway=192.168.20.250 dns-server=119.29.29.29 add address=192.168.30.0/24 gateway=192.168.30.250 dns-server=192.168.30.250

    现在的问题:

    VLAN 10 下的设备(不管是接路由器 ether4 口还是交换机 1-4 口)获取不到 IP,也 ping 不通 192.168.10.250 VLAN 20 同上 VLAN 30 下的设备能获取到 192.168.30.x IP,能 ping 通 192.168.30.250 ,能上外网

    看了官方 Wiki 与 VLAN 所有有关的页面,放狗搜了不少文章依然没有头绪,希望能在这里得到指点 [拜托]

    5 条回复    2020-05-26 08:50:37 +08:00
    ftr
        1
    ftr  
       2019-09-30 14:10:09 +08:00
    虽然不是很精通
    在 /interface bridge port 和 /interface bridge vlan 里有端口的 vlan 设置
    我的 vlan 好像不是在 /interface ethernet switch 里面配置的。
    仅供参考
    ftr
        2
    ftr  
       2019-09-30 14:11:15 +08:00
    是不是 bridge 的 vlan 和 port 的 vlan 我不是很清楚
    cr0wd
        3
    cr0wd  
       2020-03-31 08:37:28 +08:00 via Android
    那是因为你在配置交换芯片 VLAN 时没有把 switch1-cpu 也加到 VLAN10 、VLAN20 里。
    你在 /interface ethernet switch 中配置的 VLAN 是硬件交换芯片的 VLAN,VLAN 的转发逻辑由交换芯片完成,不经过 CPU (软件)处理。
    switch1-cpu 相当于交换芯片和 CPU 之间的接口,你在配置 VLAN10 和 VLAN20 时没把 switch1-cpu 加入其中,还设置了 vlan-mode=secure,导致 CPU 压根就收不到 VLAN10 、VLAN20 的网络帧。
    cr0wd
        4
    cr0wd  
       2020-03-31 08:42:19 +08:00 via Android
    @ftr /interface bridge vlan 的配置是软件实现的 VLAN ;有些型号的 mikrotik 路由器的交换芯片(硬件)支持 VLAN,对应的配置项在 /interface ethernet switch 里,因为不需要软件处理,转发性能比前者高多了
    zc362227
        5
    zc362227  
    OP
       2020-05-26 08:50:37 +08:00
    @cr0wd 好久没来了,后来也是不死心各种乱试,没想到竟然搞成了,就是你说的那样把 switch1-cpu 加进去就通了,还是要谢谢你哟
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2921 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 14:12 · PVG 22:12 · LAX 07:12 · JFK 10:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.