零 修订记录
序号 | 修订内容 | 修订时间 |
---|---|---|
1 | 新增 | 20211207 |
一 摘要
本文主要介绍交换机mac 相关配置
有mac 黑洞实验、
二 环境信息
华为模拟器
三 实验拓扑图
四 实验
(一)mac 黑洞实验
4.1.1 实验目的
在交换机上将mac地址设置为黑洞之后,该mac 地址无论是做为源地址还是目的地址 都无法ping 通。
4.1.2 实验步骤
4.1.2.1 mac 地址设置为黑洞
黑洞mac表项:防止虚机攻击
注意:一定要加vlan x ,否则不生效
全局:mac-ad blackhole 5489-9811-1111 vlan 1
[Huawei]mac-ad blackhole 5489-9811-1111 vlan 1
[Huawei]display mac-ad
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
5489-9811-1111 1 - - - blackhole -
5489-989e-6a29 1 - - GE0/0/3 static -
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 2
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
5489-988d-0dd0 1 - - GE0/0/10 dynamic 0/-
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 1
[Huawei] User interface con0 is available
4.1.2.2 作为源Ping
可以见作为源 无法ping通其他主机
4.1.2.4 作为目的地址
可见作为目的,也无法被ping 通。
(二) 动态安全mac
4.2.1 实验目的及结论
主要验证动态安全mac,动态安全mac;
动态安全mac ,一旦断电、接口shutdown ,该动态mac 策略就会丢失,存在安全漏洞,并不能实现mac 与端口永久绑定。比如我断电后 ,拔掉该端口设备,重新连上另一台设备,交换机重启后 新设备的mac 会和该端口动态绑定。
4.2.2 实验步骤
4.2.2.1 配置前 ping 主机查看交换机mac
[Huawei]display mac-ad
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
5489-989c-7755 1 - - GE0/0/2 dynamic 0/-
5489-988d-0dd0 1 - - GE0/0/10 dynamic 0/-
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 2
4.2.2.2 交换机端口动态安全mac
将gi 0/0/2 设置为动态安全
[Huawei]interface gi 0/0/2
[Huawei-GigabitEthernet0/0/2]port-sec
[Huawei-GigabitEthernet0/0/2]port-security enable
[Huawei-GigabitEthernet0/0/2]display this
Dec 7 2021 11:40:51-08:00 Huawei DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5
.25.191.3.1 configurations have been changed. The current change number is 4, th
e change loop count is 0, and the maximum number of records is 4095.
#
interface GigabitEthernet0/0/2
port-security enable
#
return
[Huawei-GigabitEthernet0/0/2]
4.2.2.3 重新ping 主机查看交换机mac
gi 0/0/2 端口 类型改为 security
[Huawei]display mac-ad
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
5489-989c-7755 1 - - GE0/0/2 security -
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 1
MAC address table of slot 0:
-------------------------------------------------------------------------------
MAC Address VLAN/ PEVLAN CEVLAN Port Type LSP/LSR-ID
VSI/SI MAC-Tunnel
-------------------------------------------------------------------------------
5489-988d-0dd0 1 - - GE0/0/10 dynamic 0/-
-------------------------------------------------------------------------------
Total matching items on slot 0 displayed = 1
[Huawei]
此时gi 0/0/2 口只允许5489-989c-7755 该mac 通行。
比如把pc mac 修改下,ping 不通了。