02-Layer 2-LAN Switching Command Reference

HomeSupportWirelessH3C WX5500E Series Access ControllersReference GuidesCommand ReferencesH3C WX5540E Access Controller Switching Engine Command References(R2607P26)-6W10102-Layer 2-LAN Switching Command Reference
04-MAC address table configuration commands
Title Size Download
04-MAC address table configuration commands 113.29 KB

MAC address table configuration commands

The MAC address table can contain only Layer 2 Ethernet ports and Layer 2 aggregate interfaces.

This document covers only the configuration of unicast MAC address entries, including static, dynamic, and blackhole MAC address entries. For information about configuring static multicast MAC address entries, see IP Multicast Configuration Guide.

display mac-address

Use display mac-address to display information about the MAC address table.

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 blackhole MAC address entries, which do not age and can be added and deleted. Packets with a matching source or destination MAC address are discarded.

vlan vlan-id: Specifies a VLAN. The value range for the vlan-id argument is 1 to 4094.

count: Displays the number of MAC address entries specified by related parameters 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: Displays MAC address entries of a specified 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: Displays the MAC address learning status of the specified interface. The interface-type interface-number argument 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 information of all MAC address entries on the device, including unicast MAC address entries and static multicast MAC address entries.

If you execute this command using only the vlan keyword or the count keyword, or only these two keywords, it displays information of unicast MAC address entries and static multicast MAC address entries.

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 staticStatic entry manually configured by the user.

·       Config dynamicDynamic entry manually configured by the user.

·       LearnedEntry learned by the device.

·       BlackholeBlackhole entry.

·       MulticastStatic multicast MAC address entry manually configured by the user. For more information about static multicast MAC address entries, see IP Multicast Configuration Guide.

PORT INDEX

Outgoing port for packets that are destined for the MAC address. It is displayed as N/A for a blackhole MAC address entry.

AGING TIME(s)

Aging time:

·       AGING—The entry is aging.

·       NOAGED—The entry does not age.

mac address(es) found

Number of matching MAC address entries.

 

Related commands

·           mac-address (system view)

·           mac-address (interface view)

·           mac-address timer

·           display mac-address multicast and display mac-address multicast count (IP Multicast Command Reference)

display mac-address aging-time

Use display mac-address aging-time to display the aging time of dynamic entries in the MAC address table.

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 time of dynamic entries in the MAC address table.

<Sysname> display mac-address aging-time

Mac address aging time: 300s

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

Related commands

·           mac-address (system view)

·           mac-address (interface view)

·           mac-address timer

·           display mac-address

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 ports.

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 ports.

<Sysname> display mac-address mac-learning

Mac address learning status of the switch: enable

 

PortName                  Learning Status

GigabitEthernet1/0/1              enable                                       

GigabitEthernet1/0/2              enable                                       

GigabitEthernet1/0/3              enable                                       

GigabitEthernet1/0/4              enable

GigabitEthernet1/0/5              enable                                       

GigabitEthernet1/0/6              enable                                       

GigabitEthernet1/0/7              enable                                       

GigabitEthernet1/0/8              enable                                       

GigabitEthernet1/0/9              enable                                       

GigabitEthernet1/0/10             enable                                       

GigabitEthernet1/0/11             enable                                       

GigabitEthernet1/0/12             enable                                       

GigabitEthernet1/0/13             enable                                       

GigabitEthernet1/0/14             enable                                       

GigabitEthernet1/0/15             enable                                       

GigabitEthernet1/0/16             enable                                       

GigabitEthernet1/0/17             enable                                        

GigabitEthernet1/0/18             enable                                       

GigabitEthernet1/0/19             enable                                       

GigabitEthernet1/0/20             enable                                       

GigabitEthernet1/0/21             enable                                       

GigabitEthernet1/0/22             enable                                       

GigabitEthernet1/0/23             enable                                       

GigabitEthernet1/0/24             enable                                       

GigabitEthernet1/0/33             enable                                       

Ten-GigabitEthernet1/0/25         enable                                       

Ten-GigabitEthernet1/0/26         enable                                       

Ten-GigabitEthernet1/0/27         enable                                       

Ten-GigabitEthernet1/0/28         enable                                       

Ten-GigabitEthernet1/0/29         enable                                       

Ten-GigabitEthernet1/0/30         enable                                       

Ten-GigabitEthernet1/0/31         enable                                        

Ten-GigabitEthernet1/0/32         enable

Table 2 Command output

Field

Description

Mac-address learning status of the switch

Global MAC address learning status (enabled or disabled).

PortName

Port name.

Learning Status

MAC address learning status (enabled or disabled) for a port.

 

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   26         0             1              27

Static    Unicast   0          1             8              9         1024

Total     Unicast                                           36        32768

 

Dynamic Multicast   0          0             0              0

Static  Multicast   0          13            12             25        256

Total   Multicast                                           25        256

Table 3 Command output

Field

Description

MAC TYPE

MAC address type:

·       Dynamic Unicast.

·       Static Unicast.

·       Total Unicast.

·       Dynamic Multicast.

·       Static Multicast.

·       Total Multicast.

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 the specified interface.

Use undo mac-address to remove a MAC address entry on the specified 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. They 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, enter "f-e2-1" for "000f-00e2-0001."

vlan vlan-id: Specifies an existing VLAN to which the Ethernet interface belongs. The value range for the vlan-id argument is 1 to 4094.

Usage guidelines

