• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

03-二层技术-以太网交换配置举例

目录

01-H3C_MAC地址表典型配置举例

本章节下载 01-H3C_MAC地址表典型配置举例  (188.53 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S10500/S10500/Configure/Typical_Configuration_Example/H3C_S10500_CE-R7577P04-6W100/03/201904/1173321_30005_0.htm

01-H3C_MAC地址表典型配置举例

H3C MAC地址表典型配置举例

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

资料版本:6W100-20190330

产品版本:Release 7577P04

 

Copyright © 2019 新华三技术有限公司 版权所有,保留一切权利。

非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。

除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。

本文档中的信息可能变动,恕不另行通知



1  简介

本文档介绍了MAC地址表的配置举例。

2  配置前提

本文档中的配置均是在实验室环境下进行的配置和验证,配置前设备的所有参数均采用出厂时的缺省配置。如果您已经对设备进行了配置,为了保证配置效果,请确认现有配置和以下举例中的配置不冲突。

本文假设您已了解MAC地址表特性。

3  静态MAC地址表项典型配置举例

3.1  组网需求

图1所示:

·              某企业网络中,VLAN 100的用户群需要访问服务器。

·              如果有非法用户从其他接口假冒服务器的MAC地址发送报文,则服务器的MAC地址将在其他接口学到,导致用户不能与服务器正常通信,还会导致一些重要用户信息被窃取。

·              为提高服务器安全性,在Device上配置一条静态MAC地址表项,将服务器MAC地址0000-fc00-a249与接口XGE1/0/2绑定。

图1 静态MAC地址表项组网图

 

3.2  配置步骤

3.2.1  配置Device

# 创建VLAN 100,并将Ten-GigabitEthernet1/0/2加入VLAN 100。

<Device> system-view

[Device] vlan 100

[Device-vlan100] quit

[Device] interface ten-gigabitethernet 1/0/2

[Device-Ten-GigabitEthernet1/0/2] port link-mode bridge

[Device-Ten-GigabitEthernet1/0/2] port access vlan 100

[Device-Ten-GigabitEthernet1/0/2] undo shutdown

[Device-Ten-GigabitEthernet1/0/2] quit

# 将Device连接下级交换机的端口Ten-GigabitEthernet1/0/3的链路类型配置为Trunk,并允许VLAN 100的报文通过。

[Device] interface ten-gigabitethernet 1/0/3

[Device-Ten-GigabitEthernet1/0/3] port link-mode bridge

[Device-Ten-GigabitEthernet1/0/3] port link-type trunk

[Device-Ten-GigabitEthernet1/0/3] port trunk permit vlan 100

[Device-Ten-GigabitEthernet1/0/3] undo shutdown

[Device-Ten-GigabitEthernet1/0/3] quit

# 增加一个静态MAC地址表项,目的地址为0000-fc00-a249,出接口为Ten-GigabitEthernet1/0/2,且该接口属于VLAN 100。

[Device] mac-address static 0000-fc00-a249 interface ten-gigabitethernet 1/0/2 vlan 100

3.3  验证配置

(1)      假设VLAN 100的某个用户处于10.0.0.0/24网段,该用户能够和Server互通。

(2)      通过查看显示信息,验证配置是否成功。

# 查看Device的MAC地址表项信息。

[Device] display mac-address

MAC Address      VLAN ID    State            Port/NickName            Aging

0000-fc00-a249   100        Static           XGE1/0/2                 N

7425-8a02-4d00   100        Learned          XGE1/0/3                 Y

...

3.4  配置文件

·              Device

#

 sysname Device

#

vlan 1

#

vlan 100

#

interface Ten-GigabitEthernet1/0/2

 port link-mode bridge

 port access vlan 100

 mac-address static 0000-fc00-a249 vlan 100

#

interface Ten-GigabitEthernet1/0/3

 port link-mode bridge

 port link-type trunk

 port trunk permit vlan 1 100

#

4  MAC地址迁移监测典型配置举例

4.1  组网需求

图2所示,网络中三台设备之间因误接网线形成环路,由于这些设备都没有使能生成树协议,该环路网络产生了MAC地址迁移,导致设备MAC地址表震荡。

要求:

·              在Device A上通过配置MAC地址迁移抑制功能来消除环路。

·              通过查看MAC地址迁移记录来定位环路问题。

图2 MAC地址迁移监测组网图

 

4.2  配置思路

·              将设备之间互连的端口加入VLAN 100,实现二层转发。

·              在Device A上选择可能在环路上的一个或多个端口(例如XGE1/0/1)配置MAC地址迁移抑制功能。同时,为了方便观察端口状态变化,在Device A上开启对日志信息和调试信息的显示功能。

·              为了测试环路,在各设备上创建VLAN接口100并配置IP地址,然后在 Device A上ping Device B,查看MAC地址迁移记录。

4.3  配置步骤

4.3.1  配置Device A

# 开启当前终端对日志信息和调试信息的显示功能。

<DeviceA> terminal monitor

<DeviceA> terminal debugging

# 创建VLAN 100。将接口Ten-GigabitEthernet1/0/1和Ten-GigabitEthernet1/0/2的链路类型配置为Trunk,并允许VLAN 100的报文通过。

<DeviceA> system-view

[DeviceA] vlan 100

[DeviceA-vlan100] quit

[DeviceA] interface range ten-gigabitethernet 1/0/1 ten-gigabitethernet 1/0/2

[DeviceA-if-range] port link-mode bridge

[DeviceA-if-range] port link-type trunk

[DeviceA-if-range] port trunk permit vlan 100

[DeviceA-if-range] undo shutdown

[DeviceA-if-range] quit

# 设置MAC地址迁移抑制功能的抑制时间间隔为300秒。配置后,当端口因检测到MAC地址迁移而关闭后,需要经过5分钟才自动恢复up状态。

[DeviceA] mac-address notification mac-move suppression interval 300

# 设置MAC地址迁移抑制功能的检测阈值为0。配置后,只要系统在一个检测周期内(缺省为1分钟)监测到某端口出现一次MAC地址迁移,就把该端口关闭。

[DeviceA] mac-address notification mac-move suppression threshold 0

# 开启端口Ten-GigabitEthernet1/0/1的MAC地址迁移抑制功能。

[DeviceA] interface ten-gigabitethernet 1/0/1

[DeviceA-Ten-GigabitEthernet1/0/1] mac-address notification mac-move suppression

[DeviceA-Ten-GigabitEthernet1/0/1] quit

# 创建VLAN接口100并配置IP地址。

[DeviceA] interface vlan-interface 100

[DeviceA-Vlan-interface100] ip address 10.0.0.1 24

[DeviceA-Vlan-interface100] quit

4.3.2  配置Device B、Device C

Device C的配置与Device B类似,这里以Device B为例。

# 创建VLAN 100。将接口Ten-GigabitEthernet1/0/1和Ten-GigabitEthernet1/0/2的链路类型配置为Trunk,并允许VLAN 100的报文通过。

<DeviceB> system-view

[DeviceB] vlan 100

[DeviceB-vlan100] quit

[DeviceB] interface range ten-gigabitethernet 1/0/1 ten-gigabitethernet 1/0/2

[DeviceB-if-range] port link-mode bridge

[DeviceB-if-range] port link-type trunk

[DeviceB-if-range] port trunk permit vlan 100

[DeviceB-if-range] undo shutdown

[DeviceB-if-range] quit

# 创建VLAN接口100并配置IP地址。

[DeviceB] interface vlan-interface 100

[DeviceB-Vlan-interface100] ip address 10.0.0.2 24

[DeviceB-Vlan-interface100] quit

4.4  验证配置

在Device A上ping Device B,由于环路的存在,将会导致MAC地址迁移。可以在Device A上看到端口Ten-GigabitEthernet1/0/1自动关闭的日志信息:

[DeviceA] %Dec 11 09:51:06:309 2016 DeviceA IFNET/3/PHY_UPDOWN: -MDC=1; Physical state on the Ten-GigabitEthernet1/0/1 changed to down.

%Dec 11 09:51:06:323 2016 DeviceA IFNET/5/LINK_UPDOWN: -MDC=1; Line protocol state on

the interface Ten-GigabitEthernet1/0/1 changed to down.

# 显示Ten-GigabitEthernet1/0/1的详细信息,可以看到该端口down的原因为监测到MAC地址迁移。

[DeviceA] display interface ten-gigabitethernet 1/0/1

Ten-GigabitEthernet1/0/1

Current state: mac-address moving down

Line protocol state: DOWN

...

# 经过抑制时间5分钟后,端口Ten-GigabitEthernet1/0/1自动恢复up。

[DeviceA] %Dec 11 09:56:07:002 2016 DeviceA IFNET/3/PHY_UPDOWN: -MDC=1; Physical state on the Ten-GigabitEthernet1/0/1 changed to up.

%Dec 11 09:56:07:004 2016 DeviceA IFNET/5/LINK_UPDOWN: -MDC=1; Line protocol state on

the interface Ten-GigabitEthernet1/0/1 changed to up.

# 查看Device A的MAC地址迁移记录,可以看到同一条MAC地址表项(Device B的VLAN接口100的MAC地址)在Ten-GigabitEthernet1/0/1和Ten-GigabitEthernet1/0/2之间反复迁移,那么这两个端口之间存在环路。可以手工关闭其中一个端口来消除环路。

[DeviceA] display mac-address mac-move

MAC address    VLAN Current port  Source port   Last time              Times

0000-fc00-6506  100     XGE1/0/2     XGE1/0/1   2014-12-11 09:29:48        3

0000-fc00-6506  100     XGE1/0/1     XGE1/0/2   2014-12-11 09:51:03        4

 

---  2 MAC address moving records found  ---

4.5  配置文件

·              Device A

#

 sysname DeviceA

#

 mac-address notification mac-move suppression interval 300

 mac-address notification mac-move suppression threshold 0

#

vlan 1

#

vlan 100

#

interface Vlan-interface100

 ip address 10.0.0.1 255.255.255.0

#

interface Ten-GigabitEthernet1/0/1

 port link-mode bridge

 port link-type trunk

 port trunk permit vlan 1 100

 mac-address notification mac-move suppression

#

interface Ten-GigabitEthernet1/0/2

 port link-mode bridge

 port link-type trunk

 port trunk permit vlan 1 100

#

·              Device B

#

 sysname DeviceB

#

vlan 1

#

vlan 100

#

interface Vlan-interface100

 ip address 10.0.0.2 255.255.255.0

#

interface Ten-GigabitEthernet1/0/1

 port link-mode bridge

 port link-type trunk

 port trunk permit vlan 1 100

#

interface Ten-GigabitEthernet1/0/2

 port link-mode bridge

 port link-type trunk

 port trunk permit vlan 1 100

#

·              Device C

#

 sysname DeviceC

#

vlan 1

#

vlan 100

#

interface Vlan-interface100

 ip address 10.0.0.3 255.255.255.0

#

interface Ten-GigabitEthernet1/0/1

 port link-mode bridge

 port link-type trunk

 port trunk permit vlan 1 100

#

interface Ten-GigabitEthernet1/0/2

 port link-mode bridge

 port link-type trunk

 port trunk permit vlan 1 100

#

5  相关资料

·              H3C S10500系列交换机 二层技术-以太网交换配置指导-R757X

·              H3C S10500系列交换机 二层技术-以太网交换命令参考-R757X

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们