---
title: MAC-Scan Configuration
slug: enterprise-v5p2/mac-scan-configuration
createdAt: 2025-12-02T11:24:02.824Z
---

# <font color="#1d50a2">Introduction</font>

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.

# <font color="#1d50a2">Explanation of Principles</font>

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:

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/VDBg6u5evXzuZm2CPv6RZ-20251202-112531.png" size="70" width="452" height="207" position="center" showCaption="false"}

| **op=1** | **Source MAC address** | **Send IP address** | **Destination  MAC address** | **Destination  IP address** |
| -------- | ---------------------- | ------------------- | ---------------------------- | --------------------------- |
|          | 00-00-00-00-00-00      | 192.168.0.1         | ff-ff-ff-ff-ff-ff            | 192.168.0.30                |

# <font color="#1d50a2">MAC-scan Configuration</font>

| **Configure Tasks**                                    | **Instructions** |
| ------------------------------------------------------ | ---------------- |
| Enable MAC-scan  functionality                         | Required         |
| Configure Interfaces for  detection                    | Required         |
| Configure MAC-scan  detection scope                    | Optional         |
| Configure MAC-scan  detection period                   | Optional         |
| Configure SNP table  update based on detection results | Optional         |

## <font color="#1d50a2">Enabling MAC-scan Function</font>

| **Operation**                       | **Command**            | **Description** |
| ----------------------------------- | ---------------------- | --------------- |
| Enter the system configuration view | **configure terminal** |                 |
| Enable MAC-scan function            | **mac-scan enable**    |                 |

## <font color="#1d50a2">Configuring Interfaces for Detection</font>

| **Operation**                       | **Command**                             | **Description** |
| ----------------------------------- | --------------------------------------- | --------------- |
| Enter the system configuration view | **configure terminal**                  |                 |
| Configure Interfaces for Detection  | **mac-scan interface** *interface-name* |                 |

## <font color="#1d50a2">Configuring MAC-scan detection scope</font>

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.

| **Operation**                                     | **Command**                | **Description**                                                                                                                                                                                                                                        |
| ------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Enter the system configuration view               | **configure terminal**     |                                                                                                                                                                                                                                                        |
| Configure the detection scope for global scanning | **mac-scan remote enable** |                                                                                                                                                                                                                                                        |
| Configure the detection IP range                  | **mac-scan ip-ranges**     | Specify 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 |

## <font color="#1d50a2">Configuring MAC-scan detection period</font>

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.

| **Operation**                       | **Command**                | **Description** |
| ----------------------------------- | -------------------------- | --------------- |
| Enter the system configuration view | **configure terminal**     |                 |
| Configure the detection period      | **mac-scan period** *time* |                 |

## <font color="#1d50a2">Configuring Updating SNP Table Entries Based on Detection Results</font>

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.

| **Operation**                                                    | **Command**                     | **Description** |
| ---------------------------------------------------------------- | ------------------------------- | --------------- |
| Enter the system configuration view                              | **configure terminal**          |                 |
| Configure Updating SNP  Table Entries Based on Detection Results | **mac-scan no-response delete** |                 |

## <font color="#1d50a2">Display and Maintenance</font>

| **Operation**                   | **Command**               | **Description** |
| ------------------------------- | ------------------------- | --------------- |
| Display  MAC-scan configuration | **show  mac-scan config** |                 |

# <font color="#1d50a2">Configuration Example</font>

<font color="#1d50a2">**Network requirements**</font>

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.

::Image[]{src="https://app.archbee.com/api/optimize/zl-MD6bX0o2Ab3p8w66u1/vuhGagVV2u65mouBnCjrj-20251202-112737.png" size="60" width="568" height="403" position="center" showCaption="false"}

<font color="#1d50a2">**Procedure**</font>

1. Configure the access VLAN and interface IP address
   \# Create VLAN100 and configure the IP address

```text
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

```text
sonic(config)# interface ethernet 49
sonic(config-if-49)# ip address 10.10.1.2
```

2. Enable DHCP relay function

```text
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
```

3. Enable DHCP Snooping function

```text
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

```text
sonic(config)# interface ethernet 49
sonic(config-if-49)# dhcp-snooping enable
sonic(config-if-49)# dhcp-snooping trusted
```

4. Enable MAC-scan function

```text
sonic(config)# mac-scan enable
sonic(config)# mac-scan interface Vlan100
```

<font color="#1d50a2">**Verify configuration**</font>

1. Before turning on probing
   \# Table entries before the probe function is enabled

```text
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
```

2. After turning on probing

```text
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
```

##

