For Access Mode:
switchport mode access
switchport nonegotiate
switchport access vlan 100
For Trunk Mode:
switchport trunk encapsulation dot1q
switchport mode trunk
switchport nonegotiate
switchport trunk allowed vlan 10,100
switchport trunk native vlan 1
The reason why switch port can automatically form trunk is because of DTP (Dynamic Trunk Protocol).
For access layer switches, default configuration is switchport mode dynamic auto , which means it will not send DTP packets initially but will pro-actively send it after received one.
For Distribution layer switches, default configuration is switchport mode dynamic desirable , which means it will send DTP packets actively.
`
Desirable is the default state of a switch port. It means that if a device connected to the other end of the cable is trying to trunk, your switch will form a trunk thus voiding
switchport access vlan 10 command.
If you want to get rid of this line in your config and prevent a port from trunking you should issue
switchport mode access command.
desirable + trunk = trunk
desirable + desirable = trunk
desirable + auto = trunk
desirable + access = access
Dynamic desirable is the new default for DTP in Cisco IOS, old IOS uses dynamic auto as default. You can turn off DTP (and therefore don’t see link in desirable or auto state) using ‘switchport nonegotiate’ command. This command will leave your port the way it’s previously configured (either as access or trunk, explicitly).
交换机端口模式配置
本文介绍了交换机端口在不同模式下的配置方法,包括接入模式和中继模式,并详细解释了动态中继协议(DTP)的工作原理及如何通过配置使端口进入特定的工作模式。



2万+

被折叠的 条评论
为什么被折叠?



