Skip to content
Ask AI

MAC-Scan Configuration

MAC-scan provides an automatic scanning function to detect the correlation between MAC addresses and IP addresses in the network. When there are terminals that cannot actively send ARP packets and the access devices cannot learn the corresponding ARP entries in a timely manner, other terminals in the network might face communication issues while trying to access these terminals. By enabling the MAC-scan feature on the corresponding interfaces, the device will send ARP request packets for specific IP addresses based on the information in the SNP table to determine if the corresponding terminal is online.

The SNP table serves as the primary reference for the MAC-scan detection feature. MAC-scan supports the following detection scopes:

By default, the detection scope of MAC-scan includes all terminals in the SNP table with the “local” attribute.

When the “mac-scan remote enable” command is enabled, MAC-scan will detect terminals regardless of whether their attributes are “local” or “remote.”

By default, the device sends ARP request packets every 10ms in a loop to all terminals within the detection scope. When there is a server in the network that requires detection, the device initiates an ARP request packet with the following format:

op=1Source MAC addressSend IP addressDestination MAC addressDestination IP address
00-00-00-00-00-00192.168.0.1ff-ff-ff-ff-ff-ff192.168.0.30
Configure TasksInstructions
Enable MAC-scan functionalityRequired
Configure Interfaces for detectionRequired
Configure MAC-scan detection scopeOptional
Configure MAC-scan detection periodOptional
Configure SNP table update based on detection resultsOptional
OperationCommandDescription
Enter the system configuration viewconfigure terminal
Enable MAC-scan functionmac-scan enable
OperationCommandDescription
Enter the system configuration viewconfigure terminal
Configure Interfaces for Detectionmac-scan interface interface-name

If the terminals in the network that need to be detected are fixed and non-migrating, it is recommended to use the default detection range, which only detects terminals with Snooping entries marked as local. This narrows the detection scope, allowing terminals to come online more quickly.

When there are mobile terminals in the network that do not actively request the gateway, you can expand the detection range to remote, which will detect all terminals in the Snooping table, regardless of whether they are marked as local or remote.

Additionally, MAC-scan supports detection based on subnet range. If there are many silent terminals under a particular subnet that rely on detection to come online, you can configure subnet-based detection as needed.

OperationCommandDescription
Enter the system configuration viewconfigure terminal
Configure the detection scope for global scanningmac-scan remote enable
Configure the detection IP rangemac-scan ip-rangesSpecify a single IP, such as A.B.C.D Specify a range of IP addresses between two values, such as from A.B.C.D to A.B.C.D Specify an IP network, such as A.B.C.D/M Specify a range of IP addresses within a subnet, such as A.B.C.D/M-A.B.C.D/M

Users can configure the MAC-scan transmission interval based on the number of terminals they need to detect online. A detection packet will be sent every configured interval to cyclically scan all terminals in the SNP table. Please note that the detection process involves CPU-generated ARP packets, which might lead to an increase in CPU utilization. It’s important to choose an appropriate detection period.

OperationCommandDescription
Enter the system configuration viewconfigure terminal
Configure the detection periodmac-scan period time

Configuring Updating SNP Table Entries Based on Detection Results

Section titled “Configuring Updating SNP Table Entries Based on Detection Results”

By default, devices only delete SNP table entries when they receive DHCP release packets or when the entries reach their aging time. If a device disconnects from the network without sending a release packet, it may leave unused SNP table entries behind. To address this, you can enable a feature that actively deletes SNP table entries for local attributes if no response is received after three detection attempts. This action does not impact statically bound table entries.

OperationCommandDescription
Enter the system configuration viewconfigure terminal
Configure Updating SNP Table Entries Based on Detection Resultsmac-scan no-response delete
OperationCommandDescription
Display MAC-scan configurationshow mac-scan config

Network requirements

There is a server in a network, which is a silent terminal and does not actively send packets to the outside world. It is required that the server can be online immediately after connecting to the network, so that other users in the network can access the server normally.

Procedure

  1. Configure the access VLAN and interface IP address # Create VLAN100 and configure the IP address
sonic(config)# vlan 100
sonic(config)# interface ethernet 1
sonic(config-if-1)# switchport access vlan 100
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# ip address 10.1.2.1/24

# Configure the IP address of the upstream port

sonic(config)# interface ethernet 49
sonic(config-if-49)# ip address 10.10.1.2
  1. Enable DHCP relay function
sonic(config)# dhcp-relay test v4
sonic(config-dhcp-relay-test__v4)# down_link interface vlan 100
sonic(config-dhcp-relay-test__v4)# up_link interface 49
sonic(config-dhcp-relay-test__v4)# server_ip 10.10.1.1
sonic(config-dhcp-relay-test__v4)# loopback_interface loopback 0
sonic(config-dhcp-relay-test__v4)# exit
  1. Enable DHCP Snooping function
sonic(config)# dhcp snooping enable
sonic(config)# interface vlan 100
sonic(config-vlanif-100)# dhcp-snooping enable

# Configure the interface connecting to the DHCP Server to be a trusted port

sonic(config)# interface ethernet 49
sonic(config-if-49)# dhcp-snooping enable
sonic(config-if-49)# dhcp-snooping trusted
  1. Enable MAC-scan function
sonic(config)# mac-scan enable
sonic(config)# mac-scan interface Vlan100

Verify configuration

  1. Before turning on probing # Table entries before the probe function is enabled
sonic(config)# do show snooping table
+---------+-------------------+-----------+------------+------------+-----------+---------+
| vlan | smac | sip | lease_time | time-stamp | switch_id | flag |
+=========+===================+===========+============+============+===========+=========+
| Vlan100 | 26:19:86:d3:73:63 | 10.1.2.10 | 6000 | 1679398564 | 10.1.1.1 | local |
+---------+-------------------+-----------+------------+------------+-----------+---------+
| Vlan100 | 00:00:44:01:01:46 | 10.1.2.20 | 6000 | 1679397285 | 10.1.1.1 | local |
+---------+-------------------+-----------+------------+------------+-----------+---------+
sonic(config)# do show arp
Address MacAddress Iface Vlan Type
-------------- ----------------- ---------- ---- --------
10.10.1.1 18:17:25:37:65:08 Ethernet49 - Dynamic
  1. After turning on probing
sonic(config)# do show arp
Address MacAddress Iface Vlan Type
-------------- ----------------- ---------- ---- --------
10.1.2.10 26:19:86:d3:73:63 Ethernet1 100 Dynamic
10.1.2.20 00:00:44:01:01:46 Ethernet1 100 Dynamic
10.10.1.1 18:17:25:37:65:08 Ethernet49 - Dynamic