Prerequisites
Log in to the BMC portal (if you are a new user, set up your account). At least one Linux-based BMC server with public and private IP addresses (two BMC servers are required for a VPN between two locations). VPN software of your choice. A remote office firewall.
Note
This example uses the Phoenix and Ashburn BMC locations. However, you can set up a VPN connection between any of the phoenixNAP BMC locations.
You can interconnect two BMC locations over VPN. Such a connection is also known as Lan to Lan (L2L) or Site to Site (S2S).
Step 1: Set Up Phoenix Side
Set up the BMC side by implementing Step 1 and Step 5 from Setting Up Remote Access VPN to phoenixNAP BMC.
Step 2: Install Ansible
Establish a connection over SSH to the SoftEther edge in Ashburn, and install the ansible package:
- For Ubuntu:
sudo apt -y install ansibleCode language: Bash (bash)
- For CentOS:
sudo yum -y install ansibleCode language: Bash (bash)
Step 3: Install Ansible Role
Install softasap.sa-vpn-softether ansible role from Ansible Galaxy:
sudo ansible-galaxy install softasap.sa-vpn-softetherCode language: Bash (bash)
Take note of the adapter name and subnet for the backend private network using the command:
ip addressCode language: Bash (bash)
Step 4: Configure SoftEther Server
On the SoftEther server:
1. Create vpn.yml:
cat <<EOL > vpn.yml
---
- hosts: localhost
vars:
roles:
- {
role: "softasap.sa-vpn-softether",
softether_init_script: "{{ playbook_dir }}/create_hub"
}
EOFCode language: YAML (yaml)
2. Create create_hub:
cat <<EOL > create_hub
HubDelete DEFAULT
HubCreate vpn /PASSWORD:""
hub vpn
BridgeCreate vpn /DEVICE:bond0.1100 /TAP:False
SecureNatEnable
NatDisable
DhcpSet /START:10.1.0.200 /END:10.1.0.250 /MASK:255.255.255.0 /EXPIRE:7200 /GW:none /DNS:none /DNS2:none /DOMAIN:none /LOG:yes /PUSHROUTE:none
SecureNatHostSet /MAC:none /IP:10.1.0.253 /MASK:255.255.255.0
ServerCertRegenerate vpn.yourdomain.com
ServerCertGet ./generated/cert.cer
SstpEnable yes
OpenVpnEnable yes /PORTS:1194
OpenVpnMakeConfig ./generated/openvpn_config.zip
UserCreate rauser /GROUP:none /REALNAME:none /NOTE:none
UserPasswordSet rauser /PASSWORD:sadigGjyt387
ServerPasswordSet adskfnne44onkdasl
EOFCode language: Bash (bash)
If required, change:
- Dhcpset start and end range.
- SecureNatHostSet IP address parameters.
- ServerCertRegenerate domain.
3. After creating the vpn.yml and create_hub files, you can start ansible-playbook. Use the following command to install and configure the Ashburn SoftEther VPN server:
sudo ansible-playbook vpn.ymlCode language: Bash (bash)
At this point, you installed and configured the SoftEther servers in two locations (Phoenix and Ashburn).
Step 5: Connect Locations with S2S VPN Tunnel
1. Edit the create_hub init script on both servers and create a new virtual hub named s2s.
HubCreate s2s /PASSWORD:""
hub s2sCode language: plaintext (plaintext)
2. Create a password for s2s VPN authentication.
UserCreate s2s /GROUP:none /REALNAME:none /NOTE:none
UserPasswordSet s2s /PASSWORD:bjdbsi9273jygUYGf6Code language: plaintext (plaintext)
3. To initiate the site to site VPN connection, add the following lines to the primary location (in this example it is Phoenix).
CascadeCreate s2s /SERVER:131.153.155.210:443 /HUB:s2s /USERNAME:s2s
CascadePasswordSet s2s /PASSWORD: bjdbsi9273jygUYGf6 /TYPE:standard
CascadeOnline s2sCode language: plaintext (plaintext)
This points the cascade connection to the public IP and s2s hub of the SoftEther server in the Ashburn location.
Step 6: Allow Traffic Between vpn and s2s Hubs
Add a virtual router on both SoftEther servers.
Phoenix SoftEther server
1. Create a virtual router named s2s:
RouterAdd s2sCode language: plaintext (plaintext)
2. Add an interface for each hub:
RouterIfAdd s2s /HUB:vpn
/IP:10.0.0.254/255.255.255.0Code language: plaintext (plaintext)
And:
RouterIfAdd s2s /HUB:s2s
/IP:192.168.168.254/255.255.255.0Code language: plaintext (plaintext)
3. Add a static route for vpn hub on the Ashburn location:
RouterTableAdd s2s /NETWORK:10.1.0.0/255.255.255.0 /GATEWAY:192.168.168.253 /METRIC:1
RouterStart s2sCode language: plaintext (plaintext)
Ashburn SoftEther server
1. Create a virtual router named s2s:
RouterAdd s2sCode language: plaintext (plaintext)
2. Add an interface for each hub:
RouterIfAdd s2s /HUB:vpn
/IP:10.1.0.254/255.255.255.0Code language: plaintext (plaintext)
And:
RouterIfAdd s2s /HUB:s2s
/IP:192.168.168.253/255.255.255.0Code language: plaintext (plaintext)
3. Add a static route for vpn hub on Phoenix location:
RouterTableAdd s2s /NETWORK:10.0.0.0/255.255.255.0 /GATEWAY:192.168.168.254 /METRIC:1
RouterStart s2sCode language: plaintext (plaintext)
Step 7: Establish Connection between Servers
Allow users connected to Phoenix to connect to servers in Ashburn, and vice versa. To do so, add a static route to the VPN client:
Phoenix SoftEther server
DhcpSet /START:10.0.0.200 /END:10.0.0.250
/MASK:255.255.255.0 /EXPIRE:7200 /GW:none
/DNS:none /DNS2:none /DOMAIN:none /LOG:yes
/PUSHROUTE:none
DhcpSet /START:10.0.0.200 /END:10.0.0.250
/MASK:255.255.255.0 /EXPIRE:7200 /GW:none
/DNS:none /DNS2:none /DOMAIN:none /LOG:yes
/PUSHROUTE:10.1.0.0/255.255.255.0/10.0.0.254Code language: plaintext (plaintext)
The Phoenix SoftEther create_hub initial script should have the following content:
HubDelete DEFAULT
HubCreate vpn /PASSWORD:""
hub vpn
BridgeCreate vpn /DEVICE:bond0.1100 /TAP:False
SecureNatEnable
NatDisable
DhcpSet /START:10.1.0.200 /END:10.1.0.250 /MASK:255.255.255.0 /EXPIRE:7200 /GW:none /DNS:none /DNS2:none /DOMAIN:none /LOG:yes /PUSHROUTE: 10.0.0.0/255.255.255.0/10.1.0.254
SecureNatHostSet /MAC:none /IP:10.1.0.253 /MASK:255.255.255.0
ServerCertRegenerate vpn.yourdomain.com
ServerCertGet ./generated/cert.cer
SstpEnable yes
OpenVpnEnable yes /PORTS:1194
OpenVpnMakeConfig ./generated/openvpn_config.zip
UserCreate rauser /GROUP:none /REALNAME:none /NOTE:none
UserPasswordSet rauser /PASSWORD:sadigGjyt387
ServerPasswordSet adskfnne44onkdasl
HubCreate s2s /PASSWORD:""
hub s2s
UserCreate s2s /GROUP:none /REALNAME:none /NOTE:none
UserPasswordSet s2s /PASSWORD:bjdbsi9273jygUYGf6
RouterAdd s2s
RouterIfAdd s2s /HUB:vpn /IP:10.1.0.254/255.255.255.0
RouterIfAdd s2s /HUB:s2s /IP:192.168.168.253/255.255.255.0
RouterTableAdd s2s /NETWORK:10.0.0.0/255.255.255.0 /GATEWAY:192.168.168.254 /METRIC:1
RouterStart s2sCode language: plaintext (plaintext)
Ashburn SoftEther server
DhcpSet /START:10.1.0.200 /END:10.1.0.250
/MASK:255.255.255.0 /EXPIRE:7200 /GW:none
/DNS:none /DNS2:none /DOMAIN:none /LOG:yes
/PUSHROUTE:none
DhcpSet /START:10.0.0.200 /END:10.0.0.250
/MASK:255.255.255.0 /EXPIRE:7200 /GW:none
/DNS:none /DNS2:none /DOMAIN:none /LOG:yes
/PUSHROUTE:10.0.0.0/255.255.255.0/10.1.0.254Code language: plaintext (plaintext)
The Ashburn SoftEther create_hub initial script should look like this:
HubDelete DEFAULT
HubCreate vpn /PASSWORD:""
hub vpn
BridgeCreate vpn /DEVICE:bond0.1101 /TAP:False
SecureNatEnable
NatDisable
DhcpSet /START:10.0.0.200 /END:10.0.0.250 /MASK:255.255.255.0 /EXPIRE:7200 /GW:none /DNS:none /DNS2:none /DOMAIN:none /LOG:yes /PUSHROUTE:10.1.0.0/255.255.255.0/10.0.0.254
SecureNatHostSet /MAC:none /IP:10.0.0.253 /MASK:255.255.255.0
ServerCertRegenerate vpn.yourdomain.com
ServerCertGet ./generated/cert.cer
SstpEnable yes
OpenVpnEnable yes /PORTS:1194
OpenVpnMakeConfig ./generated/openvpn_config.zip
UserCreate rauser /GROUP:none /REALNAME:none /NOTE:none
UserPasswordSet rauser /PASSWORD:sadigGjyt387
ServerPasswordSet adskfnne44onkdasl
HubCreate s2s /PASSWORD:""
hub s2s
UserCreate s2s /GROUP:none /REALNAME:none /NOTE:none
UserPasswordSet s2s /PASSWORD:bjdbsi9273jygUYGf6
CascadeCreate s2s /SERVER:131.153.155.210:443 /HUB:s2s /USERNAME:s2s
CascadePasswordSet s2s /PASSWORD:bjdbsi9273jygUYGf6 /TYPE:standard
CascadeOnline s2s
RouterAdd s2s
RouterIfAdd s2s /HUB:vpn /IP:10.0.0.254/255.255.255.0
RouterIfAdd s2s /HUB:s2s /IP:192.168.168.254/255.255.255.0
RouterTableAdd s2s /NETWORK:10.1.0.0/255.255.255.0 /GATEWAY:192.168.168.253 /METRIC:1
RouterStart s2sCode language: plaintext (plaintext)
Step 8: Reconfigure SoftEther VPN Servers
/opt/vpnserver/vpncmd localhost /SERVER /IN:create_hubCode language: plaintext (plaintext)
Step 9: Add Static Routes
Add the static routes to servers using the VPN server private address to achieve connectivity between locations.
CentOS-Specific Settings
If you are running CentOS servers, follow the steps outlined for each server location.
Phoenix side BMC servers
Add a static route on the server by running:
sudo ip route add 10.1.0.0/24 via 10.0.0.254 dev bond0.1101Code language: Bash (bash)
To make the routes persistent, edit the network configuration file /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg.
Add the routes information to the file:
type: vlan
mtu: 9000
name: bond0.1101
vlan_id: 1101
vlan_link: bond0
subnets:
- address: 10.0.0.12/24
type: static
routes:
- gateway: 10.0.0.254
network: 10.1.0.0/24Code language: YAML (yaml)
Ashburn side BMC servers
Add a static route on the server by running:
sudo ip route add 10.0.0.0/24 via 10.1.0.254 dev bond0.1100Code language: Bash (bash)
Make the routes persistent by editing /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg.
Add a routes section to the file:
- type: vlan
mtu: 9000
name: bond0.1100
vlan_id: 1100
vlan_link: bond0
subnets:
- address: 10.1.0.12/24
type: static
routes:
- gateway: 10.1.0.254
network: 10.0.0.0/24Code language: YAML (yaml)
Ubuntu-Specific Settings
If you are running Ubuntu servers, follow the steps outlined for each location.
Phoenix side BMC servers
Add a static route on the server by running:
sudo ip route add 10.1.0.0/24 via 10.0.0.254 dev bond0.1101Code language: Bash (bash)
To make the routes persistent, edit /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg.
Add the following information to the file:
bond0.1101:
addresses:
- 10.0.0.12/24
id: 1101
link: bond0
mtu: 9000
routes:
- to: 10.1.0.0/24
via: 10.0.0.254Code language: YAML (yaml)
Ashburn side BMC servers
Add a static route on the server by running:
sudo ip route add 10.0.0.0/24 via 10.1.0.254 dev bond0.1100Code language: Bash (bash)
Make the routes persistent by editing /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg.
Add a routes section to the file:
bond0.1100:
addresses:
- 10.1.0.12/24
id: 1100
link: bond0
mtu: 9000
routes:
- to: 10.0.0.0/24
via: 10.1.0.254Code language: YAML (yaml)