03-Layer 2 Command Reference

HomeSupportReference GuidesCommand ReferencesH3C WX Series Access Controllers Command References(R3308 R2308)-6W10703-Layer 2 Command Reference
04-MAC Address Table Commands
Title Size Download
04-MAC Address Table Commands 99.33 KB

MAC address table configuration commands

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

display mac-address

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 ]

View

Any view

Default level

1: Monitor level

Parameters

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

vlan vlan-id: Displays MAC address entries of the specified VLAN, where vlan-id ranges from 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. Aging time is set for these entries.

static: Displays static MAC address entries. Similar to blackhole MAC address entries, these entries do not age but you can add or remove them.

interface interface-type interface-number: Displays MAC address learning status of the specified 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.

Description

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

Related commands: mac-address (system view), mac-address (interface view), and mac-address timer.

Examples

# Display the MAC address table 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—The static entry manually configured by the user.

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

·     Learned—The entry learned by the device.

·     Blackhole—The destination blackhole entry.

PORT INDEX

Number of the port corresponding to the MAC address. Packets destined to this MAC address are sent out this port. (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.

1 mac address(es) found

One MAC address entry is found.

 

display mac-address aging-time

Syntax

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

View

Any view

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

Description

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

Related commands: mac-address (system view), mac-address (interface view), mac-address timer, and display mac-address.

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 indicates that the aging time of dynamic entries in the MAC address table is 300 seconds.

display mac-address mac-learning

Syntax

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

View

Any view

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

Description

Use display mac-address mac-learning to display the MAC address learning status of the specified or all Layer 2 Ethernet ports.

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

Bridge-Aggregation1               enable

Bridge-Aggregation2               enable

GigabitEthernet1/0/1              enable

GigabitEthernet1/0/2              enable

GigabitEthernet1/0/3              enable

GigabitEthernet1/0/4              enable

Ten-GigabitEthernet1/0/5          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

Syntax

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

View

Any view

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

Description

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

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   7         0              0              7                     

Static    Unicast   0         0              0              0         8192     

Total     Unicast                                           7         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

·     Dynamic Multicast

·     Static Multicast

·     Total Multicast

LEARNED

Dynamically learned MAC addresses

USER-DEFINED

User defined MAC addresses

SYSTEM-DEFINED

MAC addresses generated by the system

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)

Syntax

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

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

View

Layer 2 Ethernet interface view, Layer 2 aggregate interface view

Default level

2: System level

Parameters

dynamic: Specifies dynamic MAC address entries. Aging time is set for these entries.

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, inputting "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, where vlan-id is the specified VLAN ID, ranging from 1 to 4094.

Description

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.

The MAC address entries configuration cannot survive a reboot unless you save it. The dynamic MAC address table entries will be lost, whether you save the configuration or not.

Related commands: display mac-address.

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

mac-address (system view)

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

View

System view

Default 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, inputting "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, where vlan-id is the specified VLAN ID, ranging from 1 to 4094.

dynamic: Specifies dynamic MAC address entries. Aging time is set for these entries.

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.

Description

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

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

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.

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

The MAC address entries configuration cannot survive a reboot unless you save it. The dynamic MAC address table entries will be lost, whether you save the configuration or not.

Related commands: display mac-address.

Examples

# Add a static entry for MAC address 000f-e201-0101. All frames destined to this MAC address are sent out 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

mac-address mac-learning disable

Syntax

mac-address mac-learning disable

undo mac-address mac-learning disable

View

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

Default level

2: System level

Parameters

None

Description

Use mac-address mac-learning disable to disable MAC address learning. Depending on the view that you entered, you can disable it globally, on a Layer 2 interface, or on a group of Ethernet ports.

Use undo mac-address mac-learning disable to enable MAC address learning. Depending on the view that you entered, you can disable it globally, on a Layer 2 interface, or on a group of Ethernet ports.

By default, MAC address learning is enabled.

Follow these guidelines when configuring MAC address learning:

·     You may need to disable MAC address learning to prevent the MAC address table from being saturated (for example, when your device is being attacked by a great deal of packets with different source MAC addresses). The update of the MAC address table can be affected.

·     Because disabling MAC address learning may result in broadcast storms, enable broadcast storm suppression after you disable MAC address learning on a port.

Related commands: display mac-address mac-learning.

Examples

# Disable global MAC address learning.

<Sysname> system-view

[Sysname] mac-address mac-learning disable

# Disable MAC address learning on port 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

mac-address max-mac-count

Syntax

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

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

View

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

Default level

2: System level

Parameters

count: Specifies the maximum number of MAC addresses that can be learned on a port. When the argument takes 0, the VLAN is not allowed to learn MAC addresses. The value range for this argument varies with devices. For more information, see About the WX Series Access Controllers Command References.

disable-forwarding: Disables forwarding of 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 normally.

Description

Use mac-address max-mac-count count to configure the maximum number of MAC addresses that can be learned on a port.

Use mac-address max-mac-count disable-forwarding to configure not to forward 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 port.

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

The default maximum number of MAC addresses that can be learned on a port varies with devices. When the upper limit is reached, frames received are forwarded by default.

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

Related commands: mac-address (system view), mac-address (interface view), and mac-address timer.

Examples

# Set the maximum number of MAC addresses that can be learned on port GigabitEthernet 1/0/1 to 600. After this upper limit is reached, frames received with unknown source MAC addresses on the port 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

Syntax

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

undo mac-address timer aging

View

System view

Default level

2: System level

Parameters

aging seconds: Sets an aging timer for dynamic MAC address entries, ranging from 10 to 630 seconds.

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

Description

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

Use undo mac-address timer to restore the default.

By default, the aging timer for dynamic MAC address entries is 300 seconds.

Set the aging timer appropriately.

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

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

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