假设交换机A,B、C三个口,PC机1、2和3,PC1(0009.7c85.d579)连A口,PC2(000c.cf73.9311)连B口,PC3连C口
1、在A口设置mac-address-table
static绑定PC1的MAC地址:
mac-address-table
static
0009.7c85.d579
vlan
1
interface
f0/1
把PC1接入C口,PC3接入A口,此时PC1不通,PC2和PC3通
2、在A口设置swithport
port-security
mac-addree
sticky绑定PC1的MAC地址
把PC1接入C口,PC3接入A口,此时PC3不通,PC1和PC2通
所以得出的结论是:
mac-address-table
static是对VLAN中的所有端口生效,这个MAC在这个VLAN中只能通过绑定的这个口访问,其它口是不能访问的。
swithport
port-security
mac-address
sticky只对特定的一个端口生效,只要这个端口相连的PC的MAC不是对应的,就禁止访问。而如果接入其它口,则访问正常。
本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。