How to to configure VPN with a backup peer using BGP
This article describes how to create 2 vpn tunnels with a backup vpn peer.
When the Primary VPN peer is unreachable, the backup peer will take over the connection.
When the Primary VPN peer comes back, the connection fails back to it using BGP.
We will use Routed VPN and BGP will distribute the routes over the tunnel interfaces.
Primary Local VPN Peer IP | Primary Local VPN tunnel ip | Primary Local vNet subnet | Primary Remote VPN Peer IP | Primary Remote VPN tunnel IP | Primary Remote vNet subnet |
---|---|---|---|---|---|
185.105.202.41 | 172.30.30.2 | 172.16.1.0/24 | 188.126.112.105 | 172.30.30.1 | 192.168.5.0/24 |
Backup Local VPN Peer IP | Backup Local VPN tunnel ip | Backup Local vNet subnet | Backup Remote VPN Peer IP | Backup Remote VPN tunnel IP | Backup Remote vNet subnet |
---|---|---|---|---|---|
185.105.202.42 | 172.30.31.2 | 172.16.1.0/24 | 188.126.114.214 | 172.30.31.1 | 192.168.5.0/24 |
Tested this between 2 vCloud tenants, started a ping between vms
Both tunnels where up.
Checked the routing table on the Edge via ssh
BGP is learning the following route
vse-279442fe-571c-47c7-a74e-e003c86b1e1a-0> show ip route bgp
Codes: O - OSPF derived, i - IS-IS derived, B - BGP derived,
C - connected, S - static, L1 - IS-IS level-1, L2 - IS-IS level-2,
IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2,
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
B 192.168.5.0/24 [20/0] via 172.30.30.1
Disabled the primary VPN tunnel, to force it down. After 60 seconds the route changed to:
BGP is learning the following route
vse-279442fe-571c-47c7-a74e-e003c86b1e1a-0> show ip route bgp
Codes: O - OSPF derived, i - IS-IS derived, B - BGP derived,
C - connected, S - static, L1 - IS-IS level-1, L2 - IS-IS level-2,
IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2,
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
B 192.168.5.0/24 [20/0] via 172.30.31.1
And the ping gave replies again.
Re-enabling the Primary tunnel, changed the route back to:
vse-279442fe-571c-47c7-a74e-e003c86b1e1a-0> show ip route bgp
Codes: O - OSPF derived, i - IS-IS derived, B - BGP derived,
C - connected, S - static, L1 - IS-IS level-1, L2 - IS-IS level-2,
IA - OSPF inter area, E1 - OSPF external type 1, E2 - OSPF external type 2,
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
B 192.168.5.0/24 [20/0] via 172.30.30.1
There where no pings lost
- VPN Configuration Primary :
Make sure to enter 0.0.0.0/0 as the Local and Remote subnet.
The tunnel traffic will be routed by BGP
Make sure to select Route Based and enter a tunnel interface ip and MTU size - VPN Configuration BACKUP
Make sure to enter 0.0.0.0/0 as the Local and Remote subnet.
The tunnel traffic will be routed by BGP
Make sure to select Route Based and enter a tunnel interface ip in a different subnet as the Primary on and MTU size - BGP Configuration PRIMARY:
Configure BGP, go to Routing => Routing Configuration
Select a Router ID - Goto Routing => BGP
Enable the following and choose a local AS - Click on Neigbors on the + to add
- Enter the tunnel ip of the remote site
Enter the Remote AS
Make sure the Weight is higher than the BACKUP BGP site, default is 60. - BGP Configuration BACKUP
- Configure BGP, go to Routing => Routing Configuration
Select a Router ID - Goto Routing => BGP
Enable the following and choose a local AS - Enter the tunnel ip of the remote site
Enter the Remote AS
Make sure the Weight is lower than the PRIMARY BGP site, default is 60. - Configure Route Redistribution for Primary VPN
Goto Routing => Route Redistribution
Enable BGP Status - Click on + under Route Prefix
- Enter a Name for the IP Prefix and enter the Primary vNet subnet
- Click on + under Route Redistribution Table
- Choose the Prefix from the previous step and choose
Learner Protocol BGP
Allow Learning from Connected
Action Permit