VLAN实验

配置R1路由器为VLAN2创建子接口并设置DHCP服务,SW1和SW2、SW3交换机进行VLAN配置,包括接入、Trunk和Hybrid端口设定,以及允许特定VLAN通过。
摘要由CSDN通过智能技术生成

1.划分固定网段,在r1上为vlan2设置子接口管理pc1/pc3,并在子接口上设置DHCP池塘获取IP

2.pc2与sw1的接口允许vlan3上去,允许vlan3/4 /5下来,且剥离标签,pc4与sw2的接口和pc5与sw3的接口 允许vlan4上去,允许vlan 3/4下来,pc6与sw3的接口允许vlan5上去,允许vlan3/5下来

3.sw1与sw2之间左边配trunk,右边配混杂

4.由于2456都在一个范围,且都属于混杂模式,允许vlan1进入。在路由器上,把2456都看作在vlan1

r1配置:

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[r1-GigabitEthernet0/0/0]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]ip address 192.168.2.1 24
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1]dhcp enable
Info: It’s successful to create an IP address pool.
[r1-ip-pool-v1]network 192.168.1.0 mask 24
[r1-ip-pool-v1]gateway-list 192.168.1.1
[r1-ip-pool-v1]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-v1]q
[r1]ip pool v2
[r1-ip-pool-v2]network 192.168.2.0 mask 24
[r1-ip-pool-v2]gateway-list 192.168.2.1
[r1-ip-pool-v2]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-v2]q
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]dhcp select global
[r1-GigabitEthernet0/0/0]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global

sw1配置:

[sw1]vlan batch 2 to 5
[sw1] int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 2
[sw1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 5
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 3
[sw1]int g0/0/23
[sw1-GigabitEthernet0/0/23]port link-type trunk
[sw1-GigabitEthernet0/0/23]port trunk allow-pass vlan 2 to 5
[sw1]int g0/0/24
[sw1-GigabitEthernet0/0/24]port hybrid tagged vlan 2
[sw1-GigabitEthernet0/0/24]port hybrid untagged vlan 3 to 5

sw2配置:

[sw2] vlan batch 2 to 5
[sw2]int g0/0/23
[sw2-GigabitEthernet0/0/23]port hybrid tagged vlan 2 to 5
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 2
[sw2]int g0/0/2
[sw2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 4
[sw2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[sw2]int g0/0/24
[sw2-GigabitEthernet0/0/24]port hybrid tagged vlan 2 to 5

sw3配置:

[sw3]int g0/0/24
[sw3-GigabitEthernet0/0/24]port hybrid tagged vlan 2 to 5
[sw3]vlan batch 2 to 5
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port hybrid pvid vlan 4
[sw3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 4
[sw3]int g0/0/2
[sw3-GigabitEthernet0/0/2]port hybrid pvid vlan 5
[sw3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 5

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值