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

环境 Cisco Packet Tracer 5.3 Windows 10 操作 操作:按照如图所示连接拓扑图 1、进入相应的接口 (以端口1设置Mac地址绑定,PC0接1端口举例) Switch>enable Switch#config Configuring from terminal, memory, or network [terminal]? Enter configuration commands,

环境

  • Cisco Packet Tracer 5.3
  • Windows 10

操作

操作:按照如图所示连接拓扑图
image.png
1、进入相应的接口
(以端口1设置Mac地址绑定,PC0接1端口举例)

1
2
3
4
5
6
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模式

1
Switch(config-if)#switchport mode access

3、启用安全端口

1
2
3
4
5
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地址。)

1
Switch(config-if)#switchport port-security mac-address 0001.C94E.1321

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

1
Switch#show port-security address

若将pc0与端口1的连线断掉,改用pc3接端口1。在进行 pc3 ping pc2 不通(图示如下)
image.png
改回pc1依然不通,需重启路由器该端口

1
2
3
4
5
6
7
8
9
10
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)#

Cisco PT 案例六:交换机端口与Mac地址绑定
https://www.frytea.com/post/20200619175104.html
作者
Tianlun Song
发布于
2020年6月19日
更新于
2024年6月10日
许可协议