实现不同vlan间PC不可互访,而不同vlan的PC均可访问服务器的特殊效果,具体要求如下。
在交换机中创建相关vlan
修改端口模式与pvid
修改端口允许通过的数据帧
结果验证,vlan5与vlan10的pc不可以互通,但它们均可与服务器互通
- 1
- 2
- 3
- 4
实现此案例需要按照如下步骤进行。
1)配置第1台交换机
[SW1]vlan batch 5 10 50
[SW1]interface Ethernet0/0/1
[SW1-Ethernet0/0/1]port hybrid untagged vlan 5 50
[SW1-Ethernet0/0/1]port hybrid pvid vlan 5
[SW1]interface Ethernet0/0/2
[SW1-Ethernet0/0/2]port hybrid untagged vlan 10 50
[SW1-Ethernet0/0/2]port hybrid pvid vlan 10
[SW1]interface Ethernet0/0/3
[SW1-Ethernet0/0/3]port hybrid tagged vlan 5 10 50
[SW1]dis vlan
The total number of vlans is : 4
------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(U) Eth0/0/4(D)
Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D)
Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D)
Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D)
Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D)
Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D)
5 common UT:Eth0/0/1(U)
TG:Eth0/0/3(U)
10 common UT:Eth0/0/2(U)
TG:Eth0/0/3(U)
50 common UT:Eth0/0/1(U) Eth0/0/2(U)
TG:Eth0/0/3(U)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------
1 enable default enable disable VLAN 0001
5 enable default enable disable VLAN 0005
10 enable default enable disable VLAN 0010
50 enable default enable disable VLAN 0050
[SW1]dis port vlan
Port Link Type PVID Trunk VLAN List
--------------------------------------------------------------------
Ethernet0/0/1 hybrid 5 -
Ethernet0/0/2 hybrid 10 -
Ethernet0/0/3 hybrid 1 5 10 50
Ethernet0/0/4 hybrid 1 -
Ethernet0/0/5 hybrid 1 -
Ethernet0/0/6 hybrid 1 -
Ethernet0/0/7 hybrid 1 -
Ethernet0/0/8 hybrid 1 -
Ethernet0/0/9 hybrid 1 -
Ethernet0/0/10 hybrid 1 -
Ethernet0/0/11 hybrid 1 -
Ethernet0/0/12 hybrid 1 -
Ethernet0/0/13 hybrid 1 -
Ethernet0/0/14 hybrid 1 -
Ethernet0/0/15 hybrid 1 -
Ethernet0/0/16 hybrid 1 -
Ethernet0/0/17 hybrid 1 -
Ethernet0/0/18 hybrid 1 -
Ethernet0/0/19 hybrid 1 -
Ethernet0/0/20 hybrid 1 -
Ethernet0/0/21 hybrid 1 -
Ethernet0/0/22 hybrid 1 -
GigabitEthernet0/0/1 hybrid 1 -
GigabitEthernet0/0/2 hybrid 1 -
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
2)配置第2台交换机
[SW2]vlan batch 5 10 50
[SW2]interface Ethernet0/0/1
[SW2-Ethernet0/0/1]port hybrid tagged vlan 5 10 50
[SW2]interface Ethernet0/0/2
[SW2-Ethernet0/0/2]port hybrid untagged vlan 5 10 50
[SW2-Ethernet0/0/2]port hybrid pvid vlan 50
[SW2]dis vlan
The total number of vlans is : 4
--------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(D) Eth0/0/4(D)
Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D)
Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D)
Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D)
Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D)
Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D)
5 common UT:Eth0/0/2(U)
TG:Eth0/0/1(U)
10 common UT:Eth0/0/2(U)
TG:Eth0/0/1(U)
50 common UT:Eth0/0/2(U)
TG:Eth0/0/1(U)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------
1 enable default enable disable VLAN 0001
5 enable default enable disable VLAN 0005
10 enable default enable disable VLAN 0010
50 enable default enable disable VLAN 0050
[SW2]dis port vlan
Port Link Type PVID Trunk VLAN List
-------------------------------------------------------------------
Ethernet0/0/1 hybrid 1 5 10 50
Ethernet0/0/2 hybrid 50 -
Ethernet0/0/3 hybrid 1 -
Ethernet0/0/4 hybrid 1 -
Ethernet0/0/5 hybrid 1 -
Ethernet0/0/6 hybrid 1 -
Ethernet0/0/7 hybrid 1 -
Ethernet0/0/8 hybrid 1 -
Ethernet0/0/9 hybrid 1 -
Ethernet0/0/10 hybrid 1 -
Ethernet0/0/11 hybrid 1 -
Ethernet0/0/12 hybrid 1 -
Ethernet0/0/13 hybrid 1 -
Ethernet0/0/14 hybrid 1 -
Ethernet0/0/15 hybrid 1 -
Ethernet0/0/16 hybrid 1 -
Ethernet0/0/17 hybrid 1 -
Ethernet0/0/18 hybrid 1 -
Ethernet0/0/19 hybrid 1 -
Ethernet0/0/20 hybrid 1 -
Ethernet0/0/21 hybrid 1 -
Ethernet0/0/22 hybrid 1 -
GigabitEthernet0/0/1 hybrid 1 -
GigabitEthernet0/0/2 hybrid 1 -
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
3)测试
vlan5与vlan10的pc不可以互通,但它们均可与服务器互通。