当前位置:文档之家› 关于二层交换MAC与端口绑定的方法

关于二层交换MAC与端口绑定的方法

利用交换机的Port-Security功能实现

以下是一个配置实例:

switch#config t

switch(config)#int f0/1

switch(config-if)#switchport mode access

//设置交换机的端口模式为access模式,注意缺省是dynamic

//dynamic模式下是不能使用Port-security功能

switch(config-if)#switchport port-security

//打开port-security功能

switch(config-if)#switchport port-security mac-address xxxx.xxxx.xxxx

//xxxx.xxxx.xxxx就是你要关联的mac地址

switch(config-if)#switchport port-security maximum 1

//其实缺省就是1

switch(config-if)#switchport port-security violation shutdown

//如果违反规则,就shutdown端口

//这个时候你show int f0/1的时候就会看到接口是err-disable的

附:

switchport port-security命令语法

Switch(config-if)#switchport port-security ?

aging Port-security aging commands

mac-address Secure mac address

//设置安全MAC地址

maximum Max secure addresses

//设置最大的安全MAC地址的数量,缺省是1

violation Security violation mode

//设置违反端口安全规则后的工作,缺省是shutdown



c2950#configure terminal
c2950(config)#mac access-list extended mac10
c2950(config-ext-nacl)#permit host 0012.2713.3f2d any
c2950(config-ext-nacl)#permit any host 0012.2713.3f2d
这时出现错误:
%Error: The field sets of all the ACEs in an ACL on Ethernet interface should match.
Please refer to the Software Configuration Guide to understand one mask restriction for ACLs on Ethernet interface




switch#mac-address-table static 1234.5678.9012 vlan 10 fa0/1,表示将静态MAC地址与VLAN 10中的端口1绑定。








特殊办法:交换机Cisco 3550交换机还能支持在二层(交换)端口上设置mac/ip 访问控制列表,以下设置将使f0/1端口上的PC只能使用ip地址1.1.1.1及mac地址0000.0c31.ba9b,否则网络通讯不正常。

mac access-list extended macacl
permit host 0000.0c31.ba9b any
permit any host 0000.0c31.ba9b
interface FastEthernet0/1
no ip address
ip access-group ipacl in
mac access-group macacl in
ip access-list extended ipacl
permit ip any host 1.1.1.1
permit ip host 1.1.1.1 any


相关主题
文本预览
相关文档 最新文档