04-Layer 2 - LAN Switching Command Reference

HomeSupportSwitchesH3C S12500 Switch SeriesReference GuidesCommand ReferencesH3C S12500 Command References-Release1828P04-6W18204-Layer 2 - LAN Switching Command Reference
02-MAC Address Table Commands
Title Size Download
02-MAC Address Table Commands 137.44 KB

MAC address table 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 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.

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 is in the range of 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 display mac-address 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     1      Learned          GigabitEthernet3/0/18        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.

·     LearnedDynamic entry learned by the switch.

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

·     MultiportMulti-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 of this port. This field displays 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 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 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 is in the range of 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 display mac-address multiport 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  ---

display mac-flapping information

Syntax

In standalone mode:

display mac-flapping information [ slot slot-number ]

In IRF mode:

display mac-flapping information [ chassis chassis-number [ slot slot-number ] ]

View

Any view

Default level

1: Monitor level

Parameters

slot slot-number: Displays the MAC address migration records of a specific card. The slot-number argument specifies a card by its slot number. If you do not specify this option, the command displays MAC address migration records of all cards. (In standalone mode.)

chassis chassis-number [ slot slot-number ]: Displays the MAC address migration records of a specific card on an IRF member device. The chassis-number argument refers to the ID of the IRF member device, and the slot-number argument refers to the number of the slot where the card resides. If you only specify the chassis chassis-number option, the command displays the MAC address migration records of all cards on an IRF member device. (In IRF mode.)

Description

Use display mac-flapping information to display the MAC address migration records after the device starts up.

If a MAC address migrates frequently between two specific interfaces that belong to the same VLAN, a Layer 2 loops probably occurs in the network. You can discover and locate the loop by viewing the MAC address migration records.

Up to 20 records can be saved on each card.

Examples

# Display the MAC address migration records on the card with ID 4.

<Sysname> display mac-flapping information slot 4

MAC Address    VLAN Current Port  Source Port   Last Time           Time(s)

0000-0001-002c 1    GE2/0/25      GE2/0/20      2012-07-20 13:40:52 1

 

  ---  1 mac-flapping record(s) found  ---

# Display the MAC address migration records on all cards.

<Sysname> display mac-flapping information

----------------------chassis 1 slot 2 mac-flapping information-----------------

MAC Address    VLAN Current Port  Source Port   Last Time           Time(s)

0000-0001-002c 1    GE1/2/0/25    GE1/2/0/20    2012-07-20 13:40:52 20

0000-0001-002d 1    GE1/2/0/25    GE1/2/0/20    2012-07-20 13:40:52 17

 

  ---  2 mac-flapping record(s) found  ---

Table 2 Command output

Field

Description

MAC Address

MAC address.

VLAN

ID of the VLAN to which the interfaces of the MAC address migration record belongs.

Current Port

Current interface with which the MAC address associates.

Source Port

Source interface from which the MAC address migrates.

Last Time

Time when last MAC address migration occurs.

Time(s)

Number of MAC address migration occurs after a device starts up. For a MAC address, the value of this field plus 1 only when the VLAN, Current Port, and Source Port fields are the same with the first record.

 

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

static: Displays 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. The value range for the vlan-id argument is 1 to 4094.

Description

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

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

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: Specifies 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. The value range for the vlan-id argument is 1 to 4094.

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.

interface interface-type interface-number: Specifies an outgoing 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, 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 is in the range of 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 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 disable the switch 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 port.

Use undo mac-address max-mac-count disable-forwarding 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, and frames with unknown source MAC addresses are forwarded when the MAC learning limit is reached.

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 is in the range of 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 correctly.

Description

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

Use mac-address max-mac-count disable-forwarding to disable the switch 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 a VLAN.

Use undo mac-address max-mac-count disable-forwarding 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, and frames with unknown source MAC addresses are forwarded when the MAC learning limit is reached. 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. The value range for the vlan-id argument is 1 to 4094.

Description

Use mac-address multiport to configure a multi-port unicast MAC address entry on a specified interface.

Use undo mac-address multiport 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 with 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. The value range for the vlan-id argument is 1 to 4094.

Description

Use mac-address multiport to configure a multi-port unicast MAC address entry.

Use undo mac-address multiport 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 with 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 of 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 is in the range of 10 to 86400 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 aging to restore the default.

By default, the aging timer is 300 seconds.

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 hence unnecessary broadcasts , which might 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

mac-flapping notification enable

Syntax

mac-flapping notification enable

undo mac-flapping notification enable

View

System view

Default level

2: System level

Parameters

None.

Description

Use mac-flapping notification enable to enable MAC address migration log notifying.

Use undo mac-flapping notification enable to disable the MAC address migration notifying.

A MAC address migration log contains a MAC address, ID of the VLAN to which the MAC address belongs, source interface from which the MAC address migrates, and the current interface with which the MAC address associates.

By default, MAC address migration log notifying is disabled.

After enabling MAC address migration log notifying, the MAC address migration log of the last 1 minute are displayed once every 1 minute.

Up to 10 logs can be saved on each card in 1 minute.

Examples

# Enable MAC address migration log notifying.

<Sysname> system-view

[Sysname] mac-flapping notification enable

[Sysname]

%Jun 14 17:16:45:688 2012 H3C DFDB/4/INFO: -Chassis=1-Slot=3; MAC address 0000-0

012-0034 in vlan 500 has flapped from port XGE2/10/0/16 to port GE1/3/0/1 1 time

(s).

The output shows that the MAC address 0000-0012-0034 belongs to VLAN 500, the source interface from which the MAC address migrates from is XGE2/10/0/16 ( XGE represents 10-GE interfaces), the current interface with which the MAC address associates is GE 1/3/0/1, and the MAC address migrates one time in the last 1 minute.

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