Sophos UTM and Azure Site-2-Site VPN (IPSec)

Here is a short guide on how to establish a Site-2-Site (S2S) VPN connection to Microsoft Azure with the Sophos UTM. Since the Azure portal has been significantly revised in the meantime and I have only found quite old HowTo's, I have summarized my configuration of the UTM and Azure here. If I find some time, I will also write an article on how to restrict access to the respective networks.

Introduction

I am using an "empty" Azure environment for this HowTo, so no resources have been created yet. However, if virtual networks have already been created, these instructions can usually be transferred or slightly modified if necessary.

Here is a brief overview of how the local and future Azure environment will be set up:

Drawing1

There are two local networks 192.168.100.0/24 and 172.16.14.0/24. Within Azure, the virtual network 10.10.0.0/16 is created, which in turn contains several subnets (10.10.1.0/24, 10.10.2.0/24, etc).

Configuration of Azure networks

The first step is to configure the virtual networks in Azure. To do this, a new virtual network is first created:

Azure Virtual Network

The new virtual network is given the address range 10.10.0.0/16 and the subnet 10.10.0.0/24 is created within this network. The first subnet (10.10.0.0/24) could, for example, contain services that are directly accessible from the Internet. However, it is up to the user to decide which function is assigned to the subnets:

Azure Virtual Network

As soon as the new virtual network with the first subnet has been created, the overview in Azure should look like this:

Azure Virtual Network

By clicking on the new virtual network, further subnets can now be created.

A gateway subnet is required so that an S2S VPN connection can be established later. I have set the gateway subnet to the last subnet in the 10.10.0.0/16 network (in this case 10.10.255.0/24):

Azure Gateway

Once the gateway subnet has been created, a "gateway for virtual networks" can now be created. In principle, this is a VPN-capable router in Azure. Under the menu item "Create resource", you can search for "Gateway for virtual networks" and create the corresponding resource:

Azure Gateway

The settings for the virtual gateway can now be defined. It is important to note that the Sophos UTM currently supports IKEv1, so the "VPN type" must be set to "Policy-based". The VPN type "Route-based" requires IKEv2, which is currently not supported by the UTM. The other settings should be self-explanatory:

Azure Gateway

If everything has worked up to this point, the new gateway can be created:

Azure Gateway

A new "Local network gateway" can now be created. The "Local network gateway" is basically the local Sophos UTM (in the UTM this configuration is called "Remote gateway"), here the settings for the S2S VPN tunnel are made:

Azure local network gateway

For the "Local network gateway", the settings for the data of the local Sophos UTM are entered, essentially the static IP WAN of the IP UTM and the local networks available in the tunnel:

Azure local network gateway

After the local network gateway has been created, the Azure overview page should now look like this:

Important: At this point, you must wait until the provision of resources has been completed (bell symbol)

Azure local network gateway

A new "Connection" must be added so that an S2S VPN connection can be established by the UTM. The S2S connection can be added to the previously created resource "Gateway for virtual networks", in this case "FrankysWeb-Test-VNet1-GW1":

Azure Site-2-Site connection

A PSK (Pre Shared Key) can now be entered within the connection; the PSK is required later for the configuration of the UTM:

Azure Site-2-Site connection

Once the settings have been saved, the overview of connections now looks like this:

Azure Site-2-Site connection

For the configuration of the Sophos UTM, the static IP of the Azure Gateway is now required in addition to the PSK. The IP can be displayed in the overview:

Azure Site-2-Site connection

The Azure configuration is now complete, we will continue with the local UTM.

Configuration of the Sophos UTM

Now that the Azure configuration is complete, you can start configuring the Sophos UTM. First, a new "IPsec policy" must be created:

Sophos UTM IPsec policy

The settings of the "IPsec policy" of the UTM are shown in the following screenshot:

Sophos UTM IPsec policy

A new "remote gateway" can now be created, i.e. the counterpart to the "local network gateway" in Azure. The IP address of the Azure gateway is used as the gateway:

UTM remote gateway

Distributed key" (PSK, Pre Shared Key) is used as the authentication method and the PSK previously defined in Azure is used. In addition, the Azure network is created as a "remote network", in this case the complete network 10.10.0.0/16:

UTM remote gateway

The overview of the UTM should now look as follows:

UTM remote gateway

Once the remote gateway has been created, a new IPsec connection can be created. The previously created remote gateway and the IPsec policy are selected here. The WAN interface of the UTM is entered as the local interface. The subnets/networks that were previously entered on the local network gateway in Azure must be entered as local networks. The settings of the local networks of the UTM must match the subnets of the local network gateway in Azure:

UTM IPsec connection

Once the connection has been established, the S2S tunnel can be activated:

UTM IPsec connection

The connection should work after a short time.

Status / Tests

To check the status of the S2S connection, the status can be displayed on the Site-2-Site VPN overview page of the UTM, if there is an SA for each configured local network, the connection should work:

UTM IPsec SAs

The status of the VPN connection is also displayed in the Azure Portal:

Azure Site-2-Site Overview

