Using PFSense as ipsec Endpoint of Azure

  • Hi, I am looking for some help. I want to try out an RDP-connection between my office and a Microsoft Server 2016 on Azure. To connect these two sites, I want to establish an IPsec connection between my Intra2net router at my office and the PFSense as a virtual machine on azure.

    What I did so far:
    Ip-address of vnet:
    On subnet1 I set up 1 NIC for PFSense
    NIC 1: Public-IP: private-ip:
    On subnet 2 I set up 1 NIC for PFSense and set up Windows Server
    NIC 2: private-ip:

    I already established an IPsec connection between my office and PFSense. I can ping the PFSense NIC2 from my office and can ping the different computers at my office from the PFSense. I also can ping my office from the windows server but I fail to ping or establish an rdp-connection from my office to windows server on azure.

    I have no idea how to get this done and hopefully someone can help me.

    Thank you very much



  • Netgate Administrator

    If you can ping an office machine from the server then you have some sort of route to reach it. However it may be an asymmetric route via the Azure gateway in which case ICMP might be allowed whilst TCP is blocked. Can you open any TCP connection from the server in Azure to any device on your office subnet?

    It might be the local Windows firewall on the server blocking requests from outside it's subnet unless you've disabled that.


  • @stephenw10

    I was wrong. I can ping the server and the office machines from pfsense, but i can't ping the office machines from the azure server or the server from the office machines. Probably I made some routing mistakes in azure but I have no idea how to solve this.

  • Netgate Administrator

    The simplest solution, for just one server, might be to just add a route to the office subnet via the pfSense internal IP ( on the server itself.
    If you only need to connect to the server you can also NAT the traffic leaving the interface in pfSense. That will allow the server to reply as all traffic will appear to be from it's own subnet. It's ugly though!


  • Thanks Steve. I try my best to set up the routes.

    This is how my configuration looks like:


    SPDs: -> // Tunnel endpoints: public-ip-office -> -> // Tunnel endpoints: -> public-ip-office

    PFSense NIC1(
    effective routes: -> virtual network /0 -> internet

    PFSense NIC2( + ip-forwarding-enabled:
    effective routes: -> virtual network -> virtual network /0 ->

    Server NIC( -> virtual network -> virtual network /0 ->

    It is still not working.^^

  • Netgate Administrator

    That /23 subnet seems suspect. That covers the subnets on both of the pfSense NICs. So how does pfSense know which NIC to use? You have the same route on two NICs there.

    However if you can ping the server from pfSense itself I expect it to work.

    You may have to run some packet captures to see where the pings are going once the come over the tunnel, or if they do come over the tunnel at all.


  • @stephenw10

    It was a wrong firewall setting. Now everything works fine. I just have to find out why the rdp ipsec connection is so slow.

    Thank you very much

    cheers nik

  • Netgate Administrator

    It's easy to get significant packet fragmentation over IPSec. Setting MSS clamping can improve things quite a bit if you tune it right with a packet capture.

    Also make sure you're using the fastest encryption you can. IKEv2 with AES-GCM using AES-NI is usually what you want.

    Enabling asynchronous-crypto in the IPSec advanced settings can dramatically improve speed on multicore CPUs but has been shown to cause issues in edge cases. Usually no traffic at all if you hit it.


Log in to reply