实验 二层交换机端口与MAC地址的绑定(教师用)_第1页
实验 二层交换机端口与MAC地址的绑定(教师用)_第2页
实验 二层交换机端口与MAC地址的绑定(教师用)_第3页
实验 二层交换机端口与MAC地址的绑定(教师用)_第4页
实验 二层交换机端口与MAC地址的绑定(教师用)_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 模块六 二层交换机端口与MAC地址绑定【场景构建】在日常工作中,经常会发生用户随意插拔交换机上的网线,给网管员在网络管理上带来一定的不便。同时也会出现在一个交换机端口下连接另一个Hub或交换机,导致网络线路的拥堵。当网络中某机器由于中毒进而引发大量的广播数据包在网络中洪泛时,网络管理员的唯一想法就是尽快地找到根源主机并把它从网络中暂时隔离开。当网络的布置很随意时,任何用户只要插上网线,在任何位置都能够上网,这虽然使正常情况下的大多数用户很满意,但一旦发生网络故障,网管人员却很难快速准确定位根源主机。 希望通过一定的方法,固定每台计算机连接的交换机端口,方便网管员日常的维护与更新。实验目的1、

2、 了解什么是交换机的MAC绑定功能; 2、 熟练掌握MAC与端口绑定的静态、动态方式。 【知识准备】通过端口绑定特性,网络管理员可以将用户的MAC 地址和IP 地址绑定到指定的端口上。进行绑定操作后,交换机只对从该端口收到的指定MAC 地址和IP 地址的用户发出的报文进行转发,提高了系统的安全性,增强了对网络安全的监控。我们通常说的MAC地址与交换机端口绑定其实就是交换机端口安全功能。端口安全功能能让您配置一个端口只允许一台或者几台确定的设备访问那个交换机;能根据MAC地址确定允许访问的设备;允许访问的设备的MAC地址既可以手工配置,也可以从交换机“学到”;当一个未批准的MAC地址试图访问端口

3、的时候,交换机会挂起或者禁用该端口等等。【实验一】 二层交换机端口静态绑定MAC地址1.1 实验设备1、2950-24交换机1台 2、PC机2台 3、交叉线1根 4、直通网线2根 1.2 组网图1.3 实验设备IP地址及要求设备名IP地址子网掩码VLAN 1192.168.1.11 255.255.255.0PC1192.168.1.1255.255.255.0PC2 192.168.1.2255.255.255.0PC1连接F0/1端口,并且在F0/1上将PC1的MAC地址绑定,PC1能PING通交换机。PC2连接F0/2端口,并且在F0/2上将PC2的MAC地址绑定,PC2能PING通交换

4、机。若将PC1更换到F0/2上,则不能PING通交换机。同理PC2更换到F0/1上,也不能PING通交换机。1.4配置过程和解释PC机上的IP地址请自行设置完成。第一步:得到PC1主机的mac地址 PCipconfig /allPhysical Address.: 00E0.A323.5CE1IP Address.: 192.168.1.1Subnet Mask.: 255.255.255.0Default Gateway.: 0.0.0.0DNS Servers.: 0.0.0.0我们得到了PC1主机的mac地址为:00E0.A323.5CE1第二步:配置交换机的IP地址 Switch(co

5、nfig)#int vlan 1Switch(config-if)#ip add 192.168.1.11 255.255.255.0Switch(config-if)#no shutdownSwitch(config-if)#exit第三步:使能F0/1端口的MAC地址绑定功能 Switch(Config)#interface F0/1 Switch(config-if)#switchport mode access 将端口模式设置为access模式Switch(config-if)#switchport port-security命令:switchport port-security no

6、 switchport port-security 功能:使能端口MAC地址绑定功能;本命令的no操作为关闭端口MAC地址绑定功能。 命令模式:端口配置模式 缺省情况:交换机端口不打开MAC地址绑定功能。 使用指南:MAC地址绑定功能与802.1x、Spanning Tree、端口汇聚功能存在互斥关系,因此如果要打开端口的MAC地址绑定功能,就必须关闭端口上的802.1x、Spanning Tree、端口汇聚功能,且打开MAC地址绑定功能的端口不能是Trunk口。 Switch(config-if)#第四步:添加端口静态安全MAC地址,缺省端口最大安全MAC地址数为1 Switch(confi

