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

    NAT Reflection with FW rules containing aliases for IP addresses do not work

    Firewalling
    4
    13
    1.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.
    • DerelictD
      Derelict LAYER 8 Netgate
      last edited by

      What kind of alias are you using? Host(s) or Network(s)?

      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
      • M
        mmattel
        last edited by

        webserver_hostname has a host alias
        webservice_IP has a network alias

        1 Reply Last reply Reply Quote 0
        • DerelictD
          Derelict LAYER 8 Netgate
          last edited by

          I could not duplicate this.

          WAN VIP: 172.25.228.10, Inside server 172.25.233.100

          Redirect to address 172.25.228.10

          NAT Inbound Redirects

          rdr on re1 proto tcp from any to 172.25.228.10 port 80 -> 172.25.233.100

          Reflection redirect

          rdr on { re0 re2 enc0 openvpn } proto tcp from any to 172.25.228.10 port 80 -> 172.25.233.100

          OPT1 tcp 192.168.1.100:36433 -> 172.25.233.100:80 (172.25.228.10:80) ESTABLISHED:ESTABLISHED 2 / 1 112 B / 60 B
          LAN tcp 192.168.1.100:36433 -> 172.25.233.100:80 ESTABLISHED:ESTABLISHED 2 / 1 112 B / 60 B

          Redirect to Host Alias web_server

          table <web_server>{  172.25.228.10 }
          web_server = "<web_server>"

          NAT Inbound Redirects

          rdr on re1 proto tcp from any to $web_server port 80 -> 172.25.233.100

          Reflection redirect

          rdr on { re0 re2 enc0 openvpn } proto tcp from any to $web_server port 80 -> 172.25.233.100

          OPT1 tcp 192.168.1.100:36434 -> 172.25.233.100:80 (172.25.228.10:80) ESTABLISHED:ESTABLISHED 2 / 1 112 B / 60 B
          LAN tcp 192.168.1.100:36434 -> 172.25.233.100:80 ESTABLISHED:ESTABLISHED 2 / 1 112 B / 60 B

          Redirect to Network alias web_server_net

          table <web_server_net>{  172.25.228.10/32 }
          web_server_net = "<web_server_net>"

          NAT Inbound Redirects

          rdr on re1 proto tcp from any to $web_server_net port 80 -> 172.25.233.100

          Reflection redirect

          rdr on { re0 re2 enc0 openvpn } proto tcp from any to $web_server_net port 80 -> 172.25.233.100

          OPT1 tcp 192.168.1.100:36435 -> 172.25.233.100:80 (172.25.228.10:80) ESTABLISHED:ESTABLISHED 2 / 1 112 B / 60 B
          LAN tcp 192.168.1.100:36435 -> 172.25.233.100:80 ESTABLISHED:ESTABLISHED 2 / 1 112 B / 60 B</web_server_net></web_server_net></web_server></web_server>

          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)

          K 1 Reply Last reply Reply Quote 0
          • K
            kneufeld @Derelict
            last edited by

            @Derelict I can confirm this bug in 2.4.4-RELEASE-p3

            Here's how subtle and "awesome" it is.

            • using an alias as the destination in normal nat works fine
            • using an alias as the destination to an ip address works fine for nat reflection
            • using an alias as the destination to a fqdn FAILS for nat reflection

            So yeah...

            Kurt

            GertjanG 1 Reply Last reply Reply Quote 0
            • DerelictD
              Derelict LAYER 8 Netgate
              last edited by

              All aliases are IP addresses and networks under the hood. It makes no difference whether or not those IP addresses were entered directly or obtained via DNS lookup. NAT reflection won't care one bit. The rules using those aliases have no way to know and don't care whether it was a DNS lookup or not.

              There are lots of nuances that can come up in NAT reflection. You are probably hitting one of those.

              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)

              K 1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @kneufeld
                last edited by

                Maybe not related, but :

                @kneufeld said in NAT Reflection with FW rules containing aliases for IP addresses do not work:

                ... this bug in 2.4.4-RELEASE-p3

                So tests or reproduction can't be done, as it needs an ancient version.
                Most of us use 2.4.5-p1, two versions ahead.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • K
                  kneufeld @Derelict
                  last edited by

                  @Derelict I agree it makes zero sense. I repeated the experiment multiple times and repeated the results each time.

                  If you do try to replicate be aware that you have to force a re-save on the nat page.

                  @Gertjan Two patch releases make my version "ancient"? Okay...

                  1 Reply Last reply Reply Quote 0
                  • DerelictD
                    Derelict LAYER 8 Netgate
                    last edited by Derelict

                    Just sayin' that the NAT in pfsense (the pf firewall) that does NAT reflection has NO CONCEPT of an FQDN.

                    I would check the contents of the alias in Diagnostics > Tables in both cases. That is what pf will be operating on. See if you can spot the reason for it there.

                    It is much more likely that you are seeing something like the connecting client resolving the FQDN differently than the firewall is when it creates the alias table or something along those lines.

                    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)

                    K 1 Reply Last reply Reply Quote 0
                    • K
                      kneufeld @Derelict
                      last edited by

                      @Derelict

                      I just did it again. The Diagnostic > Table showed the same ip address both times. Yes I know it makes zero sense but maybe give it a try instead of saying how it's impossible.

                      Anyhow, I verified a reported bug, found a workaround, and then reported it. It's up to you if you want to act on it.

                      Kurt

                      1 Reply Last reply Reply Quote 0
                      • DerelictD
                        Derelict LAYER 8 Netgate
                        last edited by

                        Show, exactly, every step you have taken, what the name is, what it resolves to on the firewall and the client you are testing with.

                        There are no FQDNs in the pf configuration file. There is no reason for me to build it. There is another explanation for what you are seeing.

                        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.