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

    NAT and port aliases

    Scheduled Pinned Locked Moved 2.0-RC Snapshot Feedback and Problems - RETIRED
    7 Posts 4 Posters 3.5k 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.
    • S
      sh_man
      last edited by

      Could not find this elsewhere - apologies if it is.

      Just moving one of our firewalls to version 2 (2.0-BETA4  (i386) built on Thu Sep 2 23:07:04 EDT 2010 FreeBSD 8.1-RELEASE) and am setting up the NAT stuff. If I set a NAT rule up using an alias for the port it works if the ports are not being translated ie same ports on the external interface as are being used on the internal server but fails with a syntax error if the ports are being translated.

      For example, if I set up an alias for my FTP with ports 21, 5100:5200 and use this for both the Dest ports and the NAT Ports then everything is fine.
      However, if I use an alias for only one (Dest or NAT) then it fails with a syntax error - exact error generated by trying to translate https (443) to port 9180 - can use https in the port drop down but have to use 9180 in the NAT - can not use an alias that has a value of 9180.

      1 Reply Last reply Reply Quote 0
      • K
        kpa
        last edited by

        On latest snapshot 2.0-BETA4  (i386) built on Mon Sep 6 22:04:59 EDT 2010 there does not seem to be a way to edit the redirect target port at all if you used a port alias in it. Only way to change it is to select one of the predefined ports from the dropdown, anything else is changed back to the port alias on save.

        1 Reply Last reply Reply Quote 0
        • E
          eri--
          last edited by

          Please post screenshots or config.xml otherwise this is just a tale spoken in techy slang :)
          No useful information in this post to be used for trouble shooting.

          1 Reply Last reply Reply Quote 0
          • S
            sh_man
            last edited by

            Brain failure - should know better by now  :)

            Attached are a working and not working NAT definition and the definition of the alias that is being used.

            When it fails the error generated in the log is:-

            There were error(s) loading the rules: /tmp/rules.debug:216: syntax error
            pfctl: Syntax error in config file: pf rules not loaded The line in question reads [216]: rdr on bge0_vlan16 proto tcp from any to $SecureEEMExternal port 443 -> $SecureEEMInternal port $TEEMPort

            Let me know if anything else would be helpful

            Tim

            ![NAT Port Forward Working.gif](/public/imported_attachments/1/NAT Port Forward Working.gif)
            ![NAT Port Forward Working.gif_thumb](/public/imported_attachments/1/NAT Port Forward Working.gif_thumb)
            ![NAT Port Forward Not Working.gif](/public/imported_attachments/1/NAT Port Forward Not Working.gif)
            ![NAT Port Forward Not Working.gif_thumb](/public/imported_attachments/1/NAT Port Forward Not Working.gif_thumb)
            Alias.gif
            Alias.gif_thumb

            1 Reply Last reply Reply Quote 0
            • K
              kpa
              last edited by

              Ok, I have a port alias "test_ports" that is a single port 10000.

              I have a port forward of "test_ports" on WAN interface redirected to a host on my LAN to port "test_ports" and there is an automatically created filter rule associated with this port forward.

              First picture is the port forward I have opened for editing and I have just changed the redirect target port to 12345 from "test_ports". Second picture is after pressing save and you can see that the "Nat Ports" column for the last NAT rule has not changed to 12345 as it should have.

              nat_edit2.jpg
              nat_edit2.jpg_thumb
              nat_port_forward2.jpg
              nat_port_forward2.jpg_thumb

              1 Reply Last reply Reply Quote 0
              • E
                Efonnes
                last edited by

                Currently it is supposed to only allow you to use the same alias for destination ports and redirect target ports and nothing else when you use a port alias, however there is no input validation to enforce this, as far as I know.  The back-end could be changed to resolve the alias so that the error does not occur.  However, this could only work for aliases with a single port or a single range, since there does not appear to be a way for the redirection port field in rules.debug to accept anything beyond that.

                1 Reply Last reply Reply Quote 0
                • E
                  Efonnes
                  last edited by

                  I've put in a fix for this, though it has limitations.  If you use an alias for redirect target port and destination port is not using that same alias, it can only use the first port or port range for redirect target port.

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