7、g-if)#switchport port-security mac-address 00E0.A323.5CE1 命令:switchport port-security mac-address no switchport port-security mac-address 功能:添加静态安全MAC地址;本命令的no操作为删除静态安全MAC地址。 命令模式:端口配置模式 参数:为添加/删除的MAC地址。 使用指南:端口必须使能MAC地址绑定功能之后才能添加端口静态安全MAC地址。 第五步:配置违反MAC安全采取的措施Switch(config-if)#switchport port-secur

8、ity violation restrict 命令:switchport port-security violation protect | restrict | shutdown no switchport port-security violation 功能: 当超过设定MAC地址数量的最大值,或访问该端口的设备MAC地址不是这个MAC地址表中该端口的MAC地址,或同一个VLAN中一个MAC地址被配置在几个端口上时,就会引发违反MAC地址安全。命令模式:端口配置模式参数:protect(保护模式):丢弃数据包,不发警告。 restrict(限制模式):丢弃数据包,发警告,发出SNMP tr

9、ap,同时被记录在syslog日志里。 shutdown(关闭模式):这是交换机默认模式,在这种情况下端口立即变为err-disable状态,并且关掉端口灯,发出SNMP trap,同时被记录在syslog日志里,除非管理员手工激活,否则该端口失效。查看配置: Switch#show port-security address 命令:show port-security address interface 功能:显示端口安全MAC地址。 命令模式:特权配置模式 参数: 指定的显示端口。 使用指南:本命令显示端口安全MAC地址信息,如果不指定端口则显示所有端口安全MAC地址。显Secure Ma

10、c Address Table-Vlan Mac Address Type Ports Remaining ge(mins)- - - - -1 00E0.A323.5CE1 DynamicConfigured FastEthernet0/1- 验证配置:PC1连接在F0/1上,使能F0/1端口Switch(config)#int f0/1Switch(config-if)#shutdown Switch(config-if)#no shutdown PC1与交换机的PING命令测试结果PCping 192.168.1.11Pinging 192.168.1.11 with 32 bytes

11、of data:Reply from 192.168.1.11: bytes=32 time=31ms TTL=255Reply from 192.168.1.11: bytes=32 time=31ms TTL=255Reply from 192.168.1.11: bytes=32 time=31ms TTL=255Reply from 192.168.1.11: bytes=32 time=31ms TTL=255Ping statistics for 192.168.1.11: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Ap

12、proximate round trip times in milli-seconds: Minimum = 31ms, Maximum = 31ms, Average = 31ms第六步:将PC2的MAC地址绑定在F0/2端口上配置命令与F0/1端口绑定PC1的MAC地址相同PC1连接在F0/2上,使能F0/2端口Switch(config)#int f0/2Switch(config-if)#shutdown Switch(config-if)#no shutdown PCping 192.168.1.11Pinging 192.168.1.11 with 32 bytes of data

13、:Request timed out.Request timed out.Request timed out.Reply from 192.168.1.11: bytes=32 time=32ms TTL=255Ping statistics for 192.168.1.11: Packets: Sent = 4, Received = 1, Lost = 3 (75% loss),Approximate round trip times in milli-seconds: Minimum = 32ms, Maximum = 32ms, Average = 32ms1.5完整的配置文档Swit

14、ch#sho run Building configuration.!interface FastEthernet0/1 switchport mode access switchport port-security switchport port-security mac-address 00E0.A323.5CE1!interface FastEthernet0/2switchport mode access switchport port-security switchport port-security mac-address 00D0.FFA4.BEB3!interface Fast

15、Ethernet0/3!interface FastEthernet0/24!interface Vlan1 ip address 192.168.1.11 255.255.255.0!End1.6 实验验证PC连接的端口PING结果原因PC1F0/1192.168.1.11PC1F0/2192.168.1.11PC2F0/1192.168.1.11PC2F0/2192.168.1.11【实验二】在一个端口上静态绑定多个MAC地址2.1实验设备1、2950-24交换机1台 2、PC机4台 3、交叉线1根 4、直通网线4根 2.2组网图2.3实验设备IP地址及要求设备名IP地址子网掩码VLAN

