首页
学习
活动
专区
圈层
工具
发布
清单首页cisco文章详情

Cisco PT 案例六:交换机端口与Mac地址绑定

环境

  • Cisco Packet Tracer 5.3
  • Windows 10

操作

操作:按照如图所示连接拓扑图

1、进入相应的接口

(以端口1设置Mac地址绑定,PC0接1端口举例)

代码语言:javascript
复制
Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#
Switch(config)#interface fastEthernet 0/1

2、接口设为access模式

代码语言:javascript
复制
Switch(config-if)#switchport mode access

3、启用安全端口

代码语言:javascript
复制
Switch(config-if)#switchport port-security
(查看mac-address绑定的几种方式,分别为静态绑定和粘滞绑定)
Switch(config-if)#switchport port-security mac-address ?
H.H.H   48 bit mac address
sticky  Configure dynamic secure addresses as sticky

第一种:动态配置

第二种:静态配置

(其中代码的最后一列为主机的Mac地址。寻找方法:单击主机→配置→fastEthernet→mac地址。)

代码语言:javascript
复制
Switch(config-if)#switchport port-security mac-address 0001.C94E.1321

设置完成后,用主机pc0 ping pc2,然后可以在特权模式下通过以下命令查看以下(ctrl+z,快速回到特权模式下)

代码语言:javascript
复制
Switch#show port-security address

若将pc0与端口1的连线断掉,改用pc3接端口1。在进行 pc3 ping pc2 不通(图示如下)

改回pc1依然不通,需重启路由器该端口

代码语言:javascript
复制
Switch(config-if)#shutdown

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down
Switch(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

Switch(config-if)#

Author: Frytea

Title: Cisco PT 案例六:交换机端口与Mac地址绑定

Link: https://cloud.tencent.com/developer/article/1662407

Copyright: This work by TL-Song is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

下一篇
举报
领券