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

    Port forwarding issue

    NAT
    4
    16
    3.6k
    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.
    • B
      Blade1
      last edited by

      Hi,

      I have a DMZ network setup. Within this, I have a server (192.168.33.15) hosting a website in IIS (test.domain.com).

      I want to use port forwarding to forward requests for this domain from the firewall to the server (which is on a private IP) and return the results.

      I have set the DNS servers of the web server and the firewall to a DMZ DNS server which has the relevant DNS records. However, when browsing to the site from an outside machine, I just get DNS could not be resolved.

      I also have a firewall rule to allow traffic from WAN to this server.

      What gives?

      1 Reply Last reply Reply Quote 0
      • KOMK
        KOM
        last edited by

        What about your NAT rule?

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

          So is your test.domain.com resolve on the public internet to your public ip?  Sounds like that isnt working

          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.7.2, 24.11

          1 Reply Last reply Reply Quote 0
          • B
            Blade1
            last edited by

            @KOM:

            What about your NAT rule?

            Could you elaborate, please? What would this look like?

            1 Reply Last reply Reply Quote 0
            • B
              Blade1
              last edited by

              @johnpoz:

              So is your test.domain.com resolve on the public internet to your public ip?  Sounds like that isnt working

              Unfortunately not and I was/am a bit confused here… I guess I'd ask my domain name hoster to create a record here?

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

                Yeah kind of hard for pfsense to forward traffic it never sees user outside pfsense has to be able to resovle test.domain to get to pfsense for pfsense to see traffic and forward it

                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.7.2, 24.11

                1 Reply Last reply Reply Quote 0
                • KOMK
                  KOM
                  last edited by

                  Could you elaborate, please? What would this look like?

                  A NAT rule tells pfSense how to translation from public IP WAN request to private LAN host.  In your case, you need a port forward so that pfSense know to forward certain traffic to the host on your LAN.  To do a port forward, you need both a NAT rule to define the forwarding and a firewall rule to allow the traffic to flow.  Sounds like you only have the firewall rule, if that.

                  https://doc.pfsense.org/index.php/How_can_I_forward_ports_with_pfSense

                  https://doc.pfsense.org/index.php/Port_Forward_Troubleshooting

                  1 Reply Last reply Reply Quote 0
                  • B
                    Blade1
                    last edited by

                    @KOM:

                    Could you elaborate, please? What would this look like?

                    A NAT rule tells pfSense how to translation from public IP WAN request to private LAN host.  In your case, you need a port forward so that pfSense know to forward certain traffic to the host on your LAN.  To do a port forward, you need both a NAT rule to define the forwarding and a firewall rule to allow the traffic to flow.  Sounds like you only have the firewall rule, if that.

                    https://doc.pfsense.org/index.php/How_can_I_forward_ports_with_pfSense

                    https://doc.pfsense.org/index.php/Port_Forward_Troubleshooting

                    Ok thanks.

                    That leaves two questions:

                    1. When setting up port forwarding, does it need to be done in tandem with reverse proxy (e.g. the squid reverse proxy which I have installed on the pfsense VM)

                    2. Do I need to make any changes to the domain name? I.E. the domain name is purchased with a registrar, do I need any records registered with them?

                    Thanks

                    1 Reply Last reply Reply Quote 0
                    • KOMK
                      KOM
                      last edited by

                      When setting up port forwarding, does it need to be done in tandem with reverse proxy (e.g. the squid reverse proxy which I have installed on the pfsense VM)

                      I don't have any experience with squid reverse proxy so I can't advise you there, but I would tend to believe that if you have reverse proxy configured right, you shouldn't need a manual NAT rule?  I don't know for sure.

                      Do I need to make any changes to the domain name? I.E. the domain name is purchased with a registrar, do I need any records registered with them?

                      The authoritative DNS for your domain should point back to your pfSense WAN IP address.  Do you only have the one public IP address or more?  If oyu have several public IPs and are using Virtual IPs to handle them, you would ensure that DNS for your domain points to the VIP you're using for that service.

                      1 Reply Last reply Reply Quote 0
                      • D
                        doktornotor Banned
                        last edited by

                        @KOM:

                        I don't have any experience with squid reverse proxy so I can't advise you there, but I would tend to believe that if you have reverse proxy configured right, you shouldn't need a manual NAT rule?  I don't know for sure.

                        You need allow rule on WAN for WAN IP/reverse proxy port. (N.B. This only can be meaningfully tested from WAN. Do NOT bother with "tests" from LAN via NAT reflection and similar clusterfucks.)

                        1 Reply Last reply Reply Quote 0
                        • KOMK
                          KOM
                          last edited by

                          So you do need a firewall rule but not a NAT rule when using reverse proxy?

                          1 Reply Last reply Reply Quote 0
                          • D
                            doktornotor Banned
                            last edited by

                            Yes. (Again, talking about valid tests from WAN.)

                            1 Reply Last reply Reply Quote 0
                            • B
                              Blade1
                              last edited by

                              Ok so I've configured a DNS rule testsite.domain.com to go to my firewall's public IP address.

                              However, despite portforwarding setup, a firewall rule, and the reverse proxy, the web page is never hit?

                              I guess I should now ask in the Squid section.

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

                                so testsite.domain.com resolves on the public internet to your public IP??

                                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.7.2, 24.11

                                1 Reply Last reply Reply Quote 0
                                • D
                                  doktornotor Banned
                                  last edited by

                                  @Blade1:

                                  However, despite portforwarding setup, a firewall rule, and the reverse proxy, the web page is never hit?

                                  What port forwarding?! You either use RP or port-forwarding. Not both! And let me tell it again - testing this from LAN is a complete waste of time.

                                  1 Reply Last reply Reply Quote 0
                                  • B
                                    Blade1
                                    last edited by

                                    I tested from an outside machine but failed.

                                    Nonetheless, I redid everything but no port forwarding rules and I can access an internal web server!

                                    The only problem is I get the error here when changing the default port for the reverse proxy:

                                    https://forum.pfsense.org/index.php?topic=87280.0

                                    So my internal web server is running on port 8082. testsite.domain.com redirects to the pfsense homepage but testsite.domain.com:8082 goes to the web server.

                                    Can I make testsite.domain.com go to testsite.domain.com without the port number showing?

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