VLAN综合实验

本文详细描述了如何在交换机上创建VLAN,划分接口,配置trunk隧道,以及在路由器上设置子接口和DHCP服务,以实现不同VLAN间的通信和网络管理。
摘要由CSDN通过智能技术生成

在交换机上创建VLAN

SW1

[sw1]vlan batch 2 to 6

SW2

[sw2]vlan batch 2 to 6

SW3

[sw3]vlan batch 2 to 6

将接口划分到如图vlan,并配置接口模式

SW1

[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access   
[sw1-GigabitEthernet0/0/1]port default vlan 2
[sw1-GigabitEthernet0/0/2]port link-type hybrid 
[sw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[sw1-GigabitEthernet0/0/2]port hybrid pvid vlan 3

SW2

[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access 

[sw2-GigabitEthernet0/0/1]port default vlan 2

[sw2-GigabitEthernet0/0/1]int g0/0/2
[sw2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 to 6
[sw2-GigabitEthernet0/0/2]port hybrid  pvid vlan 4

SW3

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

[sw3-GigabitEthernet0/0/1]int g0/0/2 
[sw3-GigabitEthernet0/0/2]port hybrid  untagged vlan 3 4 6
[sw3-GigabitEthernet0/0/2]port hybrid  pvid vlan 6

配置trunt隧道,放行VLAN

SW1

[sw1]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type trunk 
[sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6

[sw1]int g0/0/4
[sw1-GigabitEthernet0/0/4]port hybrid tagged vlan 2
[sw1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 to 6

SW2

[sw2]int g0/0/3 
[sw2-GigabitEthernet0/0/3]port link-type trunk 
[sw2-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6
[sw2-GigabitEthernet0/0/3]int g0/0/4
[sw2-GigabitEthernet0/0/4]port link-type trunk 
[sw2-GigabitEthernet0/0/4]port trunk allow-pass vlan 2 to 6

SW3

[sw3]int g0/0/3   
[sw3-GigabitEthernet0/0/3]port link-type trunk 
[sw3-GigabitEthernet0/0/3]port trunk allow-pass vlan 2 to 6

在路由 器上配置子接口,实现vlan区间

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[r1-GigabitEthernet0/0/0]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]ip add 192.168.2.1 24
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable

配置DHCP下发路由给pc

[r1]dhcp enable 
[r1]ip pool a 
[r1-ip-pool-a]network 192.168.1.0 mask 24

[r1-ip-pool-a]gateway-list 192.168.1.1

[r1]ip pool b
[r1-ip-pool-b]netbios-type  
[r1-ip-pool-b]network 192.168.2.0 mask 24

[r1-ip-pool-b]gateway-list 192.168.2.1

在接口开启dhcp

[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


 

·

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值