04-Layer 2 - LAN Switching Command Reference

HomeSupportSwitchesH3C S9500E Switch SeriesReference GuidesCommand ReferencesH3C S9500E Command Reference-Release1728-6W17004-Layer 2 - LAN Switching Command Reference
02-MAC Address Table Commands
Title Size Download
02-MAC Address Table Commands 132.24 KB

MAC address table configuration commands

 

 

NOTE:

·       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 table entries, including static, dynamic, (source and destination) blackhole, and multi-port unicast MAC address table entries. For the configuration of static multicast MAC address table entries, see IP Multicast Configuration Guide.

·       The switch operates in IRF or standalone (the default) mode. For more information about the IRF mode, see IRF Configuration Guide.

 

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 blackhole MAC address entries.

vlan vlan-id: Displays MAC address entries of the specified VLAN. The 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 in 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. These entries do not age, but you can add or remove them.

interface interface-type interface-number: Displays the 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 the display mac-address command to display information about the MAC address table.

If you execute this command without specifying any parameters, this command displays information about 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 or count keyword, or only these two keywords, the command displays information about unicast and static multicast MAC address entries.

Related commands: mac-address (system view), mac-address (interface view), mac-address multiport, and mac-address timer; display mac-address multicast and display mac-address multicast count (IP Multicast Command Reference).

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  100       Learned  GigabitEthernet3/0/18     AGING

 

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

Table 1 Output description

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

·       Config dynamicThe dynamic entry manually configured by the user.

·       LearnedThe dynamic entry learned by the switch.

·       BlackholeThe blackhole entry.

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

·       Multiport—The multi-port unicast MAC address entry manually configured by the user.

PORT INDEX

Number of the port corresponding to the MAC address, or packets destined to this MAC address will be sent out from this port. (Displayed as N/A for a blackhole MAC address entry).

AGING TIME(s)

Aging time:

·       AGINGThe entry is aging.

·       NOAGEDThe 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 the display mac-address aging-time command 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 above information indicates that the aging time of dynamic entries in the MAC address table is 300 seconds.

display mac-address multiport

Syntax

display mac-address multiport [ vlan vlan-id ] [ count ] [ | { begin | exclude | include } regular-expression ]

View

Any view

Default level

1: Monitor level

Parameters

vlan vlan-id: Displays multi-port unicast MAC address entries of the specified VLAN. The VLAN ID ranges from 1 to 4094.

count: Displays the number of multi-port unicast MAC address entries.

|: 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 the display mac-address multiport command to display multi-port unicast MAC address entries.

Related commands: mac-address multiport.

Examples

# Display multi-port unicast MAC address entries.

<Sysname> display mac-address multiport

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

0001-0101-0101  2         Multiport       GigabitEthernet3/0/1        NOAGED

                                          GigabitEthernet3/0/2

                                          GigabitEthernet3/0/3

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

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: Dynamic MAC address entries. Aging time is set for these entries.

static: 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, f-e2-1 represents the MAC address 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 the mac-address command to add or modify a MAC address entry on a specified Ethernet port.

Use the undo mac-address command to remove a MAC address entry on the Ethernet port.

 

 

NOTE:

·       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 of 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 entries, however, are lost at next reboot whether or not you save the configuration.

 

Related commands: display mac-address.

Examples

# Add a static entry for MAC address 00e0-fc01-0101 on port GigabitEthernet 3/0/1 which belongs to VLAN 2.

<Sysname> system-view

[Sysname] interface gigabitethernet 3/0/1

[Sysname-GigabitEthernet3/0/1] mac-address static 00e0-fc01-0101 vlan 2

# Add a static entry for MAC address 00e0-fc01-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 00e0-fc01-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: Blackhole MAC address entries. These entries do not age, but you can add or remove them. The packets whose destination or source 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, f-e2-1 represents the MAC address 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: Dynamic MAC address entries. These entries can age.

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

interface interface-type interface-number: Outbound interface specified by its type and number.

Description

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

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

 

 

NOTE:

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

·       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, but not the corresponding static multicast MAC address entries.

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

 

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 of port GigabitEthernet 3/0/1 which belongs to VLAN 2.

<Sysname> system-view

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

mac-address max-mac-count (interface view)

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: Sets the maximum number of MAC addresses that can be learned on a port. The value ranges from 0 to 1048576. When the argument takes 0, the specified interface is disabled from learning MAC addresses.

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 will be forwarded.

Description

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

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

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

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

By default, the maximum number of MAC addresses that can be learned on a port is not specified.

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.

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 3/0/1 to 600. After this upper limit is reached, frames received with unknown source MAC addresses on the port will not be forwarded.

<Sysname> system-view

[Sysname] interface gigabitethernet 3/0/1

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

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

mac-address max-mac-count (VLAN view)

Syntax

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

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

