---
title: VXLAN and BGP-EVPN
slug: aidc/vxlan-and-bgp-evpn
description: virtualization configuration
createdAt: 2025-12-01T11:11:08.000Z
---

## <font color="#1d50a2">VXLAN and BGP-EVPN View</font>

<font color="#1d05a2">Table 1 VXLAN and BGP-EVPN View</font>

| **Command**                                                                         | **Purpose**                       |
| ----------------------------------------------------------------------------------- | --------------------------------- |
| **show vxlan map**                                                                  | Display VXLAN mapping.            |
| **show vxlan tunnel**                                                               | Display VXLAN tunnels.            |
| **show vxlan statistics** *vxlan\_interface\_name* **peer** *peer-ip* vni *vni-id*  | Display VXLAN statistic.          |
| **clear vxlan static** *vxlan\_interface\_name* **peer** *peer-ip* **vni** *vni-id* | Clear VXLAN statistic.            |
| **show vxlan remotemac** \{**all**\|*A.B.C.D*}                                      | Display VXLAN remote MAC entries. |

### <font color="#1d50a2">show vxlan map</font>

**\[Command]**
**show vxlan map**

**\[Purpose]**
Display VXLAN mapping.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show vxlan map
+-------+--------+-------+
|   vni | vlan   | vrf   |
+=======+========+=======+
|   100 | 10     |       |
+-------+--------+-------+
|   200 | 20     |       |
+-------+--------+-------+
|  1000 |        | 123   |
+-------+--------+-------+
```

### <font color="#1d50a2">show vxlan tunnel</font>

**\[Command]**
**show vxlan tunnel**

**\[Purpose]**
Display VXLAN tunnels.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show vxlan tunnel
```

### <font color="#1d50a2">show vxlan statistics *vxlan\_interface\_name* peer *peer-ip* vni *vni-id*</font>

**\[Command]**
**show vxlan statistics** *vxlan\_interface\_name* **peer** *peer-ip* **vni** *vni-id*

**\[Purpose]**
Display VXLAN statistic.

**\[Parameters]**

| **Parameter**            | **Description**                |
| ------------------------ | ------------------------------ |
| *vxlan\_interface\_name* | VXLAN interface name.          |
| *peer-ip*                | Remote VTEP IP.                |
| *vni-id*                 | VXLAN Network Identifier, VNI. |

**\[View]**
Privileged User View

**\[Notes]**
CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 is not supported yet.

**\[Use Cases]**

```plaintext
sonic# show vxlan statistics 0 peer 10.1.0.207 vni 100
```

### <font color="#1d50a2">clear vxlan static *vxlan\_interface\_name* peer *peer-ip* vni *vni-id*</font>

**\[Command]**
**clear vxlan statistics** *vxlan\_interface\_name* **peer** *peer-ip* **vni** *vni-id*

**\[Purpose]**
Clear VXLAN statistic.

**\[Parameters]**

| **Parameter**            | **Description**                |
| ------------------------ | ------------------------------ |
| *vxlan\_interface\_name* | VXLAN interface name.          |
| *peer-ip*                | Remote VTEP IP.                |
| *vni-id*                 | VXLAN Network Identifier, VNI. |

**\[View]**
Privileged User View

**\[Notes]**
CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 is not supported yet.

**\[Use Cases]**

```plaintext
sonic# clear vxlan statistics 0 peer 10.1.0.207 vni 100
```

### <font color="#1d50a2">show vxlan remotemac \{all|*A.B.C.D*\}</font>

**\[Command]**
**show vxlan remotemac** \{**all**|*A.B.C.D*}

**\[Purpose]**
Display VXLAN remote MAC entries.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address    |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show vxlan remotemac all
+--------+-------------------+--------------+-------+---------+
| VLAN   | MAC               | RemoteVTEP   |   VNI | Type    |
+========+===================+==============+=======+=========+
| Vlan17 | 60:eb:5a:00:d4:22 | 10.1.0.236   |    17 | dynamic |
+--------+-------------------+--------------+-------+---------+
| Vlan18 | 60:eb:5a:00:d4:22 | 10.1.0.236   |    18 | dynamic |
+--------+-------------------+--------------+-------+---------+

Total count : 2
sonic# show vxlan remotemac 10.1.0.236
+--------+-------------------+--------------+-------+---------+
| VLAN   | MAC               | RemoteVTEP   |   VNI | Type    |
+========+===================+==============+=======+=========+
| Vlan17 | 60:eb:5a:00:d4:22 | 10.1.0.236   |    17 | dynamic |
+--------+-------------------+--------------+-------+---------+
| Vlan18 | 60:eb:5a:00:d4:22 | 10.1.0.236   |    18 | dynamic |
+--------+-------------------+--------------+-------+---------+

