Giveiteverythingyou'vegot.实心大白菜端口绑定技术目录端口绑定技术...................................................................................................................................1一、华为...................................................................................................................................21.1查看MAC地址表........................................................................................................21.2手动添加静态的表项...................................................................................................21.3手工配置动态的表项...................................................................................................31.4老化时间.......................................................................................................................31.5禁止端口学习...............................................................................................................3二、H3C...................................................................................................................................52.1MAC地址表项分类.....................................................................................................52.2全局配置MAC地址表项............................................................................................52.3接口配置MAC地址表项............................................................................................62.4关闭MAC地址学习功能............................................................................................62.5配置动态MAC地址表项的老化时间........................................................................62.6配置接口最多可以学习到的MAC地址数................................................................62.7MAC地址表显示和维护.............................................................................................7三、H3CS7500交换机配置...................................................................................................73.1[H3C]amuser-bind{mac-addrmac-address|ip-addrip-address}interface-list..........73.2amuser-bind..................................................................................................................83.3displayamuser-bind.....................................................................................................8四、思科2950交换机.............................................................................................................94.1绑定接口和MAC.........................................................................................................94.2基于MAC地址的扩展访问列表................................................................................94.3IP地址的MAC地址绑定...........................................................................................94.4通过IP查端口...........................................................................................................104.5主机IP与MAC地址的绑定。................................................................................104.6IP与交换机端口的绑定............................................................................................10Giveiteverythingyou'vegot.实心大白菜一、华为以S3026交换机为例1.1查看MAC地址表[Quidway]Displaymac-addressMACADDRVLANIDSTATEPORTINDEXAGINGTIME(s)备注:1)可以通过使用mac-addresstimeraging命令来修改系统的老化时间。默认情况下,学习到的地址表项如果在老化时间结束后没有得到更新,这个表项会被删除。当我们断开PC与交换机的物理连接时。这个动态表项会被立即删除(不管老化时间是否已经到了)2)动态学习到的MAC表项的状态是learned,静态配置的状态是configstatic,并且老化时间是NOAGED。1.2手动添加静态的表项交换机可以通过命令来手动添加或删除静态的表项,来实现对MAC地址表的维护和控制。交换机中,对于同一个MAC地址只能有一个表项,因此在配置静态表项之前,必须把相应的动态表项给释放掉。配置命令:[Quidway]mac-addressstaticmac-addressinterfaceinterface配置之后,该MAC地址不能被其他端口学习形成新的表项。所以拥有该MAC的设备不能连接到其他端口上。(因为静态配置的MAC地址表项优先于动态学习的MAC地址表项,同一个MAC地址只能有一个表项的原则)Giveiteverythingyou'vegot.实心大白菜“undo”命令删除到我们配置静态表项[Quidway]undomac-addressstaticmac-address1.3手工配置动态的表项配置命令:[Quidway]mac-addressdynamicmac-addressinterfaceinterfaceinterface说明:配置过后,MAC表项显示的状态为configdynamic(配置的动态的),手动添加的动态表项和自动表项一样,都有老化时间AGINGTIME。手工配置的动态的MAC表项也是有老化时间的。同样我们也可以用“undo”命令来删除动态表项[Quidway]undomac-addressdynamicmac-address1.4老化时间对于动态学习到的MAC地址,有一个老化时间AgingTime的概念,来表示这个表项还会被保存多长时间。系统默认的老化时间是300秒。查看命令:[Quidway]displaymac-addressaging-time1.5禁止端口学习[Quidway-interfacetype/number]mac-addresslock禁止该端口连接到其他的主机,只让该端口使用静态绑定的MAC表项。Giveiteverythingyou'vegot.实心大白菜Giveiteverythingyou'vegot.实心大白菜二、H3C2.1MAC地址表项分类静态MAC地址表项,动态MAC地址表项、黑洞MAC地址表项和多端口单播MAC地址表项黑洞MAC地址表项用于丢弃含有特定目的MAC地址的报文(例如出于安全考虑,可以屏蔽某个用户接收报文),由用户手工配置,表项不老化。备注:用户手工配置的静态MAC地址表项和黑洞MAC地址表项不会被动态MAC地址表项覆盖,而动态MAC地址表项可以被静态MAC地址表项和黑洞MAC地址表项覆盖。2.2全局配置MAC地址表项1)配置动态/静态MAC地址表项[H3C]mac-address{dynamic|static}mac-addressinterfaceinterface-typeinterface-numbervlanvlan-id2)配置黑洞MAC地址表项Mac-addressblackholemac-addressvlanvlan-id命令中的interface参数指定的接口必须属于vlan参数指定的vlan,而且该vlan必须实现创建,否则将添加失败。Giveiteverythingyou'vegot.实心大白菜2.3接口配置MAC地址表项[H3C-interface-type/number]mac-address{dynamic|static}mac-addressvlanvlan-id2.4关闭MAC地址学习功能1)关闭全局的MAC地址学习功能[H3C]mac-addressmac-learningdisable//缺省情况下,开启全局的MAC地址学习功能2)关闭接口的MAC地址学习功能[H3C-interface-type/number]mac-addressmac-learningdisable//缺省情况下,开启接口的MAC地址学习功能2.5配置动态MAC地址表项的老化时间[H3C]mac-addresstimer{agingseconds|no-aging}//缺省情况下,MAC地址表项的老化时间为300秒。备注:在一个比较稳定的网络,并且