03-Layer 2 Command Reference

HomeSupportReference GuidesCommand ReferencesH3C Access Controllers Command References(E3703P61 R2509P61 R3709P61 R2609P61 R3509P61)-6W10203-Layer 2 Command Reference
04-MAC Address Table Commands
Title Size Download
04-MAC Address Table Commands 63.42 KB

MAC address table commands

The MAC address table contains only Layer 2 Ethernet interfaces and Layer 2 aggregate interfaces.

This document covers only the configuration of unicast MAC address entries, including static, dynamic, and destination blackhole MAC address entries.

display mac-address

Use display mac-address to display MAC address entries.

Syntax

display mac-address [ mac-address [ vlan vlan-id ] | [ [ dynamic | static ] [ interface interface-type interface-number ] | blackhole ] [ vlan vlan-id ] [ count ] ] [ | { begin | exclude | include } regular-expression ]

Views

Any view

Default command level

1: Monitor level

Parameters

blackhole: Displays destination blackhole MAC address entries. These entries do not age, but you can add or remove them. The packets whose destination MAC addresses match destination blackhole MAC address entries are dropped.

vlan vlan-id: Specifies a VLAN in the range of 1 to 4094.

count: Displays the number of MAC address entries that match all entry attributes you specify in the command. When this keyword is used, the command displays only the number of specified MAC address entries, rather than related information about these MAC address entries.

mac-address: Specifies a MAC address in the format of H-H-H.

dynamic: Displays dynamic MAC address entries, which can be aged.

static: Displays static MAC address entries, which do not age.

interface interface-type interface-number: Specifies an interface by its type and number.

|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.

begin: Displays the first line that matches the specified regular expression and all lines that follow.

exclude: Displays all lines that do not match the specified regular expression.

include: Displays all lines that match the specified regular expression.

regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.

Usage guidelines

If you execute this command without specifying any parameters, it displays all MAC address entries on the device.

Examples

# Display the MAC address entry for MAC address 000f-e201-0101.

<Sysname> display mac-address 000f-e201-0101

MAC ADDR        VLAN ID    STATE            PORT INDEX              AGING TIME(s)

000f-e201-0101  1          Learned          GigabitEthernet1/0/1    AGING

 

  ---  1 mac address(es) found  --- 

Table 1 Command output

Field

Description

MAC ADDR

MAC address.

VLAN ID

ID of the VLAN to which the MAC address belongs.

STATE

State of a MAC address entry:

·     Config static—Static entry manually configured by the user.

·     Config dynamic—Dynamic entry manually configured by the user.

·     Learned—Entry learned by the device.

·     Blackhole—Destination blackhole entry.

PORT INDEX

Outgoing interface for packets that are destined for the MAC address. This field displays N/A for a blackhole MAC address entry.

AGING TIME(s)

Aging time:

·     AGING—The entry is aging.

·     NOAGED—The entry does not age.

1 mac address(es) found

Number of matching MAC address entries.

 

Related commands

·     mac-address

·     mac-address timer

display mac-address aging-time

Use display mac-address aging-time to display the aging timer for dynamic MAC address entries.

Syntax

display mac-address aging-time [ | { begin | exclude | include } regular-expression ]

Views

Any view

Default command level

1: Monitor level

Parameters

|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.

begin: Displays the first line that matches the specified regular expression and all lines that follow.

exclude: Displays all lines that do not match the specified regular expression.

include: Displays all lines that match the specified regular expression.

regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.

Examples

# Display the aging timer for dynamic entries in the MAC address table.

<Sysname> display mac-address aging-time

Mac address aging time: 300s

The output shows that the aging timer for dynamic entries in the MAC address table is 300 seconds.

Related commands

·     display mac-address

·     mac-address (interface view)

·     mac-address (system view)

·     mac-address timer

display mac-address mac-learning

Use display mac-address mac-learning to display the MAC address learning status of the specified or all Layer 2 Ethernet, Layer 2 aggregate, and WLAN-ESS interfaces.

Syntax

display mac-address mac-learning [ interface-type interface-number ] [ | { begin | exclude | include } regular-expression ]

Views

Any view

Default command level

1: Monitor level

Parameters

interface-type interface-number: Specifies an interface by its type and number.

|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.

begin: Displays the first line that matches the specified regular expression and all lines that follow.

exclude: Displays all lines that do not match the specified regular expression.

include: Displays all lines that match the specified regular expression.

regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.

Examples

# Display MAC address learning status of all Ethernet interfaces.

<Sysname> display mac-address mac-learning

Mac address learning status of the switch: enable

 

PortName                    Learning Status

Bridge-Aggregation1               enable                                       

GigabitEthernet1/0/1              enable                                       

GigabitEthernet1/0/2              enable                                        

GigabitEthernet1/0/3              enable                                       

GigabitEthernet1/0/4              enable                                       

Ten-GigabitEthernet1/0/5          enable                                       

WLAN-ESS0                         enable

WLAN-DBSS0:2                      enable

Table 2 Command output

Field

Description

Mac-address learning status of the switch

Global MAC address learning status (enabled or disabled).

Learning Status

