• HCIP实验(11)



    分析:

    (1)PC1和PC3在VLAN2,PC2在VLAN3,PC4和PC4在VLAN4,PC6在VLAN5
    (2)VLAN3可以访问VLAN4和5,VLAN4不能访问VLAN5

    1.配置VLAN

    (创建VLAN2到5)
    [sw1]vlan batch 2 to 5
    (接口划入VLAN)
    [sw1]int e0/0/2
    [sw1-Ethernet0/0/2]port link-type access 
    [sw1-Ethernet0/0/2]port default vlan 2
    (混杂接口,流量属于VLAN3,允许VLAN2、4和5的流量进入)
    [sw1]int e0/0/3
    [sw1-Ethernet0/0/3]port hybrid pvid vlan 3
    [sw1-Ethernet0/0/3]port hybrid untagged vlan 3 to 5
    (配置trunk干道)
    [sw1]int g0/0/1
    [sw1-GigabitEthernet0/0/1]port link-type trunk 
    [sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 to 5
    (混杂接口)
    [sw1]int g0/0/2
    [sw1-GigabitEthernet0/0/2]port hybrid tagged vlan 2
    [sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 5

    [sw2]vlan batch 2 to 5
    [sw2]int e0/0/2
    [sw2-Ethernet0/0/2]port link-type access 
    [sw2-Ethernet0/0/2]port default vlan 2
    (混杂接口)
    [sw2]int e0/0/3
    [sw2-Ethernet0/0/3]port hybrid pvid vlan 4
    [sw2-Ethernet0/0/3]port hybrid untagged  vlan 3 to 4
    (VLAN2访问VLAN3,4,5不是依靠VLAN之间的互访,而是依靠路由器的路由)
    (配置trunk干道)
    [sw2]int g0/0/2
    [sw2-GigabitEthernet0/0/2]port link-type trunk 
    [sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 to 5
    [sw2]int g0/0/1
    [sw2-GigabitEthernet0/0/1]port hybrid tagged vlan 2 to 5

    [sw3]vlan batch 2 to 5
    [sw3]int e0/0/2
    (混杂接口)
    [sw3-Ethernet0/0/2]port hybrid pvid vlan 4
    [sw3-Ethernet0/0/2]port hybrid untagged vlan 3 to 4
    [sw3]int e0/0/3
    [sw3-Ethernet0/0/3]port hybrid pvid vlan 5
    [sw3-Ethernet0/0/3]port hybrid untagged vlan 3 5
    (配置trunk干道)
    [sw3]int g0/0/2
    [sw3-GigabitEthernet0/0/2]port link-type trunk 
    [sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 to 5

    2.配置路由器接口的IP地址

    (配置物理接口,扮演VLAN3,4,5的网关)
    [r1]int g0/0/0
    [r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
    (虚拟接口,专属于VLAN2的网关)
    [r1]int  g0/0/0.1
    [r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
    [r1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
    [r1-GigabitEthernet0/0/0.1]arp broadcast enable 
    (开启DHCP服务)
    [r1]dhcp enable 
    [r1]ip pool v2
    Info: It's successful to create an IP address pool.
    [r1-ip-pool-v2]network 192.168.2.0 ma 24   
    [r1-ip-pool-v2]gateway-list 192.168.2.1
    [r1-ip-pool-v2]dns-list 114.114.114.114
    [r1]ip pool v3
    Info: It's successful to create an IP address pool.
    [r1-ip-pool-v3]network 192.168.1.0 mask 24
    [r1-ip-pool-v3]gateway-list 192.168.1.1
    [r1-ip-pool-v3]dns-list 114.114.114.114
    [r1]int  g0/0/0
    [r1-GigabitEthernet0/0/0]dhcp select global 
    [r1]int g0/0/0.1
    [r1-GigabitEthernet0/0/0.1]dhcp select global 

    3.在PC端自动获取IP地址






    (测试)





    4.验证

    (全部默认允许VALN1进入)






  • 相关阅读:
    docker运行centos镜像 安装python3.9环境
    Linux驱动——platform设备驱动实验
    WebStorm使用PlantUML
    记一次 Nuxt 3 在 Windows 下的打包问题
    《protobuf》基础语法
    IDEA06:Java和Python的进程间通信和心跳包机制
    <哈希及模拟实现>——《C++高阶》
    第二章:数据的表示和运算
    云计算——虚拟化技术Docker网络管理及数据存储
    【uvm】参数化Class中的静态属性
  • 原文地址:https://blog.csdn.net/weixin_62443409/article/details/126319474