Total count : 2
```

## <font color="#1d50a2">VXLAN and EVPN Config</font>

<font color="#1d05a2">Table 2 VXLAN and BGP-EVPN Config</font>

| **Command**                                                                                                 | **Purpose**                                                           |
| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| **interface vxlan** *vxlan\_interface\_name*                                                                | Configure VXLAN interface.                                            |
| **mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* **vxlanvni** *vni-id* **peer** *peer-ip* | Configure static MAC entry for VXLAN.                                 |
| **source** *ip-address*                                                                                     | Set local VTEP IP of VXLAN.                                           |
| **vni** *vni-id* \[**vxlan** *vxlan\_interface\_name*]                                                      | Add VXLAN mapping.                                                    |
| **ip route** *A.B.C.D/M* *A.B.C.D* **vxlan-vni** *vni-id*                                                   | Configure static routes for VXLAN.                                    |
| **address-family l2vpn evpn**                                                                               | Enter L2VPN EVPN Address-family View                                  |
| **neighbor** *A.B.C.D* **activate**                                                                         | Enable EVPN of BGP neighbors.                                         |
| **advertise-all-vni**                                                                                       | Enable advertisement of all VNIs.                                     |
| **advertise ipv4 unicast**                                                                                  | Enable type-5 route advertisement.                                    |
| **table-map** *map\_name*                                                                                   | Add a route leak policy.                                              |
| **import vrf** *vrf\_name*                                                                                  | Specify the VRF of route leak.                                        |
| **vxlan statistics peer** *peer-ip* **vni** *vni-id* **enable**                                             | Configure EVPN Layer 3 tunnel traffic statistics.                     |
| **vxlan mode centralized**                                                                                  | Enable VXLAN centralized gateway.                                     |
| **vxlan udp-port** *port-number*                                                                            | Specify the UDP destination port number used for VXLAN encapsulation. |
| **rd** *rd-num*                                                                                             | Configure the RD for Layer 2 VNI.                                     |
| **route-target** \{**both**\|**import\|export}** rt-num                                                     | Configure the RT for Layer 2 VNI.                                     |
| **rd** *rd-num*                                                                                             | Configure the RD for Layer 3 VNI.                                     |
| **route-target** \{**both**\|**import\|export}** rt-num                                                     | Configure the RT for Layer 3 VNI.                                     |

### <font color="#1d50a2">interface vxlan *vxlan\_interface\_name*</font>

**\[Command]**
**interface vxlan** *vxlan\_interface\_name*

**\[Purpose]**
Configure VXLAN interface.

**\[Parameters]**

| **Parameter**            | **Description**                                                                                                          |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| *vxlan\_interface\_name* | VXLAN interface name, The value range is 0-9 on CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2, and **0** on other models. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no interface vxlan** *vxlan\_interface\_name* to delete VXLAN interface.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface vxlan 0
```

### <font color="#1d50a2">mac-address static *HH\:HH\:HH\:HH\:HH\:HH* vlan *vlan-id* vxlan vni *vni-id* peer *peer-ip*</font>

**\[Command]**
**mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* **vxlan vni** *vni-id* **peer** *peer-ip*

**\[Purpose]**
Configure static MAC entry for VXLAN.

**\[Parameters]**

| **Parameter**            | **Description**                  |
| ------------------------ | -------------------------------- |
| *HH\:HH\:HH\:HH\:HH\:HH* | MAC address.                     |
| *vlan-id*                | VLAN ID, the range is \[1,4094]. |
| *vni-id*                 | VXLAN Network Identifier, VNI.   |
| *peer-ip*                | Remote VTEP IP.                  |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no mac-address static** *HH\:HH\:HH\:HH\:HH\:HH* **vlan** *vlan-id* to delete VXLAN static MAC entry.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# mac-address static 18:17:25:37:65:0a vlan 100 vxlan vni 10 peer 20.0.0.2
```

### <font color="#1d50a2">source *ip-address*</font>

**\[Command]**
**source** *ip-address*

**\[Purpose]**
Set local VTEP IP of VXLAN.

**\[Parameters]**

| **Parameter** | **Description**        |
| ------------- | ---------------------- |
| *ip-address*  | Local VTEP IP address. |

**\[View]**
VXLAN Interface Configuration View

**\[Notes]**
Run command **no source** to delete VXLAN local\_vtep\_ip

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# interface vxlan 0
sonic(config-vxlanif-0)# source 10.0.0.1
```

### <font color="#1d50a2">vni *vni-id* \[vxlan *vxlan\_interface\_name*\]</font>

**\[Command]**
**vni** *vni-id* \[**vxlan** *vxlan\_interface\_name*]

**\[Purpose]**
Add VXLAN mapping.

**\[Parameters]**