MAC address learning status (enabled or disabled) for an interface.

 

display mac-address statistics

Use display mac-address statistics to display the statistics of the MAC address table.

Syntax

display mac-address statistics [ | { begin | exclude | include } regular-expression ]

Views

Any view

Default command level

1: Monitor level

Parameters

|: Filters command output by specifying a regular expression. For more information about regular expressions, see Fundamentals Configuration Guide.

begin: Displays the first line that matches the specified regular expression and all lines that follow.

exclude: Displays all lines that do not match the specified regular expression.

include: Displays all lines that match the specified regular expression.

regular-expression: Specifies a regular expression, a case-sensitive string of 1 to 256 characters.

Examples

# Display the statistics of the MAC address table.

<Sysname> display mac-address statistics                                           

MAC TYPE            LEARNED   USER-DEFINED   SYSTEM-DEFINED IN-USE    AVAILABLE

Dynamic   Unicast   20         0             0              20                 

Static    Unicast   0          0             0              0         8192     

Total     Unicast                                           20        8192     

                                                                               

Dynamic Multicast   0          0             0              0                  

Static  Multicast   0          0             0              0         0        

Total   Multicast                                           0         0     

Table 3 Command output

Field

Description

MAC TYPE

MAC address type:

·     Dynamic Unicast.

·     Static Unicast.

·     Total Unicast.

LEARNED

Dynamically learned MAC addresses.

USER-DEFINED

User defined MAC addresses (dynamic and static).

SYSTEM-DEFINED

MAC addresses generated by the system (for example, 802.1X and MAC authentication).

IN-USE

Number of existing MAC addresses of a specific type.

AVAILABLE

Maximum number of MAC addresses supported by the system.

 

mac-address (interface view)

Use mac-address to add or modify a MAC address entry on a specified interface.

Use undo mac-address to remove a MAC address entry on the interface.

Syntax

mac-address { dynamic | static } mac-address vlan vlan-id

undo mac-address { dynamic | static } mac-address vlan vlan-id

Default

No MAC address entry is configured.

Views

Layer 2 Ethernet interface view, Layer 2 aggregate interface view

Default command level

2: System level

Parameters

dynamic: Specifies dynamic MAC address entries. These entries can age.

static: Specifies static MAC address entries. These entries do not age, but you can add or remove them.

mac-address: Specifies a MAC address in the format of H-H-H, where 0s at the beginning of each H (16-bit hexadecimal digit) can be omitted. For example, entering "f-e2-1" indicates that the MAC address is "000f-00e2-0001."

vlan vlan-id: Specifies an existing VLAN to which the Ethernet interface belongs, in the range of 1 to 4094.

Usage guidelines

The MAC address entries configuration cannot survive a reboot unless you save it. However, the dynamic MAC address entries are lost at next reboot regardless of whether you save the configuration or not.

Examples

# Add a static entry for MAC address 000f-e201-0101 on GigabitEthernet 1/0/1 that belongs to VLAN 2.

<Sysname> system-view

[Sysname] interface GigabitEthernet 1/0/1

[Sysname-GigabitEthernet1/0/1] mac-address static 000f-e201-0101 vlan 2

# Add a static entry for MAC address 000f-e201-0102 on Bridge-Aggregation 1 that belongs to VLAN 1.

<Sysname> system-view

[Sysname] interface bridge-aggregation 1

[Sysname-Bridge-Aggregation1] mac-address static 000f-e201-0102 vlan 1

Related commands

display mac-address

mac-address (system view)

Use mac-address to add or modify a MAC address entry.

Use undo mac-address to remove one or all MAC address entries.

Syntax

mac-address blackhole mac-address vlan vlan-id

mac-address { dynamic | static } mac-address interface interface-type interface-number vlan vlan-id

undo mac-address [ { dynamic | static } mac-address interface interface-type interface-number vlan vlan-id ]

undo mac-address [ blackhole | dynamic | static ] [ mac-address ] vlan vlan-id

undo mac-address [ dynamic | static ] mac-address interface interface-type interface-number vlan vlan-id

undo mac-address [ dynamic | static ] interface interface-type interface-number

Default

No MAC address entry is configured.

Views

System view

Default command level

2: System level

Parameters

blackhole: Specifies destination blackhole MAC address entries. These entries do not age, but you can add or remove them. The packets whose destination MAC addresses match destination blackhole MAC address entries are dropped.

mac-address: Specifies a MAC address in the format of H-H-H, where 0s at the beginning of each H (16-bit hexadecimal digit) can be omitted. For example, entering "f-e2-1" indicates that the MAC address is "000f-00e2-0001."

vlan vlan-id: Specifies an existing VLAN to which the Ethernet interface belongs, in the range of 1 to 4094.

dynamic: Specifies dynamic MAC address entries, which can be aged.

static: Specifies static MAC address entries. These entries do not age, but you can add or remove them.

interface interface-type interface-number: Specifies an outbound interface by its type and number.

Usage guidelines

A static or destination blackhole MAC address entry will not be overwritten by a dynamic MAC address entry. A dynamic MAC address entry can be overwritten by a static or destination blackhole MAC address entry.

