Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Pfsense in Azure - Cannot reach host on IPsec tunnel

    Scheduled Pinned Locked Moved General pfSense Questions
    35 Posts 3 Posters 4.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mbogoev
      last edited by

      I have the same problem. I NAT private ip inside phase 2 of the tunnel and the traffic goes to the other side and returns to pfsense, but VM that i initiate traffic from does not receive reply. like the traffic stops to pfsense and does not forward back to the vm. i have ip forwarding setted up a route table in Azure .

      1 Reply Last reply Reply Quote 0
      • B
        bhodges @stephenw10
        last edited by

        @stephenw10
        The tunnel is established but on the dashboard it says it's down but guessing that is a bug in pfsense?
        c5bf3563-ec29-4e80-92f1-f64dce6d7f17-image.png

        I can't ping or trace out from pfsense or VM, it doesn't receive any packets which makes me think it's not able to find a route there.

        here's my nat rules:
        2417b47b-6ec6-44f7-aeca-590dffe37909-image.png

        in case you need it:

        WAN rules:

        834e7385-b945-4e2a-8c43-2c071831e45e-image.png

        LAN rules:

        4651a045-8285-458e-aadc-1d96b837c045-image.png

        and IPsec rules:

        2383e25a-8f54-40e0-a1a5-6c0fee8a2ad7-image.png

        IPsec setup:

        P1:
        f4abd19e-978a-4cf4-8745-bd92f5ba4c42-image.png

        P2:

        1cbc2e4e-6c8b-435b-b6fa-2d645fffa9e6-image.png
        thanks
        Ben

        1 Reply Last reply Reply Quote 0
        • stephenw10S
          stephenw10 Netgate Administrator
          last edited by

          Is the remote network a public subnet there?

          You should not need to NAT anywhere. You definitely should not be NATing on all the interfaces like that. And you absolutely should never NAT on the IPSec interface like that. NAT in the P2 config if you need to NAT over IPSec.
          So I would disable or remove those rules there.

          Also if you are adding outbound NAT rules you should use some source other than 'any'. For instance with those rules you have it will be NATing it's own IPSec traffic outbound which can only break things.

          If the tunnel is up you should be able to ping to something on the remote side using the LAN IP as source. If you cannot either the tunnel is not up or it's blocked at the remote end.
          Show us the IPSec status page.

          Steve

          B 1 Reply Last reply Reply Quote 0
          • B
            bhodges @stephenw10
            last edited by

            @stephenw10

            The remote address space is private and at the moment only consists of one IP which i am performing tests on.

            Ok i have removed all NAT rules but it doesn't work still if i try to ping. According to documentation and some videos i've watched you need to have NAT which is why i set that up but you're saying i don't need to set this up under firewall>nat? It seems if i try to use NAT in P2 it removes it once i've saved?

            Here's the IPsec status page:
            2d300f13-0a4b-4a47-a242-11105e848d98-image.png

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              Ok, so that's not up at phase 2, the private subnets. So you probably have a config mismatch there.
              You will see the 'Show Child SAs' button there when that is established.

              Check the IPSec log for errors. Make sure both ends are configured the same.

              The only place you need NAT there is in the phase 1 tunnel as it looks like there is some NAT in the route. However you can see it gas detected that and connected in NAT-T mode.

              Steve

              B 1 Reply Last reply Reply Quote 0
              • B
                bhodges @stephenw10
                last edited by

                @stephenw10

                Oh i didn't know that box existed for show child sa's, yes it does appear that p1 is up and p2 is down.

                I've double checked the config and it all matches up.
                IPSec log does show information on child SA, i've pasted part of the log below:
                Dec 16 17:32:49 charon 09[IKE] <con1000|46> establishing CHILD_SA con1000{1773} reqid 38
                Dec 16 17:32:49 charon 09[ENC] <con1000|46> generating CREATE_CHILD_SA request 19 [ N(ESP_TFC_PAD_N) SA No KE TSi TSr ]
                Dec 16 17:32:49 charon 09[NET] <con1000|46> sending packet: from <local>[4500] to <remote>500] (348 bytes)
                Dec 16 17:32:49 charon 09[NET] <con1000|46> received packet: from <remote>[4500] to <local>[4500] (76 bytes)
                Dec 16 17:32:49 charon 09[ENC] <con1000|46> parsed CREATE_CHILD_SA response 19 [ N(NO_PROP) ]
                Dec 16 17:32:49 charon 09[IKE] <con1000|46> received NO_PROPOSAL_CHOSEN notify, no CHILD_SA built
                Dec 16 17:32:49 charon 09[CFG] <con1000|46> configured proposals: ESP:AES_CBC_256/HMAC_SHA2_256_128/MODP_1024/NO_EXT_SEQ
                Dec 16 17:32:49 charon 09[IKE] <con1000|46> failed to establish CHILD_SA, keeping IKE_SA
                Dec 16 17:32:49 charon 09[CHD] <con1000|46> CHILD_SA con1000{1773} state change: CREATED => DESTROYING
                Dec 16 17:32:49 charon 09[IKE] <con1000|46> activating new tasks
                Dec 16 17:32:49 charon 09[IKE] <con1000|46> nothing to initiate

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  @bhodges said in Pfsense in Azure - Cannot reach host on IPsec tunnel:

                  NO_PROPOSAL_CHOSEN

                  Yup so some mismatch with the other side, not the actual subnets:
                  https://docs.netgate.com/pfsense/en/latest/vpn/ipsec/ipsec-troubleshooting.html#phase-2-encryption-algorithm-mismatch

                  It's connected as AES-128/SHA1 at phase1. It's common to use the same at phase2 but not required. Do you know what the other side is set to?

                  Steve

                  B 1 Reply Last reply Reply Quote 0
                  • B
                    bhodges @stephenw10
                    last edited by

                    @stephenw10

                    For phase 2 it is set to AES-256 and SHA-256 which is what pfsense is set to so i'm not sure it is a mismatch?:

                    caabb19f-f1ce-4b86-bd09-bed3be9f1b40-image.png

                    1 Reply Last reply Reply Quote 0
                    • stephenw10S
                      stephenw10 Netgate Administrator
                      last edited by

                      Different PFS key set at the other side?

                      The other side is sending that response so logs from that would probably show exactly what's not matching.

                      Steve

                      1 Reply Last reply Reply Quote 0
                      • B
                        bhodges
                        last edited by

                        Hey Stephen,

                        Ok phase2 is up and the issue was with NAT. I added a NAT rule in phase2 for the whole network which pfsense sits on.

                        I can now ping from within pfsense to a server down the tunnel and vice versa.

                        My next issue is that i can't ping the server on the other side of the tunnel from another VM in the same network or another network.

                        I've setup ip forwarding on the pfsense interfaces in azure and created a route table to which has the address space on other side of tunnel to go through the pfsense LAN IP address.

                        This is the response i get if i tracert from the other VM:

                        Tracing route to <Server> [IP]
                        over a maximum of 30 hops:

                        1 1 ms <1 ms 1 ms <LANIP>
                        2 * * * Request timed out.
                        3 <LANIP> reports: Destination host unreachable.

                        it's being picked up on firewall logs and is being accepted:
                        eec17d44-5f15-449b-aebb-c0273afb3ee6-image.png

                        do i need to be setting up a NAT forward so it knows what to do with the packet when it receives one destined for a host down the tunnel?

                        thanks
                        Ben

                        1 Reply Last reply Reply Quote 0
                        • stephenw10S
                          stephenw10 Netgate Administrator
                          last edited by

                          If you can ping from pfSense to something across the VPN when selecting the appropriate source but not from another host in that subnet it sounds like a routing issue at the host.
                          You might have policy routing in place that re-routes traffic from the host but would not affect traffic from pfSense itself.

                          Steve

                          1 Reply Last reply Reply Quote 0
                          • B
                            bhodges
                            last edited by

                            it sounds as though i have the same issue as mbogoev explained above.

                            it seems as though the host where the traffic is originating from is routing traffic correctly to the pfsense LAN interface but it doesn't go beyond that.

                            in pfsense i have a static route for the network on the other side of the tunnel. If i disable this then tracert gets 'request timed out' errors for 30 hops. If i enable this then i get one 'request timed out' and then 'destination host unreachable' - the same error i sent in my previous message.

                            This is what i see in the packet capture:

                            12:18:51.842993 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 500, length 72
                            12:18:51.844700 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 501, length 72
                            12:18:51.846129 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 502, length 72
                            12:18:52.862071 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 503, length 72
                            12:18:52.862157 ARP, Request who-has 10.128.2.181 tell 10.239.3.5, length 28
                            12:18:56.853012 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 504, length 72
                            12:18:56.853074 ARP, Request who-has 10.128.2.181 tell 10.239.3.5, length 28
                            12:19:00.860894 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 505, length 72
                            12:19:00.860954 ARP, Request who-has 10.128.2.181 tell 10.239.3.5, length 28
                            12:19:04.864868 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 506, length 72
                            12:19:04.864932 ARP, Request who-has 10.128.2.181 tell 10.239.3.5, length 28
                            12:19:08.857729 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 507, length 72
                            12:19:08.857809 ARP, Request who-has 10.128.2.181 tell 10.239.3.5, length 28
                            12:19:12.861699 IP 10.233.2.4 > 10.128.2.181: ICMP echo request, id 1, seq 508, length 72
                            12:19:12.861766 ARP, Request who-has 10.128.2.181 tell 10.239.3.5, length 28

                            it doesn't appear to be responding to the ARP requests

                            1 Reply Last reply Reply Quote 0
                            • stephenw10S
                              stephenw10 Netgate Administrator
                              last edited by stephenw10

                              Where did you capture that? What hosts are those IPs shown there?

                              What exactly is the static route you have in place?

                              B 1 Reply Last reply Reply Quote 0
                              • B
                                bhodges @stephenw10
                                last edited by

                                @stephenw10

                                i clicked on packet capture from the diagnostics menu within pfsense.

                                10.233.2.4 is just a test vm in another network i've created
                                10.128.2.181 is IP on other end of IPsec tunnel
                                10.239.3.5 is the LAN IP of pfsense

                                1 Reply Last reply Reply Quote 0
                                • stephenw10S
                                  stephenw10 Netgate Administrator
                                  last edited by

                                  I assume you're capturing on the LAN interface?

                                  It looks like you have a subnet conflict though. pfSense is ARPing for 10.128.2.181 from 10.239.3.5 it will only do that if they are inside the same subnet. It would be a huge subnet configured there though.

                                  Steve

                                  B 1 Reply Last reply Reply Quote 0
                                  • B
                                    bhodges @stephenw10
                                    last edited by

                                    @stephenw10

                                    yes that's right, i am capturing on the LAN interface.

                                    It has to come from 10.239.3.5 though? the test vm has to have a route table telling it to go to the LAN address of pfsense so it can contact the 10.128.2.181 because 10.239.3.5 is the only interface which knows of this network. So i've created a route table telling the VM to send all traffic for 10.128.2.0/24 through 10.239.3.5 and this is picked up on tracert, firewall logs on pfsense and packet trace.

                                    How else could VM's use the IPsec tunnel?

                                    thanks
                                    Ben

                                    1 Reply Last reply Reply Quote 0
                                    • stephenw10S
                                      stephenw10 Netgate Administrator
                                      last edited by

                                      The static route is in Azure then? That's correct if so.

                                      Still left with pfSense trying to ARP for a device in a subnet on the other end of the VPN. That should never happen.

                                      It implies you have the LAN subnet configured as something huge that contains it like /9.

                                      Steve

                                      1 Reply Last reply Reply Quote 0
                                      • B
                                        bhodges
                                        last edited by

                                        Yes there is a static route in azure which is..

                                        24f4b9d7-cced-4194-8f2e-bf488253c90a-image.png

                                        then one in pfsense which is..
                                        ea7e97e3-1b24-48e2-9c15-0f473acc1802-image.png

                                        and then i've setup a firewall nat outbound rule:

                                        fceb7e2b-fd86-40b7-b215-92d6709ecfbd-image.png

                                        "It implies you have the LAN subnet configured as something huge that contains it like /9." the lan subnet is a /24, i have setup NAT on phase 2 of the whole network /16 and this is only setting which works.

                                        thanks
                                        Ben

                                        1 Reply Last reply Reply Quote 0
                                        • stephenw10S
                                          stephenw10 Netgate Administrator
                                          last edited by

                                          Ok you should not need that static route in pfSense unless you need to send traffic from the firewall itself in which case it can be applied as a workaround:
                                          https://docs.netgate.com/pfsense/en/latest/vpn/ipsec/accessing-firewall-services-over-ipsec-vpns.html

                                          You should never apply NAT using pf on the IPSec interface, that's what is breaking the traffic here. The IPSec interface does not have an address in tunnel mode.
                                          Any NAT you need across the IPSec tunnel must be configured in the P2 settings.

                                          Steve

                                          1 Reply Last reply Reply Quote 0
                                          • B
                                            bhodges
                                            last edited by

                                            Ok now that i have removed the NAT outbound rule and the gateway the test vm isn't routing to pfsense LAN at all and just gets timeouts. i've set everything back up again but still it isn't routing to the LAN. I have rebooted the box and things seem to be back to normal again.

                                            The link you have sent is what i have in place already. I have a lan gateway setup with a static route. Or are you saying i shouldn't have that in place for my scenario?

                                            I have disabled the NAT outbound rule but only put it there as things aren't routing and i'm assuming pfsense LAN doesn't know what to do with the packet when it receives it.

                                            I essentially just need pfsense to act like the role in windows server which handles routing so when a VM sends a packet for a VM it routes to pfsense who then forwards that packet onto the destination since it is the only one who knows where to send it. i've set the azure side up the same in this scenario but just don't know what i'm missing in pfsense?

                                            thanks
                                            Ben

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.