当前位置:文档之家› 神州数码端口和MAC地址绑定实验

神州数码端口和MAC地址绑定实验

实验十八、交换机端口与MAC绑定一、 实验目的1、了解什么是交换机的MAC绑定功能;2、熟练掌握MAC与端口绑定的静态、动态方式。

二、 应用环境1、当网络中某机器由于中毒进而引发大量的广播数据包在网络中洪泛时,网络管理员的唯一想法就是尽快地找到根源主机并把它从网络中暂时隔离开。

当网络的布置很随意时,任何用户只要插上网线,在任何位置都能够上网,这虽然使正常情况下的大多数用户很满意,但一旦发生网络故障,网管人员却很难快速准确定位根源主机,就更谈不上将它隔离了。

端口与地址绑定技术使主机必须与某一端口进行绑定,也就是说,特定主机只有在某个特定端口下发出数据帧,才能被交换机接收并传输到网络上,如果这台主机移动到其他位置,则无法实现正常的连网。

这样做看起来似乎对用户苛刻了一些,而且对于有大量使用便携机的员工的园区网并不适用,但基于安全管理的角度考虑,它却起到了至关重要的作用。

2、为了安全和便于管理,需要将MAC地址与端口进行绑定,即,MAC地址与端口绑定后,该MAC地址的数据流只能从绑定端口进入,不能从其他端口进入。

该端口可以允许其他MAC地址的数据流通过。

但是如果绑定方式采用动态lock的方式会使该端口的地址学习功能关闭,因此在取消lock之前,其他MAC的主机也不能从这个端口进入。

三、 实验设备1、DCS-3926S交换机1台2、PC机2台3、Console线1根4、直通网线2根四、 实验拓扑五、 实验要求1、交换机IP地址为192.168.1.11/24,PC1的地址为192.168.1.101/24;PC2的地址为192.168.1.102/24。

2、在交换机上作MAC与端口绑定;3、PC1在不同的端口上ping 交换机的IP,检验理论是否和实验一致。

4、PC2在不同的端口上ping 交换机的IP,检验理论是否和实验一致。

六、 实验步骤第一步:得到PC1主机的mac地址Microsoft Windows XP [版本 5.1.2600](C) 版权所有 1985-2001 Microsoft Corp.C:\>ipconfig/allWindows IP ConfigurationHost Name . . . . . . . . . . . . : xuxpPrimary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : BroadcastIP Routing Enabled. . . . . . . . : NoWINS Proxy Enabled. . . . . . . . : NoEthernet adapter 本地连接:Connection-specific DNS Suffix . :Description . . . . . . . . . . . : Intel(R) PRO/100 VE Network Connecti onPhysical Address. . . . . . . . . : 00-A0-D1-D1-07-FFDhcp Enabled. . . . . . . . . . . : YesAutoconfiguration Enabled . . . . : YesAutoconfiguration IP Address. . . : 169.254.27.232Subnet Mask . . . . . . . . . . . : 255.255.0.0Default Gateway . . . . . . . . . :C:\>我们得到了PC1主机的mac地址为:00-A0-D1-D1-07-FF。