The MAC address entries configuration cannot survive a reboot unless you save them. 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 port 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 port 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 blackhole MAC address entries. These entries do not age, but you can add or remove them. The packets whose source or destination MAC addresses match 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, enter "f-e2-1" for "000f-00e2-0001."

vlan vlan-id: Specifies an existing VLAN to which the Ethernet interface belongs, where vlan-id is the specified VLAN ID, ranging from 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 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 blackhole MAC address entry.

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

You can delete all the MAC address entries (including unicast MAC address entries and static multicast MAC address entries) of a VLAN, or you can choose to delete a specific type (dynamic, static, or blackhole) of MAC address entries only. You can single out certain ports and delete the corresponding unicast MAC address entries, but you cannot do the same to the corresponding static multicast MAC address entries.

The MAC address entries configuration cannot survive a reboot unless you save them. 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 port GigabitEthernet 1/0/1, which 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 on a VLAN.

Use undo mac-address mac-learning disable to enable MAC address learning on a VLAN.

Syntax

mac-address mac-learning disable

undo mac-address mac-learning disable

Default

MAC address learning is enabled.

Views

VLAN view

Default command level

2: System level

Usage guidelines

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.

When MAC address learning is disabled, the learned MAC addresses remain valid until they age out.

Examples

# Disable MAC address learning on VLAN 10.

<Sysname> system-view

[Sysname] vlan 10

[Sysname-vlan10] 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 configure the maximum number of MAC addresses that can be learned on a port.

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

Syntax

mac-address max-mac-count count

undo mac-address max-mac-count

Default

No MAC learning limit is configured.

Views

Layer 2 Ethernet interface view, port group view

Default command level

2: System level

Parameters

count: Sets the maximum number of MAC addresses that can be learned on a port. The value is in the range of 0 to 4096. When the argument takes 0, the port is not allowed to learn MAC addresses.

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 ports belonging to the port group.

Examples

# Set the maximum number of MAC addresses that can be learned on port GigabitEthernet 1/0/1 to 600.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

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

Related commands

·           mac-address (system view)

·           mac-address (interface view)

·           mac-address timer

mac-address timer

Use mac-address timer to configure 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 default setting is 300 seconds.

Views

System view

Default command level

2: System level

Parameters

aging seconds: Sets an aging timer (in seconds) for dynamic MAC address entries. The value is in the range of 10 to 1000000.

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

Usage guidelines

Follow these guidelines to set the aging timer appropriately:

·           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 may 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

 


MAC Information applies only to Layer 2 Ethernet interfaces.

mac-address information enable (interface view)

Use mac-address information enable to enable MAC Information on the Layer 2 Ethernet interface.

Use undo mac-address information enable to restore the default.

Syntax

mac-address information enable { added | deleted }

undo mac-address information enable { added | deleted }

Default

MAC Information is disabled on a Layer 2 Ethernet interface.

Views

Layer 2 Ethernet interface view

Default command level

1: Monitor level

Parameters

added: Enables the device to record security information when a new MAC address is learned on the Ethernet port.

deleted: Enables the device to record security information when an existing MAC address is deleted.

Usage guidelines

This command is not supported on aggregate interfaces.

Before you enable MAC Information on an Ethernet interface, enable MAC Information globally.

Examples

# Enable MAC Information on GigabitEthernet 1/0/1.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] mac-address information enable added

mac-address information enable (system view)

Use mac-address information enable to enable MAC Information globally.

Use undo mac-address information enable to restore the default.

Syntax

mac-address information enable

undo mac-address information enable

Default

MAC Information is disabled globally.

Views

System view

Default command level

2: System level

Examples

# Enable MAC Information globally.

<Sysname> system-view

[Sysname] mac-address information enable

mac-address information interval

Use mac-address information interval to set the interval for sending syslog or trap messages.

Use undo mac-address information interval to restore the default.

Syntax

mac-address information interval interval-time

undo mac-address information interval

Default

The interval for sending syslog or trap messages is 1 second.

Views

System view

Default command level

2: System level

Parameters

interval-time: Sets the interval for sending syslog or trap messages, in the range of 1 to 20000 seconds.

Examples

# Set the interval for sending syslog or trap messages to 200 seconds.

<Sysname> system-view

[Sysname] mac-address information interval 200

mac-address information mode

Use mac-address information mode to set the MAC Information mode (to use syslog messages or trap messages) to inform the remote network management device of MAC address changes.

Use undo mac-address information mode to restore the default.

Syntax

mac-address information mode { syslog | trap }

undo mac-address information mode { syslog | trap }

Default

Trap messages are sent to inform the remote network management device of MAC address changes.

Views

System view

Default command level

2: System level

Parameters

syslog: Specifies that the device sends syslog messages to inform the remote network management device of MAC address changes.

trap: Specifies that the device sends trap messages to inform the remote network management device of MAC address changes.

Examples

# Configure the device to send trap messages to inform the remote network management device of MAC address changes.

<Sysname> system-view

[Sysname] mac-address information mode trap

mac-address information queue-length

Use mac-address information queue-length to set the MAC Information queue length.

Use undo mac-address information queue-length to restore the default.

Syntax

mac-address information queue-length value

undo mac-address information queue-length

Default

The MAC Information queue length is 50.

Views

System view

Default command level

2: System level

Parameters

value: Specifies the MAC Information queue length, in the range of 0 to 1000.

Examples

# Set the MAC Information queue length to 600.

<Sysname> system-view

[Sysname] mac-address information queue-length 600

 

  • 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
新华三官网