在Cisco路由器上配置Trunk端口通常涉及以下步骤:
进入全局配置模式
```plaintext
Router enable
Router(config)
```
选择要配置的接口
```plaintext
Router(config) interface fastEthernet 0/1
```
将接口配置为Trunk模式
```plaintext
Router(config-if) switchport mode trunk
```
允许所有VLAN通过该接口 (可选,但推荐):```plaintext
Router(config-if) switchport trunk allowed vlan all
```
(可选)配置封装协议
如果接口的封装协议不是`dot1q`,则需要先配置封装协议:
```plaintext
Router(config-if) switchport trunk encapsulation dot1q
```
```plaintext
Router enable
Router(config) interface fastEthernet 0/1
Router(config-if) switchport mode trunk
Router(config-if) switchport trunk allowed vlan all
```
注意事项:
封装协议:
确保接口的封装协议是`dot1q`,这是Cisco交换机和路由器常用的VLAN封装协议。如果接口的封装协议是`Auto`,则需要先将其更改为`dot1q`:
```plaintext
Router(config-if) switchport trunk encapsulation dot1q
```
VLAN配置:确保在配置Trunk端口之前,已经正确配置了所需的VLAN。
保存配置:完成配置后,保存当前配置以便在重启后仍然有效:
```plaintext
Router(config) write memory
```
通过以上步骤,您可以在Cisco路由器上成功配置Trunk端口,使其能够传输多个VLAN的数据。