16、1192.168.1.11 255.255.255.0PC1192.168.1.1255.255.255.0PC2 192.168.1.2255.255.255.0PC3192.168.1.3255.255.255.0PC4192.168.1.4255.255.255.0将PC1、PC2、PC3的MAC地址都绑定在F0/1端口上,并且分别将三台计算机连接在F0/1端口上都能PING通交换机,但更换为PC4后则不能PING通交换机。2.4配置过程和解释第一步:得到PC1主机的mac地址 PCipconfig /all第二步:配置交换机的IP地址 Switch(config)#int vlan 1

17、Switch(config-if)#ip add 192.168.1.11 255.255.255.0Switch(config-if)#no shutdownSwitch(config-if)#exit第三步:使能F0/1端口的MAC地址绑定功能 Switch(Config)#interface F0/1 Switch(config-if)#switchport mode access Switch(config-if)#switchport port-security第四步:添加端口静态安全MAC地址,端口最大安全MAC地址数为3Switch(config-if)#switchport p

18、ort-security maximum 3命令:switchport port-security maximum no switchport port-security maximum 功能:设置端口最大安全MAC地址数;本命令的no操作为恢复最大安全地址数为1。 命令模式:端口配置模式 参数: 端口静态安全MAC地址上限,取值范围1132。 缺省情况:端口最大安全MAC地址数为1。 使用指南:端口必须使能MAC地址绑定功能之后才能设置端口安全MAC地址上限。如果端口静态安全MAC地址数大于设置的最大安全MAC地址数,则设置失败;必须删除端口的静态安全MAC地址,直到端口静态安全MAC地址数

19、不大于设置的最大安全MAC地址数,设置才会成功。 Switch(config-if)#switchport port-security mac-address aaaa.aaaa.aaaaSwitch(config-if)#switchport port-security mac-address aaaa.aaaa.bbbbSwitch(config-if)#switchport port-security mac-address aaaa.aaaa.cccc当添加第四个MAC地址时,会显示如下信息:Total secure mac-addresses on interface FastEth

20、ernet0/1 has reached maximum limit.第五步:配置违反MAC安全采取的措施Switch(config-if)#switchport port-security violation restrict 查看配置: Switch#show port-security address Secure Mac Address Table-VlanMac Address Type Ports Remaining Age(mins)- - - -1 AAAA.AAAA.AAAASecureConfiguredFastEthernet0/1-1 AAAA.AAAA.BBBBSec

21、ureConfiguredFastEthernet0/1-1 AAAA.AAAA.CCCCSecureConfiguredFastEthernet0/1-Total Addresses in System (excluding one mac per port) : 3Max Addresses limit in System (excluding one mac per port) : 10242.5完整的配置文档Switch#sho run Building configuration.!interface FastEthernet0/1 switchport mode access sw

22、itchport port-security switchport port-security maximum 3 switchport port-security mac-address AAAA.AAAA.AAAA switchport port-security mac-address AAAA.AAAA.BBBBswitchport port-security mac-address AAAA.AAAA.CCCC!interface FastEthernet0/2!interface FastEthernet0/24!interface Vlan1 ip address 192.168

23、.1.11 255.255.255.0!End2.6实验验证PC连接的端口PING结果原因PC1F0/1192.168.1.11PC2F0/1192.168.1.11PC3F0/1192.168.1.11PC4F0/1192.168.1.11【实验三】二层交换机端口动态绑定MAC地址3.1实验设备1、2950-24交换机1台 2、PC机4台 3、交叉线1根 4、直通网线4根 3.2组网图3.3实验设备IP地址及要求设备名IP地址子网掩码VLAN 1192.168.1.11 255.255.255.0PC1192.168.1.1255.255.255.0PC2 192.168.1.2255.25

24、5.255.0PC3192.168.1.3255.255.255.0PC4192.168.1.4255.255.255.0 在F0/1端口使用动态绑定功能,使端口能动态学习3个MAC地址,当学习数超过设定学习的最大值,端口将停止学习。3.4配置过程和解释第一步:得到PC1主机的mac地址 PCipconfig /all第二步:配置交换机的IP地址 Switch(config)#int vlan 1Switch(config-if)#ip add 192.168.1.11 255.255.255.0Switch(config-if)#no shutdownSwitch(config-if)#exit第三步:使能F0/1端口的MAC地址绑定功能 Switch(Config)#interface F0/1 Switch(config-if)#switchport mode access Switch(config-if)#switchport port-security第四步:动态添加端口安全MAC地址,端口最大安全MAC地址数为3Switch(config-if)#switchport port-security maximum 3Switch(config-if)#swi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论