| **Parameter**            | **Description**                                                                                                                                             |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *vni-id*                 | VXLAN Network Identifier, VNI.                                                                                                                              |
| *vxlan\_interface\_name* | VXLAN interface name. The value range is 0-9 on CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2, and 0 on other models. Default value is 0 when not specified. |

**\[View]**
Global Configuration View / VLAN Configuration View / VRF Configuration View

**\[Notes]**
Run command **no vni** *vni-id* to delete VXLAN mapping.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# vni 1
sonic(config)# vlan 100
sonic(config-vlan-100)# vni 2
sonic(config)# vrf 123
sonic(config-vrf)# vni 1000
```

### <font color="#1d50a2">ip route *A.B.C.D/M* *A.B.C.D* vxlan-vni *vni-id*</font>

**\[Command]**
**ip route** *A.B.C.D/M A.B.C.D* **vxlan-vni** *vni-id*

**\[Purpose]**
Configure static routes for VXLAN.

**\[Parameters]**

| **Parameter** | **Description**                                      |
| ------------- | ---------------------------------------------------- |
| *A.B.C.D/M*   | Specify the destination network segment for routing. |
| *A.B.C.D*     | Specify the IP address of next hop of the route.     |
| *vni-id*      | VXLAN Network Identifier, VNI.                       |

**\[View]**
VRF Configuration View

**\[Notes]**
Run command **no ip route** *A.B.C.D/M A.B.C.D* **vxlan-vni** *vni-id* to delete static routes for VXLAN.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# ip route 20.0.0.0/24 10.0.0.57 vxlan-vni 200
```

### <font color="#1d50a2">address-family l2vpn evpn</font>

**\[Command]**
**address-family l2vpn evpn**

**\[Purpose]**
Enter L2VPN EVPN Address-family View

**\[View]**
BGP Configuration View

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65227
sonic(config-router)# address-family l2vpn evpn
```

### <font color="#1d50a2">neighbor *A.B.C.D* activate</font>

**\[Command]**
**neighbor** *A.B.C.D* **activate**

**\[Purpose]**
Enable EVPN of BGP neighbors.

**\[Parameters]**

| **Parameter** | **Description**           |
| ------------- | ------------------------- |
| *A.B.C.D*     | BGP neighbor IPv4 address |

**\[View]**
BGP EVPN Address-family View

**\[Notes]**
Run command **no neighbor** *A.B.C.D* **activate** to disable EVPN of BGP neighbors.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65227
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# neighbor 68.0.0.1 activate
```

### <font color="#1d50a2">advertise-all-vni</font>

**\[Command]**
**advertise-all-vni**

**\[Purpose]**
Enable advertisement of all VNIs.

**\[View]**
BGP EVPN Address-family View

**\[Notes]**
Run command **no advertise-all-vni** to disable advertisement of all VNIs.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65227
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise-all-vni
```

### <font color="#1d50a2">advertise ipv4 unicast</font>

**\[Command]**
**advertise ipv4 unicast**

**\[Purpose]**
Enable type-5 route advertisement.

**\[View]**
BGP EVPN Address-family View

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65227
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# advertise ipv4 unicast
```

### <font color="#1d50a2">table-map *map\_name*</font>

**\[Command]**
**table-map** *map\_name*

**\[Purpose]**
Add a route leak policy.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *map\_name*   | Route Map name. |

**\[View]**
BGP IPv4 unicast Address-family View

**\[Notes]**
Run command **no table-map** *map\_name* to delete the route leak policy.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65227
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# table-map RM_ROUTE_LEAK_2000
```

### <font color="#1d50a2">import vrf *vrf\_name*</font>

**\[Command]**
**import vrf** *vrf\_name*

**\[Purpose]**
Specify the VRF of route leak.

**\[Parameters]**

| **Parameter** | **Description**                                   |
| ------------- | ------------------------------------------------- |
| *vrf\_name*   | Specify the VRF name, the default VRF is default. |

**\[View]**
BGP IPv4 unicast Address-family View

**\[Notes]**
Run command **no import vrf** *vrf\_name* to delete the VRF of route leak.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65227
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# import vrf 200
```

### <font color="#1d50a2">vxlan statistics peer *peer-ip* vni *vni-id* enable</font>

**\[Command]**
**vxlan statistics peer** *peer-ip* **vni** *vni-id* **enable**

**\[Purpose]**
Configure EVPN Layer 3 tunnel traffic statistics.

**\[Parameters]**

| **Parameter** | **Description**                |
| ------------- | ------------------------------ |
| *peer-ip*     | Remote VTEP IP.                |
| *vni-id*      | VXLAN Network Identifier, VNI. |

**\[View]**
VXLAN Interface Configuration View