If you execute the undo mac-address command without specifying any parameters, this command deletes all MAC address entries.

You can delete all the MAC address entries of a VLAN, or you can choose to delete a specific type (dynamic, static, or destination blackhole) of MAC address entries only.

The MAC address entries configuration cannot survive a reboot unless you save it. However, the dynamic MAC address entries are lost at next reboot regardless of whether you save the configuration or not.

Examples

# Add a static entry for MAC address 000f-e201-0101. All frames destined to this MAC address are sent out of GigabitEthernet 1/0/1 that belongs to VLAN 2.

<Sysname> system-view

[Sysname] mac-address static 000f-e201-0101 interface GigabitEthernet 1/0/1 vlan 2

Related commands

display mac-address

mac-address mac-learning disable

Use mac-address mac-learning disable to disable MAC address learning globally or on a Layer 2 Ethernet interface.

Use undo mac-address mac-learning disable to enable MAC address learning globally or on a Layer 2 Ethernet interface.

Syntax

mac-address mac-learning disable

undo mac-address mac-learning disable

Default

MAC address learning is enabled.

Views

System view, Layer 2 Ethernet interface view, port group view, Layer 2 aggregate interface view

Default command level

2: System level

Usage guidelines

Follow these guidelines when you configure MAC address learning:

·     You might need to disable MAC address learning to prevent the MAC address table from being saturated. For example, when your device is being attacked by many packets with different source MAC addresses, it affects the update of the MAC address table.

·     Because disabling MAC address learning might result in broadcast storms, enable broadcast storm suppression after you disable MAC address learning on an interface.

Examples

# Disable global MAC address learning.

<Sysname> system-view

[Sysname] mac-address mac-learning disable

# Disable MAC address learning on GigabitEthernet 1/0/1.

<Sysname> system-view

[Sysname] interface GigabitEthernet 1/0/1

[Sysname-GigabitEthernet1/0/1] mac-address mac-learning disable

# Disable MAC address learning on Bridge-Aggregation 1.

<Sysname> system-view

[Sysname] interface bridge-aggregation 1

[Sysname-Bridge-Aggregation1] mac-address mac-learning disable

Related commands

display mac-address mac-learning

mac-address max-mac-count

Use mac-address max-mac-count count to set the maximum number of MAC addresses that can be learned on an interface.

Use mac-address max-mac-count disable-forwarding to disable the device from forwarding frames with unknown source MAC addresses after the number of learned MAC addresses reaches the upper limit.

Use undo mac-address max-mac-count to restore the default maximum number of MAC addresses that can be learned on an Ethernet interface.

Use undo mac-address max-mac-count disable-forwarding to allow the device to forward frames received on an Ethernet interface with unknown source MAC addresses after the number of learned MAC addresses reaches the upper limit.

Syntax

mac-address max-mac-count { count | disable-forwarding }

undo mac-address max-mac-count [ disable-forwarding ]

Default

The maximum number of MAC addresses that can be learned on an interface varies with device models, and frames received are forwarded when the upper limit is reached.

Views

Layer 2 Ethernet interface view, port group view, Layer 2 aggregate interface view

Default command level

2: System level

Parameters

count: Sets the maximum number of MAC addresses that can be learned on an interface. When the argument is set to 0, the interface cannot learn MAC addresses. The value range for this argument varies with devices. For more information, see About the H3C Access Controller Command References.

disable-forwarding: Disables the device from forwarding frames with unknown source MAC addresses after the number of learned MAC addresses reaches the upper limit. Frames with the source MAC addresses listed in the MAC address table are forwarded.

Usage guidelines

If the command is executed in interface view, the configuration takes effect on the interface. If the command is executed in port group view, the configuration takes effect on all interfaces belonging to the port group.

Examples

# Set the maximum number of MAC addresses that can be learned on GigabitEthernet 1/0/1 to 600. After this upper limit is reached, frames received with unknown source MAC addresses on the interface are not forwarded.

<Sysname> system-view

[Sysname] interface GigabitEthernet 1/0/1

[Sysname-GigabitEthernet1/0/1] mac-address max-mac-count 600

[Sysname-GigabitEthernet1/0/1] mac-address max-mac-count disable-forwarding

mac-address timer

Use mac-address timer to set the aging timer for dynamic MAC address entries.

Use undo mac-address timer to restore the default.

Syntax

mac-address timer { aging seconds | no-aging }

undo mac-address timer aging

Default

The aging timer is 300 seconds.

Views

System view

Default command level

2: System level

Parameters

aging seconds: Sets an aging timer for dynamic MAC address entries, in the range of 10 to 630 seconds.

no-aging: Sets dynamic MAC address entries not to age.

Usage guidelines

Follow these guidelines to set the aging timer:

·     A long aging interval might cause the MAC address table to retain outdated entries and fail to accommodate the latest network changes.

·     A short aging interval might result in removal of valid entries and unnecessary broadcasts that affect the performance of the device.

Examples

# Set the aging timer for dynamic MAC address entries to 500 seconds.

<Sysname> system-view

[Sysname] mac-address timer aging 500

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Intelligent Storage
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
  • Technical Blogs
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网