04-Layer 2—LAN Switching Command Reference

HomeSupportReference GuidesCommand ReferencesH3C MSR610[810][830][1000S][2600][3600] Routers Command References(V7)-R6749-6W10304-Layer 2—LAN Switching Command Reference
01-MAC address table commands
Title Size Download
01-MAC address table commands 144.21 KB

MAC address table commands

The following matrix shows the compatibility of hardware and the MAC address table:

 

Hardware

Remarks

·     Fixed Layer 2 Ethernet ports on the following routers:

¡     MSR610

¡     MSR810, MSR810-W, MSR810-W-DB, MSR810-LM, MSR810-W-LM, MSR810-10-PoE, MSR810-LM-HK, MSR810-W-LM-HK, MSR810-LM-CNDE-SJK, MSR810-CNDE-SJK, MSR810-EI, MSR810-LM-EA, MSR810-LM-EI

¡     MSR810-LMS, MSR810-LUS

¡     MSR810-SI, MSR810-LM-SI

¡     MSR810-LMS-EA, MSR810-LME

¡     MSR1004S-5G, MSR1004S-5G-CN

¡     MSR1104S-W, MSR1104S-W-CAT6, MSR1104S-5G-CN, MSR1104S-W-5G-CN, MSR1104S-W-5GGL

¡     MSR2600-6-X1, MSR2600-15-X1, MSR2600-15-X1-T

¡     MSR2600-10-X1

¡     MSR2630-G-X1

¡     MSR3600-28, MSR3600-51, MSR3600-28-SI, MSR3600-51-SI

¡     MSR3600-28-X1, MSR3600-28-X1-DP, MSR3600-51-X1, MSR3600-51-X1-DP

¡     MSR3600-28-G-DP, MSR3600-51-G-DP

¡     MSR3600-28-G-X1-DP, MSR3600-51-G-X1-DP

¡     MSR3610-I-DP, MSR3610-IE-DP, MSR3610-IE-ES, MSR3610-IE-EAD, MSR-EAD-AK770, MSR3610-I-IG, MSR3610-IE-IG

¡     MSR-iMC

¡     MSR3640-G (product code: 0235A4W8)

¡     MSR810-W-WiNet, MSR810-LM-WiNet

¡     MSR830-4LM-WiNet

¡     MSR830-5BEI-WiNet, MSR830-6EI-WiNet, MSR830-10BEI-WiNet

¡     MSR830-6BHI-WiNet, MSR830-10BHI-WiNet

¡     MSR2600-6-WiNet, MSR2600-10-X1-WiNet

¡     MSR3600-28-WiNet

¡     MSR860-6EI-XS, MSR860-6HI-XS

¡     MSR2600-15-X1-XS

¡     MSR3600-28-XS

¡     MSR3610-I-XS

¡     MSR3610-IE-XS

¡     MSR810-LM-GL, MSR810-W-LM-GL, MSR830-6EI-GL, MSR830-10EI-GL, MSR830-6HI-GL, MSR830-10HI-GL, MSR1004S-5G-GL, MSR2600-6-X1-GL, MSR3600-28-SI-GL

·     Layer 2 interface modules installed on routers.

For information about the support of the routers for Layer 2 interface modules, see H3C MSR Router Series Comware 7 Interface Module Guide.

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

Views

Any view

Predefined user roles

network-admin

network-operator

Parameters

mac-address: Specifies a MAC address in the format of H-H-H. When entering a MAC address, you can omit the leading zeros in each H section. For example, enter f-e2-1 for 000f-00e2-0001.

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

dynamic: Displays dynamic MAC address entries.

static: Displays static MAC address entries.

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

blackhole: Displays blackhole MAC address entries.

count: Displays only the number of MAC address entries that match all entry attributes you specify in the command. Detailed information about MAC address entries is not displayed. For example, you can use the display mac-address vlan 20 dynamic count command to display the number of dynamic entries for VLAN 20. If you do not specify an entry attribute, the command displays the number of entries in the MAC address table. If you do not specify this keyword, the command displays detailed information about the specified MAC address entries.

Usage guidelines

Use this command to display static, dynamic, or blackhole MAC address entries. A MAC address entry includes a destination MAC address, an outgoing interface, and a VLAN ID.

If you do not specify any parameters, the command displays all MAC address entries.

This command displays dynamic MAC address entries for an aggregate interface only when the aggregate interface has a minimum of one Selected member port.

Examples

# Display MAC address entries for VLAN 100.

<Sysname> display mac-address vlan 100

MAC Address      VLAN ID    State            Port/Nickname            Aging

0033-0033-0033   100        Blackhole        N/A                      N

0000-0000-0002   100        Static           GE1/0/3                  N

00e0-fc00-5829   100        Learned          GE1/0/4                  Y

# Display the number of MAC address entries.

