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

    NAT rule not working between LAN and LAN

    Scheduled Pinned Locked Moved NAT
    6 Posts 3 Posters 781 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.
    • J
      jkraj
      last edited by

      My LAN Network is 192.168.1.0/24 and I have couple of VMs in it 192.168.1.100 (A) & 192.168.1.101 (B). I have a application running in (A) at 6443 port that should be reached by this address 10.96.0.1:443 from B.

      I want to do a curl from B like [ curl -x https://10.96.0.1/api ]. When I did tcpdump packet is reaching pfsense node but pfsense is dropping it looks like.

      What kind of NAT rule I should add?  I have one NAT rule which is not working I have attached that rule and firewall rule.

      Note: 10.96.0.0 network is not assigned to any interfaces of my VMs as well as pfsense here that is what I need.

      Some pointer would be helpful.

      natrule.png
      natrule.png_thumb
      firewall.png
      firewall.png_thumb

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

        Why want you do that? Why don't you use its interface address?

        The application will never get the requests if that IP isn't assigned to the machines interface in the operating system.

        Beyond, natting that won't work if both, client and server, are connected to the same interface. Therefore you will need a proxy.

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

          Confused about this 10.96.0.1 address?  So your running multiple layer 3 on the same layer 2 network.. Ie your 192.168.0/24- where is this 10.96 coming from??  Is that a VM behind a VM software nat on the host?

          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
          • J
            jkraj
            last edited by

            I am deploying kubernetes cluster using those VMs and specifically testing macvlan driver. so containers starting in that VM also get ip from 192.168.0.# ip address and host iptables will not be applied to those packets. I have to rely on router for routing

            But I am able to reach 10.96.0.1 from my VM which have 192.168.0.# ipaddress Below two ip tables rules in the VM helps

            -A KUBE-SERVICES -d 10.96.0.1/32 -p tcp -m comment --comment "default/kubernetes:https cluster IP" -m tcp --dport 443 -j KUBE-SEP-TNJASDWJMM375A6
            -A KUBE-SEP-TNJASDWJMM375A64 -p tcp -m comment --comment "default/kubernetes:https" -m recent --set --name KUBE-SEP-TNJASDWJMM375A64 --mask 255.255.255.255 --rsource -m tcp -j DNAT --to-destination 192.168.1.100:6443
            

            How to create similar rule in pfsense?

            1 Reply Last reply Reply Quote 0
            • J
              jkraj
              last edited by

              @viragomann:

              Beyond, natting that won't work if both, client and server, are connected to the same interface.

              In that case I tried curl -k https://10.96.0.1/api from inside pfsense VM that also not working. what could be the reason?. One thing I noticed because default route is WAN, I see the packet trying to leave via WAN interface rather than LAN interface, can I set any static route? or how to modify my nat rule to achieve this.

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

                Dude if you have some downstream router that understands this 10.96.0 network then you would create a static route..

                Still not understanding where this 10.96.0 network is… its on your VM host?

                your 192.168.1 is a transit to get to this downstream network.  If your doing some nat on some VM host.. You would send traffic to this VM hosts IP where this IP is natted too..

                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
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.