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万+

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