<Sysname> display mac-address count

1 mac address(es) found.

Table 1 Command output

Field

Description

VLAN ID

ID of the VLAN to which the outgoing interface of the MAC address entry belongs.

State

MAC address entry state:

·     Static—Static MAC address entry.

·     Learned—Dynamic MAC address entry. Dynamic entries can be learned or manually configured.

·     Blackhole—Blackhole MAC address entry.

·     OpenFlow—MAC address entry for an OpenFlow instance.

·     Drop aging—MAC address entry that can age out. Packets from this MAC address are dropped.

·     Drop no-aging—MAC address entry that cannot age out. Packets from this MAC address are dropped.

·     AUTH—MAC address entry generated for MAC authentication.

·     Client—MAC address entry of an online client. In the current software version, this state represents only a MAC address entry of a wireless client.

·     VOICE-VLAN—MAC address entry generated for the voice VLAN feature.

·     Security—MAC address entry configured or learned by port security.

·     Vlan-interface—MAC address entry of a VLAN interface.

Port/Nickname

When the field displays an interface name, the field indicates the outgoing interface for packets that are destined for the MAC address. This field displays N/A for a blackhole MAC address entry.

The Nickname field is not supported in the current software version.

Aging

Whether the entry can age out:

·     Y—The entry can age out.

·     N—The entry never ages out.

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

Views

Any view

Predefined user roles

network-admin

network-operator

Examples

# Display the aging timer for dynamic MAC address entries.

<Sysname> display mac-address aging-time

MAC address aging time: 300s.

Related commands

mac-address timer

display mac-address mac-learning

Use display mac-address mac-learning to display the global MAC address learning status and the MAC learning status of the specified interface or all interfaces.

Syntax

display mac-address mac-learning [ interface interface-type interface-number ]

Views

Any view

Predefined user roles

network-admin

network-operator

Parameters

interface interface-type interface-number: Specifies an interface by its type and number. If you do not specify an interface, the command displays the global MAC address learning status and the MAC address learning status of all interfaces.

Examples

# Display the global MAC address learning status and the MAC learning status of all interfaces.

<Sysname> display mac-address mac-learning

Global MAC address learning status: Enabled.

 

Port                         Learning Status

GE1/0/1                     Enabled

GE1/0/2                     Enabled

Table 2 Command output

Field

Description

Global MAC address learning status

Global MAC address learning status:

·     Enabled.

·     Disabled.

Learning Status

MAC address learning status of an interface:

·     Enabled.

·     Disabled.

 

Related commands

mac-address mac-learning enable

mac-address (interface view)

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

Use undo mac-address to delete a MAC address entry on an interface.

Syntax

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

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

Default

An interface is not configured with MAC address entries.

Views

Layer 2 Ethernet interface view

Predefined user roles

network-admin

Parameters

dynamic: Specifies dynamic MAC address entries.

static: Specifies static MAC address entries.

mac-address: Specifies a MAC address in the format of H-H-H, excluding multicast, all-zero, and all-F MAC addresses. When entering a MAC address, you can omit the leading zeros in each H section. For example, enter f-e2-1 for 000f-00e2-0001.

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

Usage guidelines

Typically, the device automatically builds the MAC address table by learning the source MAC addresses of incoming frames on each interface. However, you can manually configure static MAC address entries. For a MAC address, a manually configured static entry takes precedence over a dynamically learned entry. To improve the security for the user device connected to an interface, manually configure a static entry to bind the user device to the interface. Then, the frames destined for the user device (for example, Host A) are always sent out of the interface. Other hosts using the forged MAC address of Host A cannot obtain the frames destined for Host A.

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

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

Related commands

display mac-address

mac-address (system view)

mac-address (system view)

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

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

Syntax

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

mac-address blackhole mac-address 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 ] interface interface-type interface-number

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

Default

The system is not configured with MAC address entries.

Views

System view

Predefined user roles

network-admin

Parameters

dynamic: Specifies dynamic MAC address entries.

static: Specifies static MAC address entries.

blackhole: Specifies blackhole MAC address entries. 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, excluding multicast, all-zero, and all-F MAC addresses. When entering a MAC address, you can omit the leading zeros in each H section. For example, enter f-e2-1 for 000f-00e2-0001.

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

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

Usage guidelines

You can use this command to configure the following types of MAC address entries:

·     Dynamic entries.

Dynamic entries include manually configured dynamic entries and automatically learned dynamic entries.

·     Static entries.

For a MAC address, a manually configured static entry takes precedence over a dynamic entry. To improve the security for the user device connected to an interface, manually configure a static entry to bind the user device to the interface. Then, the frames destined for the user device (for example, Host A) are always sent out of the interface. Other hosts using the forged MAC address of Host A cannot obtain the frames destined for Host A.

·     Blackhole entries.