The status of the connection can now also be checked using ping:

Ping test

Tip: If new local subnets are added to the tunnel configuration, the configuration must be adjusted on both sides (Azure and UTM), then the tunnel must be rebuilt (disconnect and reconnect). If new Azure subnets are created, for example 10.10.3.0/24, the tunnel must be rebuilt once, the configuration does not need to be adjusted.

13 thoughts on “Sophos UTM und Azure Site-2-Site VPN (IPSec)”

  1. Hallo,
    bei mir hat der Tunnel mit Frankys Anleitung super geklappt, ich hab nur das Problem, dass der Tunnel zwar steht aber ich alle 10 Pings 2 aussetzer habe. Ich kann nicht herausfinden woher das kommt.
    Kann mir einer da weiterhelfen?

    Dankeschön

    Reply
  2. Franky, mal wieder vielen, vielen lieben Dank für diese tolle Anleitung. Dank dieser war es wirklich einfach und hat Anhieb geklappt!

    Reply
  3. Hallo, ich teste gerade bei einem Kunden die Verbindung. Der Kunde hat eine Sophos bei der der Tunnel immer nach ca. 1,06 Minuten den Durchsatz unterbricht. Der Tunnel bleibt jedoch bestehen.
    Den kuzen Key habe ich schon getestet, jedoch brachte das keine Änderung.

    Immer wenn ich den Tunnel auf der Azure Seite abbreche und wieder aufbaue, kann ich nach kurzer Zeit ca. die eine Minute wieder kommunizieren. Dann geht nichts mehr. Aber der Tunnel ist up.

    Kennt ihr das?

    Danke
    Wolfgang

    Reply
  4. Leider habe ich noch keine Lösung gefunden die Namensauflösung via DNS hinzubekommen. Ping funktioniert wie beschrieben in beide Richtungen. Glaube es liegt an der Sophos…

    Reply
  5. @Viktor
    Wir konnten gar keine Verbindung aufbauen. Leider haben wir ebenfalls Probleme mit der Stabilität des Tunnels, die sich genau wie von die beschrieben äußern. Wir werden die Sophos über kurz oder lang ersetzen. Wenn du eine Lösung gefunden hast, aber gerne hier kurz schreiben.

    Reply
    • Das komische ist, dass bei uns in der Firma eine VPN-Verbindung zu Azure besteht, ohne das wir gewisse Probleme ffeststellen konnten. Bei einem Kunden dagegen, die von mir beschriebenen Probleme.

      Die Einstellungen sind auf beiden FW identisch. Der einzige Unterschied ist, dass bei der Kommunikation mit Azure bei uns der Port 4500 und beim Kunden der Port 500 genutzt wird.

      Reply
      • Ich kann gerade nicht nachschauen welcher Port genutzt wird, aber wir haben das Problem von beginn an. Auch Firmware Updates haben bisher nicht geholfen. Der Azure Support ist auch nicht hilfreich, da die Firewall nicht zu den supported devices gehört.
        Bei einem Kunden hatten wir vor kurzem ein identisches Problem mit einer VPN (nicht Sophos) dort wurde uns empfohlen Azure als Initiator zu konfigurieren. Das habe ich bei der Sophos VPN noch nicht getestet.

        Zitat vom Support:
        An investigation from our end reveals that your on-premises device sent SA delete at that period and this delete the phase 2 part of the tunnel, this is why the connection was up and no traffic. The on-premises device sent SA delete packets intermittently and when the connection tried to come back up, SA deletes were sent again.

        Reply
        • Das Problem mit der „bestehenden Verbindung“ hatten wir in einer anderen Form bei einem Kunden. Hier sind die Einstellungen in der Policy der VPN-Verbindung entscheidend. Es kommt dort auf die z.B. IPsec-SA-Lebensdauer an, die überprüft ob die andere Seite noch da ist und dann die Trennung vollzieht.

          Die FW wenn Sie Antwortet muss wissen, nach welcher Zeit die Trennung zum anderen Netz abgebrochen werden soll, wenn keine Packete zurück kommen. Hier muss auch noch der Punkt Dead Peer Detection aktiviert sein.

  6. @ komplexen PSKs?

    Wie genau hat sich denn das Problem bei Euch dargestellt?
    Habt Ihr keine Verbindung hergestellt bekommen, oder bestand offensichtlich die VPN-Verbindung, die jedoch irgendwann doch Down war?

    Wir haben momentan das Phänomen, dass die VPN-Verbindung besteht, jedoch ein Ping nicht durchgeht, sowie keine RDP-Sessions aufgebaut werden können. Erst nachdem die VPN-Verbindung getrennt und wieder aufgebaut wird, funktioniert wieder alles.

    Reply
  7. Hallo,
    kurze Ergänzung:
    Die Sophos hat scheinbar Probleme mit komplexen PSKs.
    Falls es also Probleme gibt, einfach mal mit einem einfacheren Key testen.
    Bei mir war es da…hat mich einige graue Haare gekostet.

    Reply

Leave a Comment