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

openvpn packets getting returned over WAN gateway and not VPN gateway

Scheduled Pinned Locked Moved OpenVPN
17 Posts 4 Posters 1.4k 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.
  • S
    sesipod
    last edited by Oct 27, 2018, 2:32 AM

    I would like to forward the following ports ( 80,443,32400 )over a VPN tunnel to my VPS. I can't open ports on my WAN as my ISP is a 4G provider. I currently have a similar solution setup using an Ubuntu server with openvpn it workes but requires the client on each PC :/ .

    Here is my setup:

    Server
    VPS with pfsense 2.4.4 installed (OpenVPN server)
    VPS IP : 321.321.321.321

    Home
    pfsense 2.4.4 installed (OpenVPN client)
    Home IP: 123.123.123.123


    Step #1: I have OpenVPN setup and connected to my home pfsense 2.4.4 I can ping to my home pfsense LAN network just fine form the pfsense server installed on the VPS.

    Step #2: Added vpn as an Interface and enabled then saved.

    Step #3: Went to System/Routing/Gateways and added a monitor IP to VPN_VPNV4

    Step #4: Went to Firewall/NAT/Outbound set it to hybrid NAT
    Created a new mapping for 192.168.1.0/24 to the VPN Interface that I created in (Step 2).

    Step #5: Created a rule under LAN interface

    Action: Pass
    Interface: LAN
    Protocol: Any
    Source: 192.168.1.165
    Destination: any
    -Advanced Options-
    Gateway: VPN_VPNV4
    

    Step #6: Check that the 192.168.1.165 client was getting the VPS pfsense External IP - It is getting IP 321.321.321.321 from a google search.

    Step #7: Logged into the VPS pfsese box and created a NAT rule for port 32400 to IP 192.168.1.165.

    Step #8: canyouseeme.0rg test for port 32400 on Ip 321.321.321.321 and the test fails.

    Step #9: Packet capture on Home pfsense box under WAN.... Below I can see that the packets are being returned over my WAN home ISP and not the VPN gateway.

    08:47:26.323119 IP 192.168.1.165.32400 > 104.238.162.245.44938: tcp 0
    08:47:29.327666 IP 192.168.1.165.32400 > 104.238.162.245.44938: tcp 0
    
    

    Step #10: Smash head on desk. Make a thread post.

    Images

    Step #2 0_1540130248025_12345.JPG

    Step #3 0_1540130303090_123123.JPG

    Step #4 0_1540130155387_123.JPG

    Step #5 0_1540130199141_1234.JPG

    1 Reply Last reply Reply Quote 0
    • S
      scottlindner
      last edited by Oct 30, 2018, 1:23 PM

      Did you figure this out? I suspect I am struggling with the same issue.

      1 Reply Last reply Reply Quote 0
      • S
        sesipod
        last edited by Oct 30, 2018, 1:47 PM

        I did actually just yesterday I will be making a guide shortly.

        1 Reply Last reply Reply Quote 0
        • J
          jimp Rebel Alliance Developer Netgate
          last edited by Oct 30, 2018, 1:49 PM

          You need to make sure the firewall rules to match incoming OpenVPN traffic only exist on the assigned OpenVPN interface tab and that traffic is not matched by any rules on the OpenVPN tab.

          Then reply-to will handle sending the return traffic back the correct path.

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • S
            sesipod
            last edited by sesipod Oct 30, 2018, 2:05 PM Oct 30, 2018, 2:02 PM

            This might help you out..

            LAN
            0_1540908022807_LAN.png
            OpenVPN
            0_1540908061800_OpenVPN.png
            OPT3 (aka assigned vpn interface)
            0_1540908114010_OPT3.png
            Outbound NAT
            0_1540908275068_Screen Shot 2018-10-30 at 9.03.54 AM.png
            Gateways
            0_1540908334380_98.png

            1 Reply Last reply Reply Quote 0
            • S
              scottlindner
              last edited by Nov 1, 2018, 11:38 AM

              I'll be honest. I don't understand those screenshots due to the stuff you're doing that is unique to your needs rather than what is purely necessary for setting up an OpenVPN Client to route all traffic through. Thanks for sharing the screenshots though!

              S 1 Reply Last reply Nov 1, 2018, 12:12 PM Reply Quote 0
              • S
                sesipod @scottlindner
                last edited by Nov 1, 2018, 12:12 PM

                @scottlindner

                Do you want all of your (lan) traffic over the VPN?

                1 Reply Last reply Reply Quote 0
                • S
                  scottlindner
                  last edited by Nov 1, 2018, 12:16 PM

                  If it were simple, I would want that for only one VLAN (and only one remote domain even) but I'm finding routing in pfSense to be so scattered across things that I want to keep it stupid simple until I get my head around all of the pieces and parts.

                  Ultimately, I'm only doing this so I can watch blackout NHL.TV on my Rokus. But for now, the true idiot's guide is what I'm after.

                  S 1 Reply Last reply Nov 1, 2018, 12:18 PM Reply Quote 0
                  • S
                    sesipod @scottlindner
                    last edited by Nov 1, 2018, 12:18 PM

                    @scottlindner

                    Okay so you want to pick and choose what devices go over vpn on a certain subnet ?

                    1 Reply Last reply Reply Quote 0
                    • S
                      scottlindner
                      last edited by Nov 1, 2018, 12:23 PM

                      That would be truly ideal, but if it isn't simple I might shy away from it.

                      S 1 Reply Last reply Nov 1, 2018, 12:25 PM Reply Quote 0
                      • S
                        sesipod @scottlindner
                        last edited by Nov 1, 2018, 12:25 PM

                        @scottlindner
                        It's simple so basically the screenshots I provide is what you want. Just ignore the ports that I open.

                        Tell me what network and ips on that network you want to go over vpn. I'll cook up a screenshot or 2 for you based off what you want to happen .

                        1 Reply Last reply Reply Quote 0
                        • S
                          scottlindner
                          last edited by Nov 1, 2018, 12:29 PM

                          Here are the internal LAN IPs I want routed over the OpenVPN Client: 192.168.13.67, 192.168.13.76, 192.168.13.78

                          I really appreciate this!

                          S 1 Reply Last reply Nov 1, 2018, 1:10 PM Reply Quote 0
                          • S
                            sesipod @scottlindner
                            last edited by Nov 1, 2018, 1:10 PM

                            @scottlindner
                            Do you have another network other than the 192.168.13.x/24?
                            If you do have a second network does that network need to go over the WAN or VPN?

                            S 1 Reply Last reply Nov 1, 2018, 1:24 PM Reply Quote 0
                            • S
                              scottlindner @sesipod
                              last edited by scottlindner Nov 1, 2018, 1:28 PM Nov 1, 2018, 1:24 PM

                              @sesipod yes. I have the untagged LAN carrying tagged traffic (trunk) and four tagged VLANs all going out over the gateway group which includes my WAN interface and a broadband interface as failover.

                              S 1 Reply Last reply Nov 1, 2018, 1:52 PM Reply Quote 0
                              • S
                                sesipod @scottlindner
                                last edited by sesipod Nov 1, 2018, 1:53 PM Nov 1, 2018, 1:52 PM

                                @scottlindner
                                oh geez ...
                                Well you can basically follow the screen caps above but ignore the Rules I have for OPT3 network. I am at work right now so I do not have my pfsense page up. Try the below and let me know ( if ) it works out for you. I basically made everything on the 13.x stay on the WAN unless you made a rule for the individual IP on that network.

                                • OpenVpn RULES tab

                                You should have noting in there.

                                • Interfaces

                                You should have the vpn interface assigned mine is called OPT3 above. You just add it and then press save making sure that it's enabled.

                                ** I do not think that you have to set the vpn interface as the default gateway. However in my screen shots above I did and everything is working. You might want to test this. I do know if you do that you will have to update your rules for each network that is intended for WAN to have the advanced option gateway set as WAN

                                • outbound nat page

                                Switch to (hybrid) or (manual)

                                For the 192.168.13.x/24 network copy the existing WAN interface mapping. In the new mapping setup change the Interface to your VPN Gateway interface. Put the new mapping above the WAN mapping for this .13.x network.

                                • Rules Tab

                                13.x network Tab:

                                Starting out we will setup the 3 ips that you want over the VPN these rules should be placed above all others. ( rules 1-3 ) the last rule ( rule 4 ) is stating anything else will take WAN gateway.

                                Rule #1
                                Protocol: IPV4 ALL
                                Source: 192.168.13.67
                                Port: ANY
                                Destination ANY
                                PORT: ANY
                                (advanced) - Gateway - VPN Gateway

                                Rule #2
                                Protocol: IPV4 ALL
                                Source: 192.168.13.76
                                Port: ANY
                                Destination ANY
                                PORT: ANY
                                (advanced) - Gateway - VPN Gateway

                                Rule #3
                                Protocol: IPV4 ALL
                                Source: 192.168.13.78
                                Port: ANY
                                Destination ANY
                                PORT: ANY
                                (advanced) - Gateway - VPN Gateway

                                Rule #4
                                Protocol: IPV4 ALL
                                Source: (networkname) net
                                Port: ANY
                                Destination ANY
                                PORT: ANY
                                (advanced) - Gateway - WAN Gateway.

                                1 Reply Last reply Reply Quote 0
                                • S
                                  scottlindner
                                  last edited by Nov 12, 2018, 6:37 PM

                                  I swear I'm doing everything you have specified here but the moment I switch on the OpenVPN Client all WAN access dies for the LAN and all VLANs.

                                  1 Reply Last reply Reply Quote 0
                                  • DerelictD
                                    Derelict LAYER 8 Netgate
                                    last edited by Nov 12, 2018, 6:50 PM

                                    Check Don't Pull Routes in the VPN client.

                                    Chattanooga, Tennessee, USA
                                    A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                                    DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                                    Do Not Chat For Help! NO_WAN_EGRESS(TM)

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                                      This community forum collects and processes your personal information.
                                      consent.not_received