1.配置跨交换机的VLAN
一、背景
假设某家企业有两个重要部门:销售部和技术部,其中销售部门的个人计算机系统分散连接,他们之间需要相互通信,但为了数据安全,销售部和技术部需要相互隔离,则要在交换机上做适当配置来实现这一目标。
二、拓扑图
三、配置流程
Switch-PT0的配置
1.1 在交换机Switch-PT0上配置vlan10,并将Fa1/1端口划分给vlan10
配置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name sales
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 1/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#end查看:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15Switch>en
Switch#show vlan id 10
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 sales active Fa1/1
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
10 enet 100010 1500 - - - - - 0 01.2 在交换机Switch-PT0上配置vlan20,并将Fa2/1端口划分给vlan20
配置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 20
Switch(config-vlan)#name technical
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 2/1
Switch(config-if)#switchport access vlan 20
Switch(config-if)#end查看:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
151. Switch#show vlan id 20
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
20 technical active Fa2/1
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
20 enet 100020 1500 - - - - - 0 0将交换机Switch-PT0与Switch-PT1相连的Fa0/1端口定义为trunk模式
配置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Switch(config-if)#switchport mode trunk
Switch(config-if)#end查看:
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
47Switch#show interfaces fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Appliance trust: noneSwitch-PT1的配置
3.1 在交换机Switch-PT1上配置vlan10,并将0/1端口划分给vlan10
配置:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name sales
Switch(config-vlan)#exit
Switch(config)#interface fastEthernet 1/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#end查看:
1
2
3
4
5
6
7
8
9
10
11
12
13Switch#show vlan id 10
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 sales active Fa1/1
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
10 enet 100010 1500 - - - - - 0 03.2 将交换机Switch-PT1与交换机Switch-PT0相连的Fa0/1端口定义为trunk模式
配置:
1
2
3
4
5
6
7
8
9Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#end查看:
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
47Switch#show interfaces fastEthernet 0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: All
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Appliance trust: none配置PC与ping测试
4.1 PC-PTvlan10-1
ip:192.168.10.10
MASK:255.255.255.0
4.2 PC-PTvlan20
ip:192.168.10.20
MASK:255.255.255.0
4.3 PC-PTvlan10-2
ip:192.168.10.30
MASK:255.255.255.0
4.4 ping测试
PC-PTvlan10-2 ping PC-PTvlan10-1 ping 192.168.10.10
PC-PTvlan10-2 ping PC-PTvlan20 ping 192.168.10.20
- Title: 1.配置跨交换机的VLAN
- Author: 小浩
- Created at : 2024-04-08 14:49:05
- Updated at : 2024-06-08 13:52:13
- Link: https://blog.xh8.shop/2024/04/08/1-配置跨交换机的VLAN/
- License: This work is licensed under CC BY-NC-SA 4.0.
Comments