第二步:交换机全部恢复出厂设置,配置交换机的IP地址switch(Config)#interface vlan 1switch(Config-If-Vlan1)#ip address 192.168.1.11 255.255.255.0switch(Config-If-Vlan1)#no shutswitch(Config-If-Vlan1)#exitswitch(Config)#第三步:使能端口的MAC地址绑定功能switch(Config)#interface ethernet 0/0/1switch(Config-Ethernet0/0/1)#switchport port-securityswitch(Config-Ethernet0/0/1)#第四步:添加端口静态安全MAC地址,缺省端口最大安全MAC地址数为1switch(Config-Ethernet0/0/1)#switchport port-security mac-address 00-a0-d1-d1-07-ff验证配置:switch#show port-securitySecurity Port MaxSecurityAddr CurrentAddr Security Action(count) (count)--------------------------------------------------------------------------- Ethernet0/0/1 1 1 Protect --------------------------------------------------------------------------- Max Addresses limit per port :128Total Addresses in System :1switch#switch#show port-security addressSecurity Mac Address Table--------------------------------------------------------------------------- Vlan Mac Address Type Ports1 00-a0-d1-d1-07-ff SecurityConfigured Ethernet0/0/1--------------------------------------------------------------------------- Total Addresses in System :1Max Addresses limit in System :128switch#第五步:使用ping命令验证PC 端口 Ping 结果 原因PC1 0/0/1 192.168.1.11 通PC1 0/0/7 192.168.1.11 不通PC2 0/0/1 192.168.1.11 通PC2 0/0/7 192.168.1.11 通第六步:在一个以太口上静态捆绑多个MACSwitch(Config-Ethernet0/0/1)#switchport port-security maximum 4Switch(Config-Ethernet0/0/1)#switchport port-security mac-address aa-aa-aa-aa-aa-aaSwitch(Config-Ethernet0/0/1)#switchport port-security mac-address aa-aa-aa-bb-bb-bbSwitch(Config-Ethernet0/0/1)#switchport port-security mac-address aa-aa-aa-cc-cc-cc验证配置:switch#show port-securitySecurity Port MaxSecurityAddr CurrentAddr Security Action(count) (count)--------------------------------------------------------------------------- Ethernet0/0/1 4 4 Protect ---------------------------------------------------------------------------Max Addresses limit per port :128Total Addresses in System :4switch#show port-security addressSecurity Mac Address Table--------------------------------------------------------------------------- Vlan Mac Address Type Ports1 00-a0-d1-d1-07-ff SecurityConfigured Ethernet0/0/11 aa-aa-aa-aa-aa-aa SecurityConfigured Ethernet0/0/11 aa-aa-aa-bb-bb-bb SecurityConfigured Ethernet0/0/11 aa-aa-aa-cc-cc-cc SecurityConfigured Ethernet0/0/1--------------------------------------------------------------------------- Total Addresses in System :4Max Addresses limit in System :128switch#上面使用的都是静态捆绑MAC的方法,下面介绍动态mac地址绑定的基本方法,首先清空刚才做过的捆绑。

第七步:清空端口与MAC绑定switch(Config)#switch(Config)#int ethernet 0/0/1switch(Config-Ethernet0/0/1)#no switchport port-securityswitch(Config-Ethernet0/0/1)#exitswitch(Config)#exit验证配置:switch#show port-securitySecurity Port MaxSecurityAddr CurrentAddr Security Action(count) (count)--------------------------------------------------------------------------- --------------------------------------------------------------------------- Max Addresses limit per port :128Total Addresses in System :0第八步:使能端口的MAC地址绑定功能,动态学习MAC并转换switch(Config)#interface ethernet 0/0/1switch(Config-Ethernet0/0/1)#switchport port-securityswitch(Config-Ethernet0/0/1)#switchport port-security lockswitch(Config-Ethernet0/0/1)#switchport port-security convertswitch(Config-Ethernet0/0/1)#exit验证配置:switch#show port-security addressSecurity Mac Address Table--------------------------------------------------------------------------- Vlan Mac Address Type Ports1 00-a0-d1-d1-07-ff SecurityConfigured Ethernet0/0/1--------------------------------------------------------------------------- Total Addresses in System :1Max Addresses limit in System :128switch#第九步:使用ping命令验证PC 端口 Ping 结果 原因PC1 0/0/1 192.168.1.11 通PC1 0/0/7 192.168.1.11 不通PC2 0/0/1 192.168.1.11 不通PC2 0/0/7 192.168.1.11 通七、 注意事项和排错1、如果出现端口无法配置MAC地址绑定功能的情况,请检查交换机的端口是否运行了Spanning-tree,802.1x,端口汇聚或者端口已经配置为Trunk端口。

相关主题