以下是交换机配置 trunk 端口的主要步骤:

1. 进入要配置为 trunk 端口的接口:
```
interface
```
2. 将接口模式设置为 trunk:
```
switchport mode trunk
```
3. 指定允许通过 trunk 端口的 VLAN:
```
switchport trunk allowed vlan
```
或者
```
switchport trunk allowed vlan all
```
允许所有 VLAN 通过 trunk 端口。
4. 设置 native VLAN (未标记的默认 VLAN):
```
switchport trunk native vlan
```
5. 启用接口:
```
no shutdown
```
6. 保存配置:
```
write
```
注意事项:
- 使用 `switchport mode access` 可以将接口设置为 access 模式。
- `switchport trunk allowed vlan all` 允许所有 VLAN 通过 trunk 端口,如果需要限制特定 VLAN,可以用逗号分隔 VLAN ID 列表。
- 确保交换机的两端 trunk 端口配置一致,否则可能会造成通信中断。