为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

7交换机端口与MAC绑定

2017-10-15 15页 doc 49KB 19阅读

用户头像

is_729658

暂无简介

举报
7交换机端口与MAC绑定7交换机端口与MAC绑定 交换机端口与MAC绑定 1、 了解什么是交换机的MAC绑定功能; 2、 熟练掌握MAC与端口绑定的静态、动态方式。 1、 当网络中某机器由于中毒进而引发大量的广播数据包在网络中洪泛时,网络管理员 的唯一想法就是尽快地找到根源主机并把它从网络中暂时隔离开。当网络的布置很 随意时,任何用户只要插上网线,在任何位置都能够上网,这虽然使正常情况下的 大多数用户很满意,但一旦发生网络故障,网管人员却很难快速准确定位根源主机, 就更谈不上将它隔离了。端口与地址绑定技术使主机必须与某一端口进行绑定,也 就是说...
7交换机端口与MAC绑定
7交换机端口与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,检验理论是否和实验一致。 Microsoft Windows XP [版本 5.1.2600] (C) 版权所有 1985-2001 Microsoft Corp. C:\>ipconfig/all Windows IP Configuration Host Name . . . . . . . . . . . . : xuxp Primary Dns Suffix . . . . . . . : digitalchina.com Node Type . . . . . . . . . . . . : Broadcast IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter 本地连接: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) PRO/100 VE Network Connecti on Physical Address. . . . . . . . . : Dhcp Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Autoconfiguration IP Address. . . : 169.254.27.232 Subnet Mask . . . . . . . . . . . : 255.255.0.0 Default Gateway . . . . . . . . . : C:\> 我们得到了PC1主机的mac地址为:00-A0-D1-D1-07-FF。 switch(Config)#interface vlan 1 switch(Config-If-Vlan1)#ip address 192.168.1.11 255.255.255.0 switch(Config-If-Vlan1)#no shut switch(Config-If-Vlan1)#exit switch(Config)# switch(Config)#interface ethernet 0/0/1 switch(Config-Ethernet0/0/1)#switchport port-security switch(Config-Ethernet0/0/1)# switch(Config-Ethernet0/0/1)#switchport port-security mac-address 00-a0-d1-d1-07-ff Security Port MaxSecurityAddr CurrentAddr Security Action (count) (count) --------------------------------------------------------------------------- Ethernet0/0/1 1 1 Protect --------------------------------------------------------------------------- Max Addresses limit per port :128 Total Addresses in System :1 switch# Security Mac Address Table --------------------------------------------------------------------------- Vlan Mac Address Type Ports 1 00-a0-d1-d1-07-ff SecurityConfigured Ethernet0/0/1 --------------------------------------------------------------------------- Total Addresses in System :1 Max Addresses limit in System :128 switch# 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 通 Switch(Config-Ethernet0/0/1)#switchport port-security maximum 4 Switch(Config-Ethernet0/0/1)#switchport port-security mac-address aa-aa-aa-aa-aa-aa Switch(Config-Ethernet0/0/1)#switchport port-security mac-address aa-aa-aa-bb-bb-bb Switch(Config-Ethernet0/0/1)#switchport port-security mac-address aa-aa-aa-cc-cc-cc switch#show port-security Security Port MaxSecurityAddr CurrentAddr Security Action (count) (count) --------------------------------------------------------------------------- Ethernet0/0/1 4 4 Protect --------------------------------------------------------------------------- Max Addresses limit per port :128 Total Addresses in System :4 switch#show port-security address Security Mac Address Table --------------------------------------------------------------------------- Vlan Mac Address Type Ports 1 00-a0-d1-d1-07-ff SecurityConfigured Ethernet0/0/1 1 aa-aa-aa-aa-aa-aa SecurityConfigured Ethernet0/0/1 1 aa-aa-aa-bb-bb-bb SecurityConfigured Ethernet0/0/1 1 aa-aa-aa-cc-cc-cc SecurityConfigured Ethernet0/0/1 --------------------------------------------------------------------------- Total Addresses in System :4 Max Addresses limit in System :128 switch# 上面使用的都是静态捆绑MAC的方法,下面介绍动态mac地址绑定的基本方法,首先清 空刚才做过的捆绑。 switch(Config)# switch(Config)#int ethernet 0/0/1 switch(Config-Ethernet0/0/1)#no switchport port-security switch(Config-Ethernet0/0/1)#exit switch(Config)#exit switch#show port-security Security Port MaxSecurityAddr CurrentAddr Security Action (count) (count) --------------------------------------------------------------------------- --------------------------------------------------------------------------- Max Addresses limit per port :128 Total Addresses in System :0 MACMAC switch(Config)#interface ethernet 0/0/1 switch(Config-Ethernet0/0/1)#switchport port-security switch(Config-Ethernet0/0/1)#switchport port-security lock switch(Config-Ethernet0/0/1)#switchport port-security convert switch(Config-Ethernet0/0/1)#exit 验证配置: switch#show port-security address Security Mac Address Table --------------------------------------------------------------------------- Vlan Mac Address Type Ports 1 00-a0-d1-d1-07-ff SecurityConfigured Ethernet0/0/1 --------------------------------------------------------------------------- Total Addresses in System :1 Max Addresses limit in System :128 switch# 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端口。MAC绑定在 端口上与这些配置是互斥的,如果该端口要打开MAC地址绑定功能,就必须首先 确认端口下的上述功能已经被关闭。 2、 当动态学习MAC时,无法执行“convert”命令时,请检查PC机网卡是否和该端口 正确连接。 3、 端口Lock之后,该端口MAC地址学习功能被关闭,不允许其他的MAC进入该端口。 略 1、 使用三台PC测试端口与MAC绑定功能。 2、 实现多个端口统一绑定。 switchport port-security switchport port-security no switchport port-security 使能端口MAC地址绑定功能;本命令的no操作为关闭端口MAC地址绑定功能。 端口配置模式 交换机端口不打开MAC地址绑定功能。 MAC地址绑定功能与802.1x、Spanning Tree、端口汇聚功能存在互斥关系,因此如果要打开端口的MAC地址绑定功能,就必须关闭端口上的802.1x、Spanning Tree、端 口汇聚功能,且打开MAC地址绑定功能的端口不能是Trunk口。 使能端口1的MAC地址绑定功能。 Switch(Config)#interface Ethernet 0/0/1 Switch(Config-Ethernet0/0/1)#switchport port-security switchport port-security convert switchport port-security convert 将端口学习到的动态MAC地址转化为静态安全MAC地址。 端口配置模式 必须在安全端口锁定之后才能执行端口动态MAC地址转化命令。执行此命令之后,端口学习到的动态MAC地址将转化为静态安全MAC地址。该命令没有配置保留。 将端口1的MAC地址转化为静态安全MAC地址。 Switch(Config)#interface Ethernet 0/0/1 Switch(Config-Ethernet0/0/1)#switchport port-security convert switchport port-security lock switchport port-security lock no switchport port-security lock 锁定端口。端口被锁定之后,端口的MAC地址学习功能将被关闭;本命令的no操 作为恢复端口的MAC地址学习功能。 端口配置模式 端口未锁定 端口必须使能MAC地址绑定功能之后才能执行端口锁定命令。执行端口锁定命 令之后,端口将关闭动态MAC学习功能。 锁定端口1。 Switch(Config)#interface Ethernet 0/0/1 Switch(Config-Ethernet0/0/1)#switchport port-security lock switchport port-security timeout switchport port-security timeout no switchport port-security timeout 设置端口锁定的定时器;本命令的no操作为恢复缺省值。 锁定时器时间间隔,取值范围为0~300s。 端口配置模式 端口未打开端口锁定的定时器。 端口锁定定时器功能是一种动态MAC地址锁定功能,锁定定时器超时就执行 MAC地址锁定操作及将动态MAC转换为安全MAC地址的操作。端口必须先开启MAC地址绑定功能后才能使用此命令。 设置端口1的锁定时器为30秒。 Switch(Config)#interface Ethernet 0/0/1 switchport port-security mac-address Switch(Config-Ethernet0/0/1)# switchport port-security timeout 30 switchport port-security mac-address no switchport port-security mac-address 添加静态安全MAC地址;本命令的no操作为删除静态安全MAC地址。 端口配置模式 为添加/删除的MAC地址。 端口必须使能MAC地址绑定功能之后才能添加端口静态安全MAC地址。 添加MAC 00-03-0F-FE-2E-D3到端口1。 Switch(Config)#interface Ethernet 0/0/1 Switch(Config-Ethernet0/0/1)#switchport port-security mac-address 00-03-0F-FE-2E-D3 clear port-security dynamic clear port-security dynamic [address | interface ] 清除指定端口的动态MAC地址。 特权配置模式 为MAC地址;为指定的端口号。 必须在安全端口锁定之后之后才能执行指定端口的动态MAC清除操作。如果不指定端口、MAC地址,则清除所有锁定的安全端口的动态MAC;如果仅指定端口,不指定MAC地址,则清除指定端口的所有动态MAC地址。 删除端口1动态MAC。 Switch#clear port-security dynamic interface Ethernet 0/0/1 switchport port-security maximum switchport port-security maximum no switchport port-security maximum 设置端口最大安全MAC地址数;本命令的no操作为恢复最大安全地址数为1。 端口配置模式 端口静态安全MAC地址上限,取值范围1~128。 端口最大安全MAC地址数为1。 端口必须使能MAC地址绑定功能之后才能设置端口安全MAC地址上限。如果端口静态安全MAC地址数大于设置的最大安全MAC地址数,则设置失败;必须删除端口 的静态安全MAC地址,直到端口静态安全MAC地址数不大于设置的最大安全MAC地址数,设置才会成功。 设置端口1安全MAC地址上限为4。 Switch(Config)#interface Ethernet 0/0/1 Switch(Config-Ethernet0/0/1)#switchport port-security maximum 4 switchport port-security violation switchport port-security violation {protect | shutdown} no switchport port-security violation 设置端口违背模式;本命令的no操作为恢复违背模式为protect。 端口配置模式 protect为保护模式;shutdown为关闭模式。 端口违背模式为缺省为protect。 端口必须使能MAC地址绑定功能之后才能设置端口违背模式。如果端口违背模 式设置为protect,那么当端口安全MAC地址超过设置的端口安全MAC上限的时候,端口仅仅关闭动态MAC地址学习功能;如果端口违背模式设置为shutdown,那么当端口安全MAC地址超过设置的端口安全MAC上限的时候,端口将被关闭,用户可以通过no shutdown命令手工打开该端口。 设置端口1的违背模式为shutdown。 Switch(Config)#interface Ethernet 0/0/1 Switch(Config-Ethernet0/0/1)#switchport port-security violation shutdown show port-security show port-security 显示全局安全端口配置情况。 特权配置模式 交换机不显示安全端口配置情况。 本命令显示交换机当前已经配置为安全端口的端口信息 。 Switch#show port-security Security Port MaxSecurityAddr CurrentAddr Security Action (count) (count) ----------------------------------------------------------------- Ethernet0/0/3 1 1 Protect Ethernet0/0/4 10 1 Protect Ethernet0/0/5 1 0 Protect ----------------------------------------------------------------- Total Addresses in System :2 Max Addresses limit in System :128 显示信息 解释 Security Port 配置为安全端口的端口名 MaxSecurityAddr 安全端口设置的最大安全MAC地址数 CurrentAddr 安全端口当前安全MAC地址数 Security Action 端口设置的违背模式 Total Addresses in System 系统中当前安全MAC地址数 Max Addresses limit in System 系统中最大安全MAC地址数 show port-security interface show port-security interface 显示安全端口配置情况。 特权配置模式 指定的显示端口。 交换机不显示安全端口配置情况。 本命令显示交换机安全端口的详细配置信息。 Switch#show port-security interface ethernet 0/0/1 Port Security :Enabled Port status :Security Up Violation mode :Protect Maximum MAC Addresses :1 Total MAC Addresses :1 Configured MAC Addresses :1 Lock Timer is ShutDown Mac-Learning function is : Opened 显示信息 解释 Port Security : 端口是否使能为安全端口 Port status : 端口安全状态 Violation mode : 端口设置的违背模式 Maximum MAC Addresses : 端口设置的安全MAC地址上限 Total MAC Addresses : 端口当前安全MAC地址数 Configured MAC Addresses : 端口静态配置的安全MAC地址数 Lock Timer 端口是否开启锁定的定时器(定时器时间) Mac-Learning function 端口MAC地址学习功能是否打开 show port-security address show port-security address [interface ] 显示端口安全MAC地址。 特权配置模式 指定的显示端口。 本命令显示端口安全MAC地址信息,如果不指定端口则显示所有端口安全MAC地址。显示举例如下: Switch#show port-security address interface ethernet 0/0/1 Security Mac Address Table ------------------------------------------------------------------------ Vlan Mac Address Type Ports 1 0000.0000.1111 SecureConfigured Ethernet0/0/3 ------------------------------------------------------------------------ Total Addresses :1 显示信息 解释 Vlan 安全MAC地址的VLAN ID Mac Address 安全MAC地址 Type 安全MAC地址类型 Ports 安全MAC地址所属端口 Total Addresses 系统中当前安全MAC地址数
/
本文档为【7交换机端口与MAC绑定】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索