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

    NAT specific port to different virtual IP not working?

    NAT
    2
    3
    2.1k
    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.
    • C
      cburns
      last edited by

      im trying to do outbund nat from my internal smtp gateway to using its own virtual wan ip (carp)
      The problem is that the later rule for general outbound nat for the serverlan takes precedence…

      $ pfctl -s nat
      nat-anchor "natearly/" all
      nat-anchor "natrules/
      " all
      nat on em4 inet from 10.0.3.92 to any port = smtp -> x.x.152.181 port 25   <--- Not working, it turns into x.x.152.185 when it talks port 25 to the internet
      nat on em4 inet from 10.0.242.0/24 to any -> x.x.152.181 static-port
      nat on em4 inet from 10.0.2.0/23 to any -> x.x.152.185 port 1024:65535  <--- this one seems to take precedence?
      nat on em4 inet from 10.0.0.0/24 to any -> x.x.152.179 port 1024:65535

      Is the order wrong? I thought that it was based on a first match basis?
      Any insights to this is appreciated :)

      Im running 2.0rc1 build april 18

      Cheers

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Look at Diagnostics > States the next time you try a connection, and post what the state for the connection in question looks like.

        It is first-match-wins, but something may not be matching that rule.

        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
        • C
          cburns
          last edited by

          Thanks for the tip. Seemed to be something with the inbound NAT rule that messed it up… Had source port range defined and for some reason that messed up the outbound NAT
          Anywho problem solved now, thanks :)

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