12.2. Configuring NVGRE
Overview
Function Introduction
Network Virtualization using Generic Routing Encapsulation (NVGRE) is an encapsulation technique intended to allow virtual network overlays across the physical network. NVGRE uses Generic Routing Encapsulation (GRE) as the encapsulation method. It uses the lower 24 bits of the GRE header to represent the Tenant Network Identifier (TNI). Like VXLAN this 24 bit space allows for 16 million virtual networks.
Principle Description
N/A
Configuration
NVGRE Configuration
In the following example, switch1 and swith2 are connected via layer 3 route. The traffic of vlan 20 are encapsulated in vni 20000, in order to pass through the layer 3 networks.
The following configuration should be operated on all switches if the switch ID is not specified.
step 1 Enter the configure mode
Switch# configure terminal
step 2 Enter the vlan configure mode and create vlan, enable overlay for each vlan
Switch(config)# vlan database
Switch(config-vlan)# vlan 20
Switch(config-vlan)# vlan 20 overlay enable
Switch(config-vlan)# exit
step 3 Enter the interface configure mode and set the attributes of the interface
Switch(config)# interface eth-0-1
Switch(config-if)# switchport access vlan 20
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface eth-0-2
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan add 20
Switch(config-if)# no shutdown
Switch(config-if)# exit
Interface configuration for Switch1:
Switch(config)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# ip address 9.9.9.1/24
Switch(config-if)# overlay uplink enable
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface loopback0
Switch(config-if)# ip address 1.1.1.1/32
Switch(config-if)# exit
Interface configuration for Switch2:
Switch(config)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# ip address 9.9.9.2/24
Switch(config-if)# overlay uplink enable
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface loopback0
Switch(config-if)# ip address 2.2.2.2/32
Switch(config-if)# exit
Step 4 Create a static route
Configuring Switch1:
Switch(config)# ip route 2.2.2.0/24 9.9.9.2
Configuring Switch2:
Switch(config)# ip route 1.1.1.0/24 9.9.9.1
step 5 Set attributes for overlay
Configuring Switch1:
Switch(config)# overlay
Switch(config-overlay)# source 1.1.1.1
Switch(config-overlay)# remote-vtep 1 ip-address 2.2.2.2 type nvgre
Switch(config-overlay)# vlan 20 vni 20000
Switch(config-overlay)# vlan 20 remote-vtep 1
Switch(config-overlay)# exit
Configuring Switch2:
Switch(config)# overlay
Switch(config-overlay)# source 2.2.2.2
Switch(config-overlay)# remote-vtep 1 ip-address 1.1.1.1 type nvgre
Switch(config-overlay)# vlan 20 vni 20000
Switch(config-overlay)# vlan 20 remote-vtep 1
Switch(config-overlay)# exit
step 6 Exit the configure mode
Switch(config)# end
step 7 Validation
Display the result on Switch1:
Switch# show overlay vlan 20
-------------------------------------------------------
ECMP Mode : Normal
Source VTEP : 1.1.1.1
-------------------------------------------------------
VLAN ID : 20
VNI : 20000
EVPN Tunnel Data-fdb Learning : Eanble
Remote VTEP NUM: 1
Index: 1, Ip address: 2.2.2.2, Source ip: 1.1.1.1, Type: NvGRE,
Protocol: Static
DVR Gateway NUM: 0
-------------------------------------------------------
Display the result on Switch2:
Switch# show overlay vlan 20
-------------------------------------------------------
ECMP Mode : Normal
Source VTEP : 2.2.2.2
-------------------------------------------------------
VLAN ID : 20
VNI : 20000
EVPN Tunnel Data-fdb Learning : Eanble
Remote VTEP NUM: 1
Index: 1, Ip address: 1.1.1.1, Source ip: 2.2.2.2, Type: NvGRE,
Protocol: Static
DVR Gateway NUM: 0
------------------------------------------------------
Configuring NVGRE Routing
In the following example, VM-1 & VM-3 are encapsulated in same vni to make up the distributed route via NVGRE; VM-2 & VM-4 are encapsulated in another vni to make up the distributed route via NVGRE.
The following configuration should be operated on all switches if the switch ID is not specified.
step 1 Enter the configure mode
Switch# configure terminal
step 2 Enter the vlan configure mode and create vlan, enable overlay for each vlan
Switch(config)# vlan database
Switch(config-vlan)# vlan 20,30
Switch(config-vlan)# vlan 20 overlay enable
Switch(config-vlan)# vlan 30 overlay enable
Switch(config-vlan)# exit
step 3 Create a vrf instance
Switch(config)# ip vrf tenant
Switch(config-vrf)# exit
step 4 Create the layer 3 interface and set the ip address
Configuring Switch1:
Switch(config)# interface vlan 20
Switch(config-if)# ip vrf forwarding tenant
Switch(config-if)# ip address 2.2.2.111/24
Switch(config-if)# exit
Switch(config)# interface vlan 30
Switch(config-if)# ip vrf forwarding tenant
Switch(config-if)# ip address 3.3.3.111/24
Switch(config-if)# exit
Configuring Switch2:
Switch(config)# interface vlan 20
Switch(config-if)# ip vrf forwarding tenant
Switch(config-if)# ip address 2.2.2.222/24
Switch(config-if)# exit
Switch(config)# interface vlan 30
Switch(config-if)# ip vrf forwarding tenant
Switch(config-if)# ip address 3.3.3.222/24
Switch(config-if)# exit
step 5 Enter the interface configure mode and set the attributes of the interface
Switch(config)# interface eth-0-1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan add 20
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface eth-0-2
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk allowed vlan add 30
Switch(config-if)# no shutdown
Switch(config-if)# exit
Configuring Switch1:
Switch(config)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# ip address 9.9.9.1/24
Switch(config-if)# overlay uplink enable
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface loopback0
Switch(config-if)# ip address 1.1.1.1/32
Switch(config-if)# exit
Configuring Switch2:
Switch(config)# interface eth-0-9
Switch(config-if)# no switchport
Switch(config-if)# ip address 9.9.9.2/24
Switch(config-if)# overlay uplink enable
Switch(config-if)# no shutdown
Switch(config-if)# exit
Switch(config)# interface loopback0
Switch(config-if)# ip address 2.2.2.2/32
Switch(config-if)# exit
step 6 Set attributes for overlay
Configuring Switch1:
Switch(config)# overlay
Switch(config-overlay)# source 1.1.1.1
Switch(config-overlay)# remote-vtep 1 ip-address 2.2.2.2 type nvgre
Switch(config-overlay)# remote-vtep 1 virtual-mac 22.22.22
Switch(config-overlay)# vlan 20 vni 20000
Switch(config-overlay)# vlan 30 vni 30000
Switch(config-overlay)# vlan 20 remote-vtep 1
Switch(config-overlay)# vlan 30 remote-vtep 1
Switch(config-overlay)# vlan 20 gateway-mac a.a.a
Switch(config-overlay)# vlan 30 gateway-mac b.b.b
Switch(config-overlay)# exit
Configuring Switch2:
Switch(config)# overlay
Switch(config-overlay)# source 2.2.2.2
Switch(config-overlay)# remote-vtep 1 ip-address 1.1.1.1 type nvgre
Switch(config-overlay)# remote-vtep 1 virtual-mac 11.11.11
Switch(config-overlay)# vlan 20 vni 20000
Switch(config-overlay)# vlan 30 vni 30000
Switch(config-overlay)# vlan 20 remote-vtep 1
Switch(config-overlay)# vlan 30 remote-vtep 1
Switch(config-overlay)# vlan 20 gateway-mac a.a.a
Switch(config-overlay)# vlan 30 gateway-mac b.b.b
Switch(config-overlay)# exit
step 7 Create a static routes and NVGRE routes
Configuring Switch1:
Switch(config)# ip route 2.2.2.0/24 9.9.9.2
Switch(config)# ip route vrf tenant 2.2.2.2/32 remote-vtep 1 vni 20000 inner-macda 3.3.3
Switch(config)# ip route vrf tenant 3.3.3.2/32 remote-vtep 1 vni 30000 inner-macda 4.4.4
Configuring Switch2:
Switch(config)# ip route 1.1.1.0/24 9.9.9.1
Switch(config)# ip route vrf tenant 2.2.2.1/32 remote-vtep 1 vni 20000 inner-macda 1.1.1
Switch(config)# ip route vrf tenant 3.3.3.1/32 remote-vtep 1 vni 30000 inner-macda 2.2.2
step 8 Exit the configure mode
Switch(config)# end
step 9 Validation
Display the result on Switch1:
Switch# show ip route vrf tenant
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
Dc - DHCP Client
[*] - [AD/Metric]
* - candidate default
S 2.2.2.2/32 is in overlay remote nvgre vtep:1.1.1.1->2.2.2.2, vni:20000
S 3.3.3.2/32 is in overlay remote nvgre vtep:1.1.1.1->2.2.2.2,
vni:30000
Display the result on Switch2:
Switch# show ip route vrf tenant
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
Dc - DHCP Client
[*] - [AD/Metric]
* - candidate default
S 2.2.2.1/32 is in overlay remote nvgre vtep:2.2.2.2->1.1.1.1,
vni:20000
S 3.3.3.1/32 is in overlay remote nvgre vtep:2.2.2.2->1.1.1.1, vni:30000
Application cases {application-cases-116}`
N/A