Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

MAC Accounting

 

Enabling MAC Accounting on a Device

By default, MAC accounting is disabled on the device. You can enable packet accounting either for a device as a whole or for a specific VLAN. After you enable packet accounting, the Junos OS maintains packet counters for each MAC address learned.

To enable MAC accounting, include the global-mac-statistics statement at the [edit protocols l2-learning] hierarchy level:

Enabling MAC Accounting for a VLAN

By default, MAC accounting is disabled. You can enable packet counting for a VLAN. When you enable packet accounting, the Junos OS maintains packet counters for each MAC address learned on the interfaces in the VLAN.

To enable MAC accounting for a VLAN, include the mac-statistics statement at the [edit vlans vlan-name switch-options] hierarchy level:

Enabling MAC Accounting for a Set of VLANs

By default, MAC accounting is disabled. You can enable packet counting for a set of VLANs. After you enable packet accounting, the Junos OS maintains packet counters for each MAC address learned on the trunk port associated with the set of VLANs.

To enable MAC accounting for a set of VLANs, include the mac-statistics statement at the [edit switch-options] hierarchy level:

Verifying That MAC Accounting Is Working

Purpose

Verify that MAC accounting is enabled and the system is counting packets and collecting statistics.

Action

  1. Verify that MAC accounting is enabled.
  2. Display MAC accounting statistics for all VLANs associated with an interface.
  3. Display MAC accounting statistics for each address in the MAC address table.
    user@switch> show ethernet-switching table extensive

Meaning

In the output for show ethernet-switching table, the MAC flag SE indicates that MAC accounting is enabled for VLANs 101, 102, and 103, which are all associated with the default-switch routing instance.

The output for show ethernet-switching statistics displays packet statistics and the current number of MAC addresses learned by the VLANs associated with aggregated Ethernet interface ae20.0.

The output for show ethernet-switching table extensive shows information for each address in the MAC address table. In particular, it displays the number of packets sent to and received by an interface, which is identified by a MAC address.

The output from the three commands demonstrates that MAC accounting is working properly. That is, MAC accounting is enabled on VLANs 101, 102, and 103, and as a result, you can view statistics for each of these VLANs, aggregated Ethernet interface ae20.0, and each MAC address.