三台交换机配置vlan
时间: 2023-10-31 19:06:39 浏览: 235
以下是三台交换机配置vlan的步骤:
1. 连接三台交换机,分别为Switch1、Switch2和Switch3。
2. 在Switch1上创建vlan1和vlan2:
```
Switch1# configure terminal
Switch1(config)# vlan 1
Switch1(config-vlan)# name VLAN1
Switch1(config-vlan)# exit
Switch1(config)# vlan 2
Switch1(config-vlan)# name VLAN2
Switch1(config-vlan)# exit
```
3. 在Switch2上创建vlan1和vlan2:
```
Switch2# configure terminal
Switch2(config)# vlan 1
Switch2(config-vlan)# name VLAN1
Switch2(config-vlan)# exit
Switch2(config)# vlan 2
Switch2(config-vlan)# name VLAN2
Switch2(config-vlan)# exit
```
4. 在Switch3上创建vlan1和vlan2:
```
Switch3# configure terminal
Switch3(config)# vlan 1
Switch3(config-vlan)# name VLAN1
Switch3(config-vlan)# exit
Switch3(config)# vlan 2
Switch3(config-vlan)# name VLAN2
Switch3(config-vlan)# exit
```
5. 在Switch1上配置端口1和端口2,将它们分别加入vlan1和vlan2:
```
Switch1# configure terminal
Switch1(config)# interface fastethernet 0/1
Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 1
Switch1(config-if)# exit
Switch1(config)# interface fastethernet 0/2
Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 2
Switch1(config-if)# exit
```
6. 在Switch2上配置端口1和端口2,将它们分别加入vlan1和vlan2:
```
Switch2# configure terminal
Switch2(config)# interface fastethernet 0/1
Switch2(config-if)# switchport mode access
Switch2(config-if)# switchport access vlan 1
Switch2(config-if)# exit
Switch2(config)# interface fastethernet 0/2
Switch2(config-if)# switchport mode access
Switch2(config-if)# switchport access vlan 2
Switch2(config-if)# exit
```
7. 在Switch3上配置端口1和端口2,将它们分别加入vlan1和vlan2:
```
Switch3# configure terminal
Switch3(config)# interface fastethernet 0/1
Switch3(config-if)# switchport mode access
Switch3(config-if)# switchport access vlan 1
Switch3(config-if)# exit
Switch3(config)# interface fastethernet 0/2
Switch3(config-if)# switchport mode access
Switch3(config-if)# switchport access vlan 2
Switch3(config-if)# exit
```
8. 在Switch1上配置端口3和端口4为trunk端口,将vlan1和vlan2都打上tag:
```
Switch1# configure terminal
Switch1(config)# interface fastethernet 0/3
Switch1(config-if)# switchport mode trunk
Switch1(config-if)# switchport trunk allowed vlan 1,2
Switch1(config-if)# exit
Switch1(config)# interface fastethernet 0/4
Switch1(config-if)# switchport mode trunk
Switch1(config-if)# switchport trunk allowed vlan 1,2
Switch1(config-if)# exit
```
9. 在Switch2上配置端口3为trunk端口,将vlan1和vlan2都打上tag:
```
Switch2# configure terminal
Switch2(config)# interface fastethernet 0/3
Switch2(config-if)# switchport mode trunk
Switch2(config-if)# switchport trunk allowed vlan 1,2
Switch2(config-if)# exit
```
10. 在Switch3上配置端口3为trunk端口,将vlan1和vlan2都打上tag:
```
Switch3# configure terminal
Switch3(config)# interface fastethernet 0/3
Switch3(config-if)# switchport mode trunk
Switch3(config-if)# switchport trunk allowed vlan 1,2
Switch3(config-if)# exit
```
至此,三台交换机的vlan配置完成。端口1和端口2属于不同的vlan,端口3属于所有vlan。可以通过端口3互联三台交换机,实现不同vlan之间的通信。
阅读全文