View

VLAN view

Default level

2: System level

Parameters

count: Sets the maximum number of MAC addresses that can be learned on a VLAN. The value ranges from 0 to 1048576. When the argument takes 0, the VLAN is disabled from learning MAC addresses.

disable-forwarding: Disables 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 will be forwarded normally.

Description

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

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

Use the undo mac-address max-mac-count command to restore the default maximum number of MAC addresses that can be learned on a VLAN.

Use the undo mac-address max-mac-count disable-forwarding command to allow the switch to forward frames with unknown source MAC addresses for the VLAN after the number of learned MAC addresses reaches the upper limit.

By default, the maximum number of MAC addresses that can be learned on a VLAN is not specified. Frames with the source MAC addresses listed in the MAC address table will be forwarded.

 

 

NOTE:

You cannot configure the maximum number of MAC addresses that can be learned on a super VLAN, because a super VLAN does not have physical ports.

 

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 VLAN 10 to 600. After this upper limit is reached, frames with unknown source MAC addresses will not be forwarded for the VLAN.

<Sysname> system-view

[Sysname] vlan 10

[Sysname-vlan10] mac-address max-mac-count 600

[Sysname-vlan10] mac-address max-mac-count disable-forwarding

mac-address multiport (interface view)

Syntax

mac-address multiport mac-address vlan vlan-id

undo mac-address multiport mac-address vlan vlan-id

View

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

Default level

2: System level

Parameters

mac-address: Specifies a unicast MAC address, excluding the all-zero MAC address.

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 the mac-address multiport command to configure a multi-port unicast MAC address entry on a specified interface.

Use the undo mac-address multiport command to remove a multi-port unicast MAC address entry on the interface.

On a switch operating in IRF mode, do not specify the same MAC address for both a multi-port unicast MAC address table entry and a static neighbor table entry. Otherwise, a conflict will occur. For more information about static neighbor entries, see Layer 3—IP Services Configuration Guide.

To associates a unicast MAC address to an Ethernet interface that belongs to an aggregation group, configure the multi-port unicast MAC address table entry in Layer 2 aggregate interface view, instead of Layer 2 Ethernet interface view.

Related commands: display mac-address multiport.

Examples

# Add a multi-port unicast MAC address entry for MAC address 0001-0001-0101 on port GigabitEthernet 3/0/1 that belongs to VLAN 2.

<Sysname> system-view

[Sysname] interface gigabitethernet 3/0/1

[Sysname-GigabitEthernet3/0/1] mac-address multiport 0001-0001-0101 vlan 2

mac-address multiport (system view)

Syntax

mac-address multiport mac-address interface interface-list vlan vlan-id

undo mac-address multiport mac-address interface interface-list vlan vlan-id

undo mac-address [ multiport ] [ [ mac-address ] vlan vlan-id ]

View

System view

Default level

2: System level

Parameters

mac-address: Specifies a unicast MAC address, excluding the all-zero MAC address.

interface-list: Specifies interfaces in the format of { { interface-type interface-number } [ to { interface-type interface-number } ] } &<1-n>. The interface type can be the Layer 2 Ethernet interface or Layer 2 aggregate interface. &<1-n> specifies that you can configure up to n interfaces or interface ranges. The value of n is up to 16.

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 the mac-address multiport command to configure a multi-port unicast MAC address entry.

Use the undo mac-address multiport command to remove one or all multi-port unicast MAC address entries.

If you execute the undo mac-address command without specifying the multiport keyword, this command deletes all MAC address entries (including multicast MAC address entries, multi-port unicast MAC address entries, and unicast MAC address entries).

On a switch operating in IRF mode, do not specify the same MAC address for both a multi-port unicast MAC address table entry and a static neighbor table entry. Otherwise, a conflict will occur. For more information about static neighbor entries, see Layer 3—IP Services Configuration Guide.

To associates a unicast MAC address to an Ethernet interface that belongs to an aggregation group, configure the multi-port unicast MAC address table entry in Layer 2 aggregate interface view, instead of Layer 2 Ethernet interface view.

Related commands: display mac-address multiport.

Examples

# Add a multi-port unicast MAC address entry for MAC address 000f-e201-0101 to send all frames destined to this MAC address out ports GigabitEthernet 3/0/1 through GigabitEthernet 3/0/3 that belong to VLAN 2.

<Sysname> system-view

[Sysname] mac-address multiport 000f-e201-0101 interface gigabitethernet 3/0/1 to gigabitethernet 3/0/3 vlan 2

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. The value ranges from 10 to 3600 seconds.

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

Description

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

Use the undo mac-address timer aging command to restore the default.

By default, the aging timer 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 hence unnecessary broadcasts which may affect the performance of the switch.

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
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become a Partner
  • Partner Resources
  • Partner Business Management
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网