This assumes you have some technical knowledge and are a Sophos UTM user looking for a way to connect multiple locations to your Azure environment.
These instructions start with an Azure environment already configured with a dynamic routing gateway and existing installations of Sophos UTM 9.312-8 and Ubuntu Server 14.04.2 LTS. For testing purposes, the Sophos UTM and
Ubuntu Server installations were clean. The Ubuntu Server should have one network connection and internet access. In this case, the DHCP server on the UTM originally provided the Ubuntu Server with an IP address and the UTM
is the gateway and DNS server.
The latest .ISO files can be found on the Sophos web site and Ubuntu web site (links are available in frequently asked questions on this site under Security / Sophos UTM and Drivers and Software / Operating Systems).
The IP addresses and networks shown in these instructions were used for testing purposes and are no longer valid. They include 10.1.10.163 as the external IP address (provided by your internet service provider), 192.168.163.1
and 192.168.163.0/24 as the IP address and subnet used by the UTM for the internal network, 192.168.163.91 as the IP address of the Ubuntu Server, 192.168.168.0/27 as the subnet on the virtual network in the Azure environment,
and 220.127.116.11 as the gateway IP address provided by Azure after creating the dynamic routing gateway. Use the addresses and subnets from your network and Azure environment for everything to work properly for you.
After logging in, depending on the version of Ubuntu Server, you may see some useful information, including the IP address. Make note of the address. If it's not displayed, you can use the ifconfig command to look it up.
Use the apt-get update command to download the latest package lists from the repositories. Almost all of the commands in these instructions will require sudo to elevate your privileges. On the Ubuntu Server, the first
time you use sudo after logging in or after a period of idle time, you'll be asked for your password again.
If you would like to use ssh to connect to your Ubuntu Server, install OpenSSH server using the apt-get install openssh-server command.
In WebAdmin on your UTM, find the IP address assigned to the Ubuntu Server and add a static mapping to give it an IP address that won't change. Then, restart your Ubuntu Server to get the new IP address.
Use nano (sudo nano /etc/network/interfaces) or your favorite text editor to add the following line to the file /etc/network/interfaces after the settings for the primary network interface:
The file referred to by this line will be created later.
Uncomment the line net.ipv4.ip_forward=1 in the file /etc/sysctl.conf. (Remove the # from the beginning of the line.)
Change the 0 to a 1 in the file /proc/sys/net/ipv4/ip_forward.
Create the file /etc/iptables.rules and add the following lines:
Remember to replace the subnet shown, 192.168.168.0/27, with the subnet you want to connect to in your Azure environment.
These rules assume the Ubuntu Server is on a safe network. If you need to protect your Ubuntu Server from possible threats on your local area network or if the Ubuntu Server is not protected by the UTM, you should change
them to block unwanted traffic.
Install strongSwan using the apt-get install strongswan command.
Add your external IP address and the gateway IP address and preshared key provided by Azure to the file /etc/ipsec.secrets.
Add the following lines to the end of the file /etc/ipsec.conf:
Leftid is your external IP address and needs to match the external IP address in the file /etc/ipsec.secrets while left is the Ubuntu Server's IP address on your internal network. Rightid and right are both the gateway IP
address provided by Azure and rightsubnet is the subnet used by your servers in the Azure environment. These addresses and subnets need to be the correct addresses and subnets from your network and Azure environment for
authentication to be successful.
In WebAdmin, add a static route (Interfaces & Routing, Static Routing, Standard Static Routes tab) to forward traffic to and from servers in your Azure environment through the VPN on the Ubuntu Server. While adding the static
route, you'll need to add a network definition for the subnet used by the servers in your Azure environment. If you used the DHCP server on the UTM to add a static mapping for the Ubuntu Server, its definition already
Add a NAT rule (Network Protection, NAT, NAT tab) to forward traffic from Azure's gateway IP address, changing its destination from your public IP address to your Ubuntu Server's IP address. Make sure you turn on an automatic
firewall rule or manually create a firewall rule (Network Protection, Firewall, Rules tab). Also, make sure your firewall allows VPN-related traffic from your Ubuntu Server to Azure's gateway IP address if it doesn't already.
While adding the NAT rule, you'll need to add a network definition for the gateway IP address provided by Azure.
Use the ipsec secrets command to reload the information from the file /etc/ipsec.secrets. Then, use the ipsec restart command to stop the IKE daemon charon, parse the file /etc/ipsec.conf, and start charon again. The ipsec
statusall command will show the status of the VPN.
If you want to get the status of multiple VPNs from Azure, use the Get-AzureVnetConnection command in the Azure PowerShell. (The VNetName would be the name of your virtual network in Azure.)
To test your connection to your Azure environment, ping a linux server in the environment from a computer on your internal network (Windows Server may not respond to ping) or try to Remote Desktop to a Windows Server.