To drop frames with the specified source MAC addresses or destination MAC addresses, you can configure blackhole entries.

A static or blackhole entry can overwrite a dynamic entry, but not vice versa.

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 and static multicast MAC address entries) from the specified VLAN. You can also delete only one type (dynamic, static, or blackhole) of MAC address entries. You can single out an interface and delete the unicast MAC address entries on it, but not the static multicast MAC address entries.

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

You cannot add or modify dynamic MAC address entries for interfaces in the down state.

Examples

# Add a static entry for MAC address 000f-e201-0101. Then, all frames that are destined for this MAC address are sent out of 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 (interface view)

mac-address mac-learning enable

Use mac-address mac-learning enable to enable MAC address learning on an interface.

Use undo mac-address mac-learning enable to disable MAC address learning on an interface.

Syntax

mac-address mac-learning enable

undo mac-address mac-learning enable

Default

MAC address learning is enabled.

Views

Layer 2 Ethernet interface view

Predefined user roles

network-admin

Usage guidelines

To prevent the MAC address table from becoming saturated, you can disable MAC address learning.

For example, a number of packets with different source MAC addresses reaching a device can affect the MAC address table update. To avoid such attacks, you can disable MAC address learning by following these guidelines:

·     You can disable MAC address learning on a per-interface basis.

·     Because disabling MAC address learning can result in broadcast storms, enable broadcast storm suppression after you disable MAC address learning on an interface. For more information about broadcast storm suppression, see Interface Configuration Guide.

·     After MAC address learning is disabled, existing dynamic MAC address entries can age out.

Examples

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

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] undo mac-address mac-learning enable

Related commands

display mac-address mac-learning

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

Default

The aging timer is 300 seconds for dynamic MAC address entries.

Views

System view

Predefined user roles

network-admin

Parameters

aging seconds: Specifies an aging timer for dynamic MAC address entries, in seconds.

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

Usage guidelines

To set the aging timer appropriately, follow these guidelines:

·     A long aging interval causes the MAC address table to retain outdated entries and fail to accommodate the most recent network changes.

·     A short aging interval results in removal of valid entries. Then, unnecessary broadcast packets appear and affect device performance.

Examples

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

<Sysname> system-view

[Sysname] mac-address timer aging 500

Related commands

display mac-address aging-time

snmp-agent trap enable mac-address

Use snmp-agent trap enable mac-address to enable SNMP notifications for the MAC address table.

Use undo snmp-agent trap enable mac-address to disable SNMP notifications for the MAC address table.

Syntax

snmp-agent trap enable mac-address

undo snmp-agent trap enable mac-address

Default

SNMP notifications are enabled for the MAC address table.

Views

System view

Predefined user roles

network-admin

Usage guidelines

To report critical MAC address move events to an NMS, enable SNMP notifications for the MAC address table. For MAC address move event notifications to be sent correctly, you must also configure SNMP on the device.

When SNMP notifications are disabled for the MAC address table, the device sends the generated logs to the information center. To display the logs, configure the log destination and output rule configuration in the information center.

For information about SNMP and information center configuration, see the network management and monitoring configuration guide for the device.

Examples

# Disable SNMP notifications for the MAC address table.

<Sysname> system-view

[Sysname] undo snmp-agent trap enable mac-address


MAC Information commands

Support for MAC information commands varies by device model:

 

Hardware

Command compatibility

MSR610

No

MSR810, MSR810-W, MSR810-W-DB, MSR810-LM, MSR810-W-LM, MSR810-10-PoE, MSR810-LM-HK, MSR810-W-LM-HK, MSR810-LM-CNDE-SJK, MSR810-CNDE-SJK, MSR810-EI, MSR810-LM-EA, MSR810-LM-EI

No

MSR810-LMS, MSR810-LUS

No

MSR810-SI, MSR810-LM-SI

No

MSR810-LMS-EA, MSR810-LME

No

MSR1004S-5G, MSR1004S-5G-CN

No

MSR1104S-W, MSR1104S-W-CAT6, MSR1104S-5G-CN, MSR1104S-W-5G-CN, MSR1104S-W-5GGL

No

MSR2600-6-X1, MSR2600-15-X1, MSR2600-15-X1-T

No

MSR2600-10-X1

No

MSR2630-G-X1

Yes

MSR 2630

No

MSR3600-28, MSR3600-51

No

MSR3600-28-SI, MSR3600-51-SI

No

MSR3600-28-X1, MSR3600-28-X1-DP, MSR3600-51-X1, MSR3600-51-X1-DP

Yes

MSR3600-28-G-DP, MSR3600-51-G-DP

Yes

MSR3600-28-G-X1-DP, MSR3600-51-G-X1-DP

Yes

