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

    VMs traffic doesn't go through the right gateway

    Scheduled Pinned Locked Moved Firewalling
    11 Posts 2 Posters 1.1k Views 2 Watching
    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 Offline
      sasansgh
      last edited by

      Hi all,

      I have set up my pfSense on Esxi as a VM, it also has freenas and ubuntu set up as VMs.
      I have OpenVPN (PIA) setup on pfsense which works fine. I have 2 physical ports on my machine setup as:

      WAN > physical LAN port 1> vSwitch0 > port group WAN connected to pfSenese only as WAN

      LAN devices through an ethernet switch > physical LAN port 2> vSwitch1 > port group LAN connected to pfSenese as LAN + other VMs

      Now, I am having a really interesting issue. I decided to exempt some devices' traffic from going through the VPN.
      So I created a rule on LAN interface that has a source as the devices I want to exempt and set the gateway to the WAN-DHCP.

      The funny thing is the rule works for physical (real) devices such as phones and tablets. but the VMs traffics (ubuntu and freenas) still goes through the VPN!
      I have logged the traffic and I can see that pfsense does pick up the traffic from this devices by the exemption rule but somehow the gateway still is the openVPN.
      so it perfectly works for real devices but VMs traffic still goes through the vpn even though it has been associated to the rule!

      I have no idea what is going on here!?

      I would appreciate any help on this as it is bugging me so much since I cant figure it out!

      Thanks

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sasansgh @sasansgh
        last edited by

        Just something I forgot to mention if I set the action for the rule to block or reject it does block and reject the traffic from the VMs! but if set it to pass doesn't apply the gateway correctly for VMs! so weird!

        1 Reply Last reply Reply Quote 0
        • johnpozJ Offline
          johnpoz LAYER 8 Global Moderator
          last edited by

          When you change rules you have to make sure you clear any states that might exist for the previous rules.. This is any firewall, an existing state would supersede any rules.

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 25.07.1 | Lab VMs 2.8, 25.07.1

          1 Reply Last reply Reply Quote 0
          • S Offline
            sasansgh
            last edited by

            If you mean resetting states, I have tried that, it doesn't work.

            1 Reply Last reply Reply Quote 0
            • johnpozJ Offline
              johnpoz LAYER 8 Global Moderator
              last edited by

              Well your going to have to post your rules so we can see what else might be wrong. I have run pfsense for years and years on esxi.. Never any sort of issues.

              An intelligent man is sometimes forced to be drunk to spend time with his fools
              If you get confused: Listen to the Music Play
              Please don't Chat/PM me for help, unless mod related
              SG-4860 25.07.1 | Lab VMs 2.8, 25.07.1

              1 Reply Last reply Reply Quote 0
              • S Offline
                sasansgh
                last edited by sasansgh

                So these are pictures of my LAN, WAN and the Alias I set up. There is nothing in floating and openvpn.
                currently, the alias only has plex in it.

                https://ibb.co/mVbaFJ
                https://ibb.co/f319aJ
                https://ibb.co/bTWmNy

                Edit:
                This is system log for firewall. You see the rule is applied to the traffic but somehow plex still connected through VPN!
                https://ibb.co/kPbvhy

                1 Reply Last reply Reply Quote 0
                • johnpozJ Offline
                  johnpoz LAYER 8 Global Moderator
                  last edited by

                  That is NOT the way I would do it.

                  When you setup your vpn client on pfsense, do not grab routes.. Block it from adding routes and then just use policy routing to send traffic where you want.

                  How are you thinking your plex is using your vpn?

                  An intelligent man is sometimes forced to be drunk to spend time with his fools
                  If you get confused: Listen to the Music Play
                  Please don't Chat/PM me for help, unless mod related
                  SG-4860 25.07.1 | Lab VMs 2.8, 25.07.1

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    sasansgh
                    last edited by

                    I used the instructions from the PIA website, sorry im new to all of this. I will try to google what you said to see if I can figure setting up that way.

                    I know plex still using VPN because it says in plex client and also when check my public IP through SSH in freenas ( second pic)
                    https://ibb.co/iqcXvJ
                    https://ibb.co/mczCvJ

                    But it is not just plex, Freenas itself also shows the same behaviour and also another ubuntu VM on esxi

                    Thanks for your help so far!

                    1 Reply Last reply Reply Quote 0
                    • johnpozJ Offline
                      johnpoz LAYER 8 Global Moderator
                      last edited by

                      yeah pia instructions are for EVERYTHING to use them.. Don't grab default route, and just policy route what you want to go through vpn and what you want to not use vpn.

                      Not sure where you get that idea that plex is going your vpn... Thats your browser getting that IP.. So whatever machine your running your web interface to plex is where that public IP is coming from.

                      Your running that web browser on your plex box? hitting the local.

                      An intelligent man is sometimes forced to be drunk to spend time with his fools
                      If you get confused: Listen to the Music Play
                      Please don't Chat/PM me for help, unless mod related
                      SG-4860 25.07.1 | Lab VMs 2.8, 25.07.1

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        sasansgh
                        last edited by sasansgh

                        That web browser is not on the plex box. but the IP is the public IP address of the plex box as it can also be seen from the SSH image. So even though I set the gateway to my actual public IP through the rule but whatsmyip.com still sees plex's IP as my VPN IP.

                        The weird thing is the fact that real devices like my phone and tablet are absolutely fine so if I add them to the noVPN alias when I check my IP it is actually my ISP IP. but the VMs behave differently this is soo odd!

                        1 Reply Last reply Reply Quote 0
                        • johnpozJ Offline
                          johnpoz LAYER 8 Global Moderator
                          last edited by

                          So from a cmd line of your plex VM... Lets see it traceroute to some public IP..

                          An intelligent man is sometimes forced to be drunk to spend time with his fools
                          If you get confused: Listen to the Music Play
                          Please don't Chat/PM me for help, unless mod related
                          SG-4860 25.07.1 | Lab VMs 2.8, 25.07.1

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