V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
yiluqingshen
V2EX  ›  宽带症候群

二层交换机配置无法上网的问题

  •  
  •   yiluqingshen · 120 天前 · 1238 次点击
    这是一个创建于 120 天前的主题,其中的信息可能已经有所发展或是发生改变。
    1 、这是交换机 VLAN 配置信息:

    [H3C]dis vlan
    Total VLANs: 25
    The VLANs include:
    1(default), 101-124

    2 、配置信息:

    [H3C]dis int br
    Brief information on interfaces in route mode:
    Link: ADM - administratively down; Stby - standby
    Protocol: (s) - spoofing
    Interface Link Protocol Primary IP Description
    InLoop0 UP UP(s) --
    NULL0 UP UP(s) --
    Vlan1 DOWN DOWN 192.168.0.233

    Brief information on interfaces in bridge mode:
    Link: ADM - administratively down; Stby - standby
    Speed: (a) - auto
    Duplex: (a)/A - auto; H - half; F - full
    Type: A - access; T - trunk; H - hybrid
    Interface Link Speed Duplex Type PVID Description
    GE1/0/1 DOWN auto A A 101
    GE1/0/2 DOWN auto A A 102
    GE1/0/3 DOWN auto A A 103
    GE1/0/4 DOWN auto A A 104
    GE1/0/5 DOWN auto A A 105
    GE1/0/6 DOWN auto A A 106
    GE1/0/7 DOWN auto A A 107
    GE1/0/8 DOWN auto A A 108
    GE1/0/9 DOWN auto A A 109
    GE1/0/10 DOWN auto A A 110
    GE1/0/11 DOWN auto A A 111
    GE1/0/12 DOWN auto A A 112
    GE1/0/13 DOWN auto A A 113
    GE1/0/14 DOWN auto A A 114
    GE1/0/15 DOWN auto A A 115
    GE1/0/16 DOWN auto A A 116
    GE1/0/17 DOWN auto A A 117
    GE1/0/18 DOWN auto A A 118
    GE1/0/19 DOWN auto A A 119
    GE1/0/20 DOWN auto A A 120
    GE1/0/21 DOWN auto A A 121
    GE1/0/22 DOWN auto A A 122
    GE1/0/23 DOWN auto A A 123
    GE1/0/24 DOWN auto A A 124
    GE1/0/25 DOWN auto A A 1
    GE1/0/26 DOWN auto A A 1
    GE1/0/27 DOWN auto A A 1
    GE1/0/28 DOWN auto A T 1

    ----------------------------------------------------------------------
    华三二层交换机(型号:5024pv3-EI ),1-24 口划分 VLAN 101-124 为 access 口,28 口划分为 trunk 口连接路由器,无法上网,是什么意思呢?怎么解决?
    交换机如果复位用默认 VLAN 1 ,又可以上网。
    是不是二屋交换机不具有划分 VLAN 后不具有上网的属性啊? 在线等各位大神解答。
    38 条回复    2024-01-02 22:13:52 +08:00
    Soo0
        1
    Soo0  
       120 天前 via iPhone
    28 trunk 配置可通过 vlan ,不知道你是什么路由器,路由器中起对应的子接口 vlan 及 ip?
    hxsf
        2
    hxsf  
       120 天前
    你可能需要的是端口隔离( port-isolate )?
    然后配合路由器上的三层隔离
    youdoit
        3
    youdoit  
       120 天前
    大哥啊,你几台交换机还没有好啊

    应该直接给 dis cu 吧

    我猜测你没有配置默认路由
    Oohuo
        4
    Oohuo  
       120 天前
    一、默认 vlan1 傻瓜交换机, 他就是当 hub 用的,只要路由器出来的口子能上网,插上去就能用

    二、划分 VLAN
    1 、路由器、交换机划分 VLAN ,网关在路由器,交换机 trunk 连路由器,每个口子 access 不同 VLAN ,也能用
    2 、路由器、交换机划分 VLAN ,网关在交换机。需要在路由器和交换机起互联地址、配置路由
    yiluqingshen
        5
    yiluqingshen  
    OP
       120 天前
    @youdoit 路由器是装宽带 送的路由器(中兴 E2633 ),网关是 192.168.52.1 ,这台 2 层交换机怎么配置,二层交换机好像不能获取 DHCP 吧?
    yiluqingshen
        6
    yiluqingshen  
    OP
       120 天前
    @Oohuo 意思是 28 口( trunk 口)连接上面家用 E2633 路由器,其它任一 1-24 口( access 口)连接电脑,这样我试过了 ,不能上网。
    家用 E2633 不能划分 VLAN 的,TPLINK 的 802.1Q 为什么可以,1-7 口分别划分 VLAN ,几个口分别设置 PVID 可以上网的,也试过了。
    机制应该类似,但是这台华三不太会弄了,
    yiluqingshen
        7
    yiluqingshen  
    OP
       120 天前
    sysname H3C
    #
    telnet server enable
    #
    irf mac-address persistent timer
    irf auto-update enable
    undo irf link-delay
    irf member 1 priority 1
    #
    lldp global enable
    #
    password-recovery enable
    #
    vlan 1
    #
    vlan 101 to 124
    #
    interface NULL0
    #
    interface Vlan-interface1
    ip address dhcp-alloc
    dhcp client identifier ascii 3cd2e5e72fb5-VLAN0001
    #
    interface GigabitEthernet1/0/1
    port access vlan 101
    #
    interface GigabitEthernet1/0/2
    port access vlan 102
    #
    interface GigabitEthernet1/0/3
    port access vlan 103
    #
    interface GigabitEthernet1/0/4
    port access vlan 104
    #
    interface GigabitEthernet1/0/5
    port access vlan 105
    #
    interface GigabitEthernet1/0/6
    port access vlan 106
    #
    interface GigabitEthernet1/0/7
    port access vlan 107
    #
    interface GigabitEthernet1/0/8
    port access vlan 108
    #
    interface GigabitEthernet1/0/9
    port access vlan 109
    #
    interface GigabitEthernet1/0/10
    port access vlan 110
    #
    interface GigabitEthernet1/0/11
    port access vlan 111
    #
    interface GigabitEthernet1/0/12
    port access vlan 112
    #
    interface GigabitEthernet1/0/13
    port access vlan 113
    #
    interface GigabitEthernet1/0/14
    port access vlan 114
    #
    interface GigabitEthernet1/0/15
    port access vlan 115
    #
    interface GigabitEthernet1/0/16
    port access vlan 116
    #
    interface GigabitEthernet1/0/17
    port access vlan 117
    #
    interface GigabitEthernet1/0/18
    port access vlan 118
    #
    interface GigabitEthernet1/0/19
    port access vlan 119
    #
    interface GigabitEthernet1/0/20
    port access vlan 120
    #
    interface GigabitEthernet1/0/21
    port access vlan 121
    #
    interface GigabitEthernet1/0/22
    port access vlan 122
    #
    interface GigabitEthernet1/0/23
    port access vlan 123
    #
    interface GigabitEthernet1/0/24
    port access vlan 124
    #
    interface GigabitEthernet1/0/25
    #
    interface GigabitEthernet1/0/26
    #
    interface GigabitEthernet1/0/27
    #
    interface GigabitEthernet1/0/28
    port link-type trunk
    port trunk permit vlan all
    #
    scheduler logfile size 16
    #
    line class aux
    authentication-mode scheme
    user-role network-admin
    #
    line class vty
    authentication-mode scheme
    user-role network-operator
    #
    line aux 0
    user-role network-admin
    #
    line vty 0 63
    user-role network-operator
    #
    snmp-agent
    snmp-agent local-engineid 800063A2803CD2E5E72FC000000001
    snmp-agent community write private
    snmp-agent community read public
    snmp-agent sys-info version all
    #
    domain system
    #
    domain default enable system
    #
    role name level-0
    description Predefined level-0 role
    #
    role name level-1
    description Predefined level-1 role
    #
    role name level-2
    description Predefined level-2 role
    #
    role name level-3
    description Predefined level-3 role
    #
    role name level-4
    description Predefined level-4 role
    #
    role name level-5
    description Predefined level-5 role
    #
    role name level-6
    description Predefined level-6 role
    #
    role name level-7
    description Predefined level-7 role
    #
    role name level-8
    description Predefined level-8 role
    #
    role name level-9
    description Predefined level-9 role
    #
    role name level-10
    description Predefined level-10 role
    #
    role name level-11
    description Predefined level-11 role
    #
    role name level-12
    description Predefined level-12 role
    #
    role name level-13
    description Predefined level-13 role
    #
    role name level-14
    description Predefined level-14 role
    #
    user-group system
    yiluqingshen
        8
    yiluqingshen  
    OP
       120 天前
    朋友们,看看 dis cu 配置信息,是什么问题,欢迎大佬分析指正。
    youdoit
        9
    youdoit  
       120 天前
    大哥配置一个默认路由吧
    ScotGu
        10
    ScotGu  
       120 天前
    1-24 独立 VLAN 我理解,但是 28 口 trunk 后的路由设备有对应的 VLAN 么? VLAN 里配置对应的互联(网关) IP 了么?
    Soo0
        11
    Soo0  
       120 天前 via iPhone
    上联路由是家用的?不支持子接口?交换机这么多 VLAN 的目的是为了什么?
    hefish
        12
    hefish  
       120 天前
    家里搞这么多 vlan 啊。。。仰视一下。
    xdzhang
        13
    xdzhang  
       120 天前
    没搞懂这样配的目的。
    Soo0
        14
    Soo0  
       120 天前 via iPhone
    @xdzhang 看交换机配置像是打算汇聚宽带跑 PCDN ,跟他的描述又不一样,不知道他到底啥目的😂
    wuxiao2522
        15
    wuxiao2522  
       120 天前
    你需要的是端口隔离,而非每个口划一个 vlan 。否则每个 vlan 需配置一个网关。
    wuxiao2522
        16
    wuxiao2522  
       120 天前
    interface Vlan-interface101
    ip address 192.168.101.1/24
    interface Vlan-interface102
    ip address 192.168.102.1/24
    interface Vlan-interface10x
    ip address 192.168.1.10x.1/24

    ...

    ip rooute 0.0.0.0 0.0.0.0 出口网关 ip 0---默认路由
    wuxiao2522
        17
    wuxiao2522  
       120 天前
    额,没看到你这是二层交换,那我上面写的就无效了。恢复初始化,启用端口隔离吧。
    yiluqingshen
        18
    yiluqingshen  
    OP
       120 天前
    @wuxiao2522 谢谢朋友 ,如你所说我需要的应该是“基于 VLAN 的端口隔离”。
    前面配置确实如 @Soo0 所说准备跑 PCDN 的,目前正在准宽带中,把这交换机来练练手,跟你们学习 1 下。
    yiluqingshen
        19
    yiluqingshen  
    OP
       120 天前
    以下是官方文档的内容:


    配置步骤
    # 创建三个端口组 VLAN ,并将端口 Ethernet1/0/1 、Ethernet1/0/2 、Ethernet1/0/3 、Ethernet1/0/4 、Ethernet1/0/5 分别加入到三个端口组 VLAN 。

    <Device> system-view

    [Device] port-group-vlan 2 to 4

    [Device] port-group-vlan 2 Ethernet 1/0/1 to Ethernet 1/0/2

    [Device] port-group-vlan 2 Ethernet 1/0/6

    [Device] port-group-vlan 3 Ethernet 1/0/3 to Ethernet 1/0/4

    [Device] port-group-vlan 3 Ethernet 1/0/6

    [Device] port-group-vlan 4 Ethernet 1/0/5

    [Device] port-group-vlan 4 Ethernet 1/0/6

    [Device] undo port-group-vlan 1 Ethernet 1/0/1 to Ethernet 1/0/5

    # 显示端口组 VLAN 的信息。

    <Device> display port-group-vlan all

    Port-group-vlan ID: 1

    Port-group-group Ports:

    Ethernet1/0/6 Ethernet1/0/7 Ethernet1/0/8

    Ethernet1/0/9 Ethernet1/0/10 Ethernet1/0/11

    Ethernet1/0/12 Ethernet1/0/13 Ethernet1/0/14

    Ethernet1/0/15 Ethernet1/0/16 Ethernet1/0/17

    Ethernet1/0/18 Ethernet1/0/19 Ethernet1/0/20

    Ethernet1/0/21 Ethernet1/0/22 Ethernet1/0/23

    Ethernet1/0/24 GigabitEthernet1/0/25 GigabitEthernet1/0/26

    Port-group-vlan ID: 2

    Port-group-group Ports:

    Ethernet1/0/1 Ethernet1/0/2 Ethernet1/0/6

    Port-group-vlan ID: 3

    Port-group-group Ports:

    Ethernet1/0/3 Ethernet1/0/4 Ethernet1/0/6

    Port-group-vlan ID: 4

    Port-group-group Ports:

    Ethernet1/0/5 Ethernet1/0/6
    yiluqingshen
        20
    yiluqingshen  
    OP
       120 天前
    官方针对“配置基于 VLAN 的端口隔离”的配置文档有缺失,不够详细,看得云里雾里。
    有会的朋友 给个具休配置命令吗?
    二层。。。。。。我提交换机是二层,再次重申。。。。。
    makusuofute
        21
    makusuofute  
       120 天前
    为什么要买这个 2 层呢?
    如果买二层那么你的路由器要支持子接口或者 vlan
    如果买三层只需要上联支持静态路由就可以了

    依照你的描述
    你上联口怎么提供对应的 vlan 信息呢?
    trunk 口 有 pvid vlan1 和 vlan 1 ,101-124

    你上联口只有 vlan1 没有其他 vlan 信息啊。
    qinxi
        22
    qinxi  
       120 天前
    @defunct9 开 ssh, 让他试试
    defunct9
        23
    defunct9  
       120 天前
    https://bajie.dev/posts/20230324-huawei_switch/

    @qinxi 这个好在真搞过,现在让我这个系统工程师配个网络还真可以。
    defunct9
        24
    defunct9  
       120 天前
    普及个概念,无论你二层三层,缺省路由还需需要有滴。
    defunct9
        25
    defunct9  
       120 天前
    interface Vlanif100
    description === Route
    ip address 192.168.0.100 255.255.255.0
    #
    defunct9
        26
    defunct9  
       120 天前
    ip route-static 0.0.0.0 0.0.0.0 192.168.10.?指到路由器 ip 就行了
    wuxiao2522
        27
    wuxiao2522  
       120 天前
    你跑 PCDN ,如果有很多条线路的话,不用这么麻烦。举例:直接把 1 、2 、3 口划为 vlan100 ,再把路由器 lan 、pcdn 的设备接入这 3 个口,就行了。4 、5 、6 口划为 vlan101 ,同样的操作。
    wuxiao2522
        28
    wuxiao2522  
       120 天前
    但正常情况下,pcdn 单设备就能跑满带宽,直插光猫啊。都不需要交换机。你需要提供更多的需求和信息。
    ppoozl
        29
    ppoozl  
       120 天前
    你要端口隔离不需要配 VLAN 啊,H3C 自带端口隔离功能的
    ppoozl
        30
    ppoozl  
       120 天前
    port-isolate enable group 1
    yiluqingshen
        31
    yiluqingshen  
    OP
       120 天前
    @wuxiao2522 通过网心云 X86 服务器拨号,每条线路占用一个端口和拨一个账号,需要每个端口划分 VLAN 。
    yiluqingshen
        32
    yiluqingshen  
    OP
       120 天前
    @defunct9 把它配置到默认的 VLAN1 可行吗? 28 口允许所有 VLAN 通过
    TESTFLIGHT2021
        33
    TESTFLIGHT2021  
       120 天前
    一看就是 PCDN
    defunct9
        34
    defunct9  
       120 天前
    默认 vlan 是有用的,尽量保持空闲吧。其余的随便用,28 应该是下联的级连口,连下级的。1 口是连上级的。抱歉给你定了规矩。
    qbqbqbqb
        35
    qbqbqbqb  
       119 天前
    要基于 vlan 做端口隔离的话,是不能用 trunk/access 的配置的,应该全部配成 hybrid ,28 口允许所有 vlan ,其他口只允许自己的 PVID 和 28 口的 PVID ,全部配成 untagged 模式
    yiluqingshen
        36
    yiluqingshen  
    OP
       115 天前
    @qbqbqbqb
    大佬,请问“其他口只允许自己的 PVID 和 28 口的 PVID ”;“28 口允许所有 vlan ”
    是这样设置吗?是不是 28 口既要设置成 hybrid 接口类型并配置 PVID 且允许所有 vlan 通过。
    欢迎纠错,谢谢。 以下以两个端口设置举例:

    int g1/0/1

    port link-type hybrid


    port hybrid vlan 101 128 untagged

    ---------------------------------------------------------------

    int g1/0/2

    port link-type hybrid


    port hybrid vlan 102 128 untagged

    ------------------------------------------------------------

    28 口配置:


    port link-type hybrid


    port hybrid vlan 101 102 103 ……128 untagged
    yiluqingshen
        37
    yiluqingshen  
    OP
       115 天前
    补充:添加 PVID ,dis this 两个端口及 28 口
    #1 口
    [H3C-GigabitEthernet1/0/1]dis this
    interface GigabitEthernet1/0/1
    port link-type hybrid
    port hybrid vlan 1 101 128 untagged
    port hybrid pvid vlan 101
    ---------------------------------------------------------
    #2 口

    [H3C-GigabitEthernet1/0/2]dis this
    interface GigabitEthernet1/0/1
    port link-type hybrid
    port hybrid vlan 1 102 128 untagged
    port hybrid pvid vlan 102


    --------------------------------------------------------
    #28 口

    [H3C-GigabitEthernet1/0/28]dis this
    interface GigabitEthernet1/0/28
    port link-type hybrid
    port hybrid vlan 1 101 to 103 128 untagged
    port hybrid pvid vlan 128
    yiluqingshen
        38
    yiluqingshen  
    OP
       115 天前
    @qbqbqbqb

    按你的方式调好了。

    1-26 口分别配置 hybrid;
    port hybrid pvid vlan 1-26
    28 口配置:port hybrid vlan 101 to 128 untagged
    port hybrid pvid vlan 128
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2769 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 05:50 · PVG 13:50 · LAX 22:50 · JFK 01:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.