MSR3610-I-DP, MSR3610-IE-DP, MSR3610-IE-ES, MSR3610-IE-EAD, MSR-EAD-AK770, MSR3610-I-IG, MSR3610-IE-IG

No

MSR-iMC

No

MSR3610-X1, MSR3610-X1-DP, MSR3610-X1-DC, MSR3610-X1-DP-DC, MSR3620-X1, MSR3640-X1

No

MSR 3610, MSR 3620, MSR 3620-DP, MSR 3640, MSR 3660

No

MSR3610-G, MSR3620-G

No

MSR3640-G

No

MSR3640-X1-HI

No

Hardware

Command compatibility

MSR810-W-WiNet, MSR810-LM-WiNet

No

MSR830-4LM-WiNet

No

MSR830-5BEI-WiNet, MSR830-6EI-WiNet, MSR830-10BEI-WiNet

No

MSR830-6BHI-WiNet, MSR830-10BHI-WiNet

No

MSR2600-6-WiNet

No

MSR2600-10-X1-WiNet

No

MSR2630-WiNet

No

MSR3600-28-WiNet

No

MSR3610-X1-WiNet

No

MSR3620-X1-WiNet

No

MSR3610-WiNet, MSR3620-10-WiNet, MSR3620-DP-WiNet, MSR3620-WiNet, MSR3660-WiNet

No

Hardware

Command compatibility

MSR860-6EI-XS

No

MSR860-6HI-XS

No

MSR2600-15-X1-XS

No

MSR2630-XS

No

MSR3600-28-XS

Yes

MSR3610-XS

No

MSR3620-XS

No

MSR3610-I-XS

No

MSR3610-IE-XS

No

MSR3620-X1-XS

No

MSR3640-XS

No

MSR3660-XS

No

Hardware

Command compatibility

MSR810-LM-GL

No

MSR810-W-LM-GL

No

MSR830-6EI-GL

No

MSR830-10EI-GL

No

MSR830-6HI-GL

No

MSR830-10HI-GL

No

MSR1004S-5G-GL

No

MSR2600-6-X1-GL

No

MSR3600-28-SI-GL

No

mac-address information enable (interface view)

Use mac-address information enable to enable MAC Information on an interface.

Use undo mac-address information enable to disable MAC Information on an interface.

Syntax

mac-address information enable { added | deleted }

undo mac-address information enable { added | deleted }

Default

MAC Information is disabled on an interface.

Views

Layer 2 Ethernet interface view

Predefined user roles

network-admin

Parameters

added: Enables the device to record MAC change information when a new MAC address is learned on an interface.

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

Usage guidelines

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

Examples

# Enable MAC Information on GigabitEthernet 1/0/1 to enable the interface to record MAC change information when learning a new MAC address.

<Sysname> system-view

[Sysname] interface gigabitethernet 1/0/1

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

Related commands

mac-address information enable (system view)

mac-address information enable (system view)

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

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

Syntax

mac-address information enable

undo mac-address information enable

Default

MAC Information is disabled globally.

Views

System view

Predefined user roles

network-admin

Usage guidelines

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

Examples

# Enable MAC Information globally.

<Sysname> system-view

[Sysname] mac-address information enable

Related commands

mac-address information enable (interface view)

mac-address information interval

Use mac-address information interval to set the MAC change notification interval.

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

Syntax

mac-address information interval interval

undo mac-address information interval

Default

The MAC change notification interval is 1 second.

Views

System view

Predefined user roles

network-admin

Parameters

interval: Specifies the MAC change notification interval in the range of 1 to 20000 seconds.

Usage guidelines

To prevent syslog messages or SNMP notifications from being sent too frequently, set the MAC change notification interval to a larger value.

Examples

# Set the MAC change notification interval 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. The MAC Information mode specifies the type of messages (syslog messages or SNMP notifications) used to notify MAC changes.

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

Syntax

mac-address information mode { syslog | trap }

undo mac-address information mode

Default

SNMP notifications are sent to notify MAC changes.

Views

System view

Predefined user roles

network-admin

Parameters

syslog: Specifies that the device sends syslog messages to notify MAC changes.

trap: Specifies that the device sends SNMP notifications to notify MAC changes.

Examples

# Configure the MAC Information mode as trap.

<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

Predefined user roles

network-admin

Parameters

value: Specifies the MAC Information queue length in the range of 0 to 1000. The MAC Information queue length indicates the number of MAC change messages.

Usage guidelines

If the MAC Information queue length is 0, the device sends a syslog message or SNMP notification immediately after learning or deleting a MAC address.

If the MAC Information queue length is not 0, the device stores MAC changes in the queue:

·     The device overwrites the oldest MAC change written into the queue with the most recent MAC change when the following conditions exist:

¡     The MAC change notification interval does not expire.

¡     The queue has been exhausted.

·     The device sends syslog messages or SNMP notifications only if the MAC change notification interval expires.

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