**\[Notes]**
CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 is not supported yet.
Run command **no vxlan statistics peer** *peer-ip* **vni** *vni-id* **enable** to delete EVPN tunnel traffic statistics configuration.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# interface vxlan 0
sonic(config-vxlanif-0)# vxlan statistics peer 10.1.0.226 vni 1000 enable
```

### <font color="#1d50a2">vxlan mode centralized</font>

**\[Command]**
**vxlan mode centralized**

**\[Purpose]**
Enable VXLAN centralized gateway.

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no vxlan mode centralized** to disable VXLAN centralized gateway.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# vxlan mode centralized
```

### <font color="#1d50a2">vxlan udp-port *port-number*</font>

**\[Command]**
**vxlan udp-port** *port-number*

**\[Purpose]**
Specify the UDP destination port number used for VXLAN encapsulation.

**\[Parameters]**

| **Parameter** | **Description**                                       |
| ------------- | ----------------------------------------------------- |
| *port-number* | Range from 1 to 65535, and the default value is 4789. |

**\[View]**
Global Configuration View

**\[Notes]**
This configuration requires that it be saved and then reload the device to take effect.
Run command **no vxlan udp-port** command to restore the UDP destination port number used for VXLAN to the default value..

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# vxlan udp-port 7788
```

### <font color="#1d50a2">rd *rd-num*</font>

**\[Command]**
**rd** *rd-num*

**\[Purpose]**
Configure the RD for Layer 2 VNI.

**\[Parameters]**

| **Parameter** | **Description**                      |
| ------------- | ------------------------------------ |
| *rd-num*      | The format is A.B.C.D\:MN\| ASN\:XX. |

**\[View]**
Layer 2 VNI view under BGP EVPN address-family.

**\[Notes]**
RD storage takes up 6 bytes in three formats: 2-byte ASN with 4-byte custom integer value; 4-byte IP with 2-byte custom integer value; and 4-byte ASN with 2-byte custom integer value.
Run command **no rd** \[*rd-num*] command to delete the RD configuration.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65100
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# vni 26
sonic(config-router-af-vni)# rd 11:22
```

### <font color="#1d50a2">route-target \{both|import|export\} *rt-num*</font>

**\[Command]**
**route-target** \{**both**|**import**|**export**} *rt-num*

**\[Purpose]**
Configure the RT for Layer 2 VNI.

**\[Parameters]**

| **Parameter**                    | **Description**                                |
| -------------------------------- | ---------------------------------------------- |
| **both**\|**import**\|**export** | Decide the direction in which RT takes effect. |
| *rt-num*                         | The format is A.B.C.D\:MN\|EF\:OPQR\|GHJK\:MN. |

**\[View]**
Layer 2 VNI view under BGP EVPN address-family.

**\[Notes]**
Run command **no route-target** \{**both** \[*rt-num*]| **import** *rt-num* | **export** *rt-num* } command to delete the RT configuration.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65100
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# vni 26
sonic(config-router-af-vni)# route-target both 12.3.4.5:66
```

### <font color="#1d50a2">rd *rd-num*</font>

**\[Command]**
**rd** *rd-num*

**\[Purpose]**
Configure the RD for Layer 3 VNI.

**\[Parameters]**

| **Parameter** | **Description**           |
| ------------- | ------------------------- |
| *rd-num*      | The format is A.B.C.D\:MN |

**\[View]**
BGP EVPN address-family view under the corresponding VRF of the Layer 3 VNI

**\[Notes]**
RD storage takes up 6 bytes in three formats: 2-byte ASN with 4-byte custom integer value; 4-byte IP with 2-byte custom integer value; and 4-byte ASN with 2-byte custom integer value.
Run command **no rd** *rd-num* command to delete the RD configuration.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65100 vrf 132
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# rd 55:120
```

### <font color="#1d50a2">route-target \{both|import|export\} *rt-num*</font>

**\[Command]**
**route-target** \{**both**|**import**|**export**} *rt-num*

**\[Purpose]**
Configure the RT for Layer 3 VNI.

**\[Parameters]**

| **Parameter**                    | **Description**                                |
| -------------------------------- | ---------------------------------------------- |
| **both**\|**import**\|**export** | Decide the direction in which RT takes effect. |
| *rt-num*                         | The format is A.B.C.D\:MN\|EF\:OPQR\|GHJK\:MN. |

**\[View]**
BGP EVPN address-family view under the corresponding VRF of the Layer 3 VNI.

**\[Notes]**
Run command **no route-target** \{**both**| **import**| **export**} *rt-num* command to delete the RT configuration.

**\[Use Cases]**

```plaintext
sonic# config
sonic(config)# router bgp 65100 vrf 132
sonic(config-router)# address-family l2vpn evpn
sonic(config-router-af)# route-target both 65207:66
```

##

