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

NAT / Port Forward issue

NAT
nat port forward port forwarding public ip
3
14
1.4k
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.
  • M
    mrdeckard
    last edited by Jul 11, 2021, 4:46 PM

    Hi all,
    I'm trying to configure pfsense 2.4.5 (but I had the same problems with the latest version 2.5.X). My scenario is :
    pfsense having a public static IP and its private network adapter (192.168.0.1) bound to my private LAN where I have a Web server that I don't want to expose directly on the Internet.

    eth of the private interface in my web server is configured as follow:

    DEVICE=eth1
    NM_CONTROLLED=no
    ONBOOT=yes
    TYPE=Ethernet
    NAME="System eth1"
    BOOTPROTO=none
    PREFIX=24
    IPADDR=192.168.0.118

    No firewall is activated:

    systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
    Active: inactive (dead)
    Docs: man:firewalld(1)

    For what concerning iptables, no rule is set.

    FOr the chosen example scenario, I've set the following NAT /Port Forward rule for port 8080:

    🔒 Log in to view

    and for the rules firewall, I have the following configuration:
    🔒 Log in to view

    Source IP 93.X.X.X in the screenshot is the static public IP of my office router.

    When I try to access my web server accessing to public IP of pfsense on 8080 port, it seems that the rule is verified, but no response seems to come back. Below the log for a request that rules intercepted and tried to redirect to internal LAN.

    🔒 Log in to view

    Below you can see the capture (pfsense side):

    🔒 Log in to view

    As said, also from the capture, it seems that for the sent frames, no response is received.
    Do you have any idea of what I'm wrong? Any suggestion will be very appreciated.
    Thanks to all of you.

    1 Reply Last reply Reply Quote 0
    • C
      chpalmer
      last edited by Jul 11, 2021, 4:53 PM

      Go you have a "gateway" configured on the device that you are trying to serve from?

      Triggering snowflakes one by one..
      Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz on an M400 WG box.

      M 2 Replies Last reply Jul 11, 2021, 5:12 PM Reply Quote 0
      • M
        mrdeckard @chpalmer
        last edited by Jul 11, 2021, 5:12 PM

        Hi @chpalmer , thanks for the quick reply.
        Do you refer to the machine where web server is running? I've the gateway just for eth0 (where is still configured a static public IP, in order to continue to reach it) , but not for eth1 (LAN). In this case, I've tried to add to the configuration of eth1 (192.168.0.118 - web server) the property
        GATEWAY=196.168.0.1 (internal IP of pfsense), but machine became no more reachable also by public side...I don't know why....

        K 1 Reply Last reply Jul 11, 2021, 5:50 PM Reply Quote 0
        • K
          KOM @mrdeckard
          last edited by KOM Jul 11, 2021, 6:29 PM Jul 11, 2021, 5:50 PM

          @mrdeckard So this web server at .118 has full access, can ping out to 8.8.8.8 etc? Your trace shows no response. I would do a capture on LAN when you run your test to make sure the packets are making their way through pfSense to the web server.

          Troubleshooting NAT Port Forwards

          M 1 Reply Last reply Jul 11, 2021, 6:38 PM Reply Quote 0
          • M
            mrdeckard @KOM
            last edited by Jul 11, 2021, 6:38 PM

            Hi @kom ,
            thank you for the replay.
            I confirm that I can ping 8.8.8.8. Soon I will try to make a capture on the webserver side. I'll let you know the outcome of the capture. Thanks again for your help.

            K 1 Reply Last reply Jul 11, 2021, 6:56 PM Reply Quote 0
            • K
              KOM @mrdeckard
              last edited by Jul 11, 2021, 6:56 PM

              @mrdeckard Make sure you go through that list I linked to. It's always something in that list that turns out to be the problem.

              M 1 Reply Last reply Jul 12, 2021, 7:18 AM Reply Quote 0
              • M
                mrdeckard @KOM
                last edited by Jul 12, 2021, 7:18 AM

                Hi @kom,
                I checked the troubleshooting procedures written in your link. It seems OK to me, and I have a doubt about the correct configuration of the gateway on the receiving machine (webserver). Can I show you the webserver routing table? I made the capture on the webserver side, and in fact, I find it strange. Below I show the capture made with tcpdump on eth1 (192.168.0.118) of the webserver when calling the public address of pfsense on port 8080.

                🔒 Log in to view

                I find the indication TPR Out-Of-Order very strange and then follow the TCP retransmission coming from my browser placed behind the router of my office.

                In fact, there never seems to be a response back from the webserver. What do you think? What useful information could I investigate?

                Thank you so much.

                K 1 Reply Last reply Jul 12, 2021, 2:05 PM Reply Quote 0
                • K
                  KOM @mrdeckard
                  last edited by Jul 12, 2021, 2:05 PM

                  @mrdeckard What does the web server show for:

                  ip route show
                  
                  M 1 Reply Last reply Jul 17, 2021, 6:32 PM Reply Quote 0
                  • M
                    mrdeckard @KOM
                    last edited by Jul 17, 2021, 6:32 PM

                    Hi @kom,
                    I am very sorry to be able to answer just now. Unfortunately, I've been on the road these days and couldn't get to my test servers.
                    Before showing you the information on routing tables, I would like to thank you again for your support and your great spirit of help.

                    My web server's routing table is the following:

                    🔒 Log in to view

                    As you can see, the address of 195.xxx.xxx.xxx is the IP class from the public side. So the public address exposed by the eth0 network interface is 195.xxx.xxx.91, while on eth1, there is the LAN side (192.168.0.118).

                    If it can be useful, observing the various, I observe a strange thing. For example, if I go to Status -> Gateway, I observe the following:

                    🔒 Log in to view

                    It appears that the Gateway on the public side is "duplicated" (forgive me for the lack of knowledge of pfsense and possibly some concepts), and one of the duets appears to be in a "Pending" state. I can not understand.

                    I thank you again!

                    K 1 Reply Last reply Jul 18, 2021, 3:46 AM Reply Quote 0
                    • K
                      KOM @mrdeckard
                      last edited by Jul 18, 2021, 3:46 AM

                      @mrdeckard Looks like your config has a prob;em. What do you have under System - Routing - Gateways?

                      M 1 Reply Last reply Jul 18, 2021, 10:30 AM Reply Quote 0
                      • M
                        mrdeckard @KOM
                        last edited by Jul 18, 2021, 10:30 AM

                        Hi @kom ,
                        under System - Routing - Gateways I have the following situation:

                        🔒 Log in to view

                        Do you have any advice for me? Do you think it could be something I went wrong during the setup or something that went wrong during the installation?

                        Thank you so much!

                        K 1 Reply Last reply Jul 18, 2021, 6:12 PM Reply Quote 0
                        • K
                          KOM @mrdeckard
                          last edited by KOM Jul 18, 2021, 6:18 PM Jul 18, 2021, 6:12 PM

                          @mrdeckard I don't know why you have two identical gateways but that can't be good. The second one appears to be the default created by pfSense. I would delete the first one and then try again.

                          Edit: I just noticed that the gateway set for your web server seems to be the public IP address of your WAN. It should be your pfSense LAN IP address.

                          M 1 Reply Last reply Jul 18, 2021, 10:29 PM Reply Quote 1
                          • M
                            mrdeckard @KOM
                            last edited by Jul 18, 2021, 10:29 PM

                            Hi @kom,
                            Excuse me. I realized right now that the real problem was in setting up my gateway on the webserver! So your observation is absolutely correct.
                            I corrected the Gateway on the webserver, setting it to the router/firewall address (on the private interface of pfsense 192.168.0.1).
                            Now the system works as expected.

                            I learned that you need to check the troubleshooting guidelines not 5 but 10 times!
                            Troubleshooting NAT Port Forwards

                            Thank you very much and thanks for your patience and support.

                            Thanks sincerely.

                            1 Reply Last reply Reply Quote 0
                            • M
                              mrdeckard @chpalmer
                              last edited by Jul 18, 2021, 10:32 PM

                              Hi @chpalmer,
                              You were right; the problem was an incorrect gateway configuration on the webserver.

                              Thanks again!

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