vlan实验

这篇博客详细记录了三台交换机sw1、sw2、sw3的配置,创建了2到5的VLAN,并设置了接口类型、PVID和允许通过的VLAN。路由器r1配置了两个子接口,分别关联了两个不同的VLAN,并启用了DHCP服务,创建了两个IP地址池。
摘要由CSDN通过智能技术生成

在这里插入图片描述
在这里插入图片描述
sw1:

[sw1]vlan batch 2 to 5
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 2
[sw1-Ethernet0/0/1]int e0/0/2
[sw1-Ethernet0/0/2]port hybrid untagged vlan 3 to 5
[sw1-Ethernet0/0/2]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type trunk
[sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 to 5
[sw1-GigabitEthernet0/0/2]q
[sw1]int e0/0/2
[sw1-Ethernet0/0/2]port hybrid pvid vlan 3
[sw1-Ethernet0/0/2]display port vlan active
Eth0/0/1 access 2 U: 2
Eth0/0/2 hybrid 3 U: 1 3 to 5
Eth0/0/3 hybrid 1 U: 1
Eth0/0/4 hybrid 1 U: 1
Eth0/0/5 hybrid 1 U: 1
Eth0/0/6 hybrid 1 U: 1
Eth0/0/7 hybrid 1 U: 1
Eth0/0/8 hybrid 1 U: 1
Eth0/0/9 hybrid 1 U: 1
Eth0/0/10 hybrid 1 U: 1
Eth0/0/11 hybrid 1 U: 1
Eth0/0/12 hybrid 1 U: 1
Eth0/0/13 hybrid 1 U: 1
Eth0/0/14 hybrid 1 U: 1
Eth0/0/15 hybrid 1 U: 1
Eth0/0/16 hybrid 1 U: 1
Eth0/0/17 hybrid 1 U: 1
Eth0/0/18 hybrid 1 U: 1
Eth0/0/19 hybrid 1 U: 1
Eth0/0/20 hybrid 1 U: 1
Eth0/0/21 hybrid 1 U: 1
Eth0/0/22 hybrid 1 U: 1
GE0/0/1 hybrid 1 U: 1
GE0/0/2 trunk 1 U: 1
T: 2 to 5
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port hybrid tagged vlan 2
[sw1-GigabitEthernet0/0/1]port hybrid untagged vlan 3 to 5

sw2:

[sw2]vlan batch 2 to 5
[sw2]int e0/0/1
[sw2-Ethernet0/0/1]port link-type access
[sw2-Ethernet0/0/1]port default vlan 2
[sw2-Ethernet0/0/1]int e0/0/2
[sw2-Ethernet0/0/2]port hybrid pvid vlan 4
[sw2-Ethernet0/0/2]port hybrid untagged vlan 3 to 4
[sw2-Ethernet0/0/2]display this

interface Ethernet0/0/2
port hybrid pvid vlan 4
port hybrid untagged vlan 3 to 4

[sw2-Ethernet0/0/2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port hybrid tagged vlan 2 to 5
[sw2-GigabitEthernet0/0/1]int g0/0/2
[sw2-GigabitEthernet0/0/2]port hybrid tagged vlan 3 to 5
[sw2]display port vlan active
Eth0/0/1 access 2 U: 2
Eth0/0/2 hybrid 4 U: 1 3 to 4
Eth0/0/3 hybrid 1 U: 1
Eth0/0/4 hybrid 1 U: 1
Eth0/0/5 hybrid 1 U: 1
Eth0/0/6 hybrid 1 U: 1
Eth0/0/7 hybrid 1 U: 1
Eth0/0/8 hybrid 1 U: 1
Eth0/0/9 hybrid 1 U: 1
Eth0/0/10 hybrid 1 U: 1
Eth0/0/11 hybrid 1 U: 1
Eth0/0/12 hybrid 1 U: 1
Eth0/0/13 hybrid 1 U: 1
Eth0/0/14 hybrid 1 U: 1
Eth0/0/15 hybrid 1 U: 1
Eth0/0/16 hybrid 1 U: 1
Eth0/0/17 hybrid 1 U: 1
Eth0/0/18 hybrid 1 U: 1
Eth0/0/19 hybrid 1 U: 1
Eth0/0/20 hybrid 1 U: 1
Eth0/0/21 hybrid 1 U: 1
Eth0/0/22 hybrid 1 U: 1
GE0/0/1 hybrid 1 U: 1
T: 2 to 5
sw3:

[sw3]vlan batch 2 to 5
[sw3]int e0/0/1
[sw3-Ethernet0/0/1]port hybrid pvid vlan 4
[sw3-Ethernet0/0/1]port hybrid untagged vlan 3 to 4
[sw3-Ethernet0/0/1]int e0/0/2
[sw3-Ethernet0/0/2]port hybrid pvid vlan 5
[sw3-Ethernet0/0/2]port hybrid untagged vlan 3 5
[sw3-Ethernet0/0/2]display this

interface Ethernet0/0/2
port hybrid pvid vlan 5
port hybrid untagged vlan 3 5

[sw3-Ethernet0/0/2]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type trunk
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 3 to 5
[sw3]display port vlan active
Eth0/0/1 hybrid 4 U: 1 3 to 4
Eth0/0/2 hybrid 5 U: 1 3 5
Eth0/0/3 hybrid 1 U: 1
Eth0/0/4 hybrid 1 U: 1
Eth0/0/5 hybrid 1 U: 1
Eth0/0/6 hybrid 1 U: 1
Eth0/0/7 hybrid 1 U: 1
Eth0/0/8 hybrid 1 U: 1
Eth0/0/9 hybrid 1 U: 1
Eth0/0/10 hybrid 1 U: 1
Eth0/0/11 hybrid 1 U: 1
Eth0/0/12 hybrid 1 U: 1
Eth0/0/13 hybrid 1 U: 1
Eth0/0/14 hybrid 1 U: 1
Eth0/0/15 hybrid 1 U: 1
Eth0/0/16 hybrid 1 U: 1
Eth0/0/17 hybrid 1 U: 1
Eth0/0/18 hybrid 1 U: 1
Eth0/0/19 hybrid 1 U: 1
Eth0/0/20 hybrid 1 U: 1
Eth0/0/21 hybrid 1 U: 1
Eth0/0/22 hybrid 1 U: 1
GE0/0/1 trunk 1 U: 1
T: 3 to 5
r1:

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[r1-GigabitEthernet0/0/0]q
[r1]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1-GigabitEthernet0/0/0.1]ip address 192.168.2.1 24
[r1-GigabitEthernet0/0/0.1]q
[r1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2

Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.1/24 up up
GigabitEthernet0/0/0.1 192.168.2.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
NULL0 unassigned up up(s)
[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-a]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-a]q
[r1]ip pool b
[r1-ip-pool-b]network 192.168.2.0 mask 24
[r1-ip-pool-b]gateway-list 192.168.2.1
[r1-ip-pool-b]dns-list 114.114.114.114 8.8.8.8
[r1-ip-pool-b]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

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值