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

    Force using IP of interface

    Scheduled Pinned Locked Moved OpenVPN
    9 Posts 3 Posters 1.9k 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
      mimu
      last edited by

      Hello.
      The hosts in my network use another gateway than pfSense. For openVPN i use pfSense. The connection works, but I have this problem:

      • If interface 2 obtains his ip address over dhcp (10.0.0.7), I can ping the hosts on interface 2, because the source ip of the packets is replaced with 10.0.0.7 (address of the interface).
      • If I configure a static ip on the interface (again 10.0.0.7), the packets arriving over openvpn keep the source ip of the tunnel. The ping request reaches the correct host, but this host sends the reply to it's default-gateway (which is not pfSense), because the tunnel ip is not in the range 10.0.0.0.

      How can I force pfSense to replace the tunnel ip with the static ip of the interface?

      Thanks

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

        So can you draw this up so everyone is clear to what your doing.  Your wanting road warriors to come into pfsense openvpn server, but your clients behind pfsense dont use pfsense as their gateway.

        You would have to create a route on the hosts that when talking to the IPs your road warrior clients would get to talk to pfsense.

        Or are you talking about routing traffic from your machines behind pfsense to use a vpn going to some specific IPs?  For like a vpn for your p2p traffic?

        the easy solution here is to make pfsense your default gateway your clients and have pfsense have your internet connection(s) and your vpn connections, etc.

        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 24.11 | Lab VMs 2.8, 24.11

        1 Reply Last reply Reply Quote 0
        • M
          mimu
          last edited by

          Hello. Here is a picture of the situation.
          The remote location connects to pfSense and wants to communicate with the LAN.
          With dhcp on the "problem interface" everything works fine, pfSense replaces the source ip 10.10.10.10 with 10.0.0.7, the host sends the response back to 10.0.0.7 and pfSense to 10.10.10.10. Everything fine.

          On a static ip, pfSense keeps the source ip 10.10.10.10. The request reaches the host correctly, the host sends the response to 10.10.10.10, but this packet obviously is sent to the default gateway, which is not pfSense.

          The default gateway and the internet connection on pfSense are from two different providers. The LAN should generally use provider 2, provider 1 is only for vpn and a few special hosts inside the LAN, where the default gateway is set manually to 10.0.0.7 (pfSense).

          lan.jpg
          lan.jpg_thumb

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

            just put both providers on pfsense, then pfsense is gateway and your good to go.

            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 24.11 | Lab VMs 2.8, 24.11

            1 Reply Last reply Reply Quote 0
            • M
              mimu
              last edited by

              The third port on pfSense is occupied with another LAN…

              1 Reply Last reply Reply Quote 0
              • M
                mimu
                last edited by

                The interesting thing is that it works with DHCP. But then pfSense doesn't forward traffic coming on that interface to the provider router…
                With static ip i have the openvpn problem and pfSense forwards the traffic.
                Therefore i would force the ip-replacement of the openvpn packets.

                1 Reply Last reply Reply Quote 0
                • M
                  mimu
                  last edited by

                  I have solved the problem:

                  • DHCP client on the LAN interface (=>openVPN works)
                  • Set Firewall-NAT-Outbound to hybrid and add two mappings for the 10.0.0.0 LAN (interfaces LAN and WAN) (=>gateway for LAN works)
                  1 Reply Last reply Reply Quote 0
                  • johnpozJ
                    johnpoz LAYER 8 Global Moderator
                    last edited by

                    What?

                    So you set pfsense lan interface to be dhcp?

                    Dude get another nic for your pfsense box..  Another nic is lot cheaper then running another router..

                    So your clients are talking to your gateway that then sends it to pfsense lan.. And if you set dhcp on lan interface and it gets a gateway its now a wan interface..  Sounds like you have a MESS

                    You can hairpin it with putting a route on your 2nd router to the 10.10.10 network your remote vpn clients get to go to the 10.0.0.7 IP of pfsense.  or you could create host routes on your lan clients that say hey 10.10.10 talk to pfsense at 10.0.0.7 not your default gateway.

                    Best solution is to just use pfsense as your gateway to either the internet or your vpn clients.

                    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 24.11 | Lab VMs 2.8, 24.11

                    1 Reply Last reply Reply Quote 0
                    • V
                      viragomann
                      last edited by

                      You just need to create an outbound NAT rule which translates source IP of packets leaving pfSense on your "problem interface" to the interface address. This solution works, no matter if DHCP is on or not.

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