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

    Double NAT

    Scheduled Pinned Locked Moved NAT
    27 Posts 5 Posters 6.0k 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.
    • O
      Ofloo
      last edited by

      I did but all stops at the router, .. if i make a socket on the router for instance

      nc -l 5060 then i can connect to it, but if i add a rule then it doesn't, the strange thing i just discovered however is, that UDP does pass through? only TCP is having issues and yes it's a new pfsense box and modem, ..

      and all outbound rules are on the WAN interface

      WAN	 	127.0.0.0/8	*	*	500	WAN address	*	YES	 	
      WAN	 	127.0.0.0/8	*	*	*	WAN address	*	NO	 	
      WAN	 	192.168.1.0/24	*	*	500	WAN address	*	YES	 	
      WAN	 	192.168.1.0/24	*	*	*	WAN address	*	NO	 	
      

      same for localhost ofcourse

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

        "and all outbound rules are on the WAN interface"

        Huh??  There is no outbound rules on the wan..  All rules in pfsense are INBOUND to the interface..  Other than floating rules.

        Oh your outbound nat –- well how is that going to work??  If your traffic comes in in isp 2, and you send out the traffic in answer out isp 1?

        Your going to need an outbound nat rule for the traffic to go back out the correct wan connection.

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

        1 Reply Last reply Reply Quote 0
        • O
          Ofloo
          last edited by

          Could you provide a sample cause it doesn't really make sense what it is you're saying.

          lets say i want to forward 5060, .. then i would make a forward rule however in the outbound what am i supposed to do there?

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

            You need the nat to go out the interface you came in on.. You have 2 wan connections right..

            Do you need a picture??  So something comes in wan2, and then when try to talk back it goes out wan1 how do you expect that to work?

            2wan.png
            2wan.png_thumb

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

            1 Reply Last reply Reply Quote 0
            • O
              Ofloo
              last edited by

              actually I've got 4 connections and 2 pfsenses, .. the thing is one of 2 works kinda, it has also nat issues, with your post this makes sense, however the new pfsesne has is new and has only one wan for now, .. the point is that it is behind a nat enabled modem, I can't disable it since it's the isp who delivers it like this, ..

              However I can setup portforwarding and dmz, which I did, on the new pfsense the one I'm having issues with, .. I can make a port listen nc -l 5060 for example and connect to it from the internet, however once i setup portforwarding on the pfsense box it self to forward that traffic to a IP within the lan it doesn't work.

              so basicly I can connect to the port however once I want to forward it, it doesn't work. So i think something is wrong in the NAT of the new pfsense, …

              so basicly this pfsense has wan IP 192.168.10.10 and I need to forward some ports to 192.168.1.40 all the traffic arrives only at the point of portforwarding it all goes wrong but i can't wrap my head arround it why.

              This is a forward, what would the corresponding outbound rule be.

              WAN	TCP/UDP	*	*	WAN address	5060 (SIP)	192.168.1.40	5060 (SIP)
              

              I thought these where those rules

              WAN	 	192.168.1.0/24	*	*	500	WAN address	*	YES
              WAN	 	192.168.1.0/24	*	*	*	WAN address	*	NO
              
              1 Reply Last reply Reply Quote 0
              • DerelictD
                Derelict LAYER 8 Netgate
                last edited by

                You do not need outbound rules with only 1 WAN/default gateway.  pfSense is stateful.

                Reworded: The default rules are all you need.

                What's the corresponding firewall rule on WAN?

                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
                • O
                  Ofloo
                  last edited by

                  Euhm, I allow all traffic there's no rules needed, I guess I don't filter anything at this point.

                  Edit:

                  I need to verify something, .. maybe I thought of the reason, .. but not sure if this could be the cause. As  i said I have 2 pfsenses

                  WAN => pfsense1 => 192.168.1.1/24
                  WAN => pfsense2 => 192.168.1.2/24

                  the pfsense1 does nat on that range and pfsense2 as well is and forwards traffic to the same range is that possible.

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

                    No rules means no connections allowed into WAN.

                    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
                    • O
                      Ofloo
                      last edited by

                      No I have rules but allow any.

                      IPv4 *	*	*	*	*	*	none
                      IPv6 *	*	*	*	*	*	none	
                      

                      So I don't really see the point in adding an extra rule, that specifically allows that traffic, because allow any  should match all.

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

                        No that's fine.  You'll have to figure out where the breakdown is then.  Check everything on the inside client (like its default gateway, firewall, etc.)

                        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
                        • O
                          Ofloo
                          last edited by

                          ok the idea is to add a sip trunk and backup sip trunk to have one go over one wan and the other over an other wan

                          so basicly i forward the port 5060 to 192.168.1.40 on both pfsense, the gateway for the 192.168.1.40 is 192.168.1.1, however on the pfsense1 box I have a rule that when it matches the target IP it should use the pfsense2 as gateway so this should be fine.

                          pfsense1 forward 5060 to 192.168.1.40
                          pfsense1 if target IP 91.213.251.136 and dport 5060 make it use gateway 192.168.1.2 otherwise gateway 192.168.1.1
                          pfsense2 forward 5060 to 192.168.1.40

                          and finaly on both the same nat rules as above. I can reach the traffic up until pfsense2, so if i remove the forward rule and setup nc to listen on 5060 i can connect to it and send and receive data, however for some reason it doesn't want to forward that traffic to the 192.168.1.40

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

                            I can't decipher that.  Draw a diagram.  See the one in my sig for the type of information you should include.

                            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
                            • O
                              Ofloo
                              last edited by

                              I understand, .. can you recommend a unix/linux program to do so.

                              1 Reply Last reply Reply Quote 0
                              • marcellocM
                                marcelloc
                                last edited by

                                Sip/rtp will not work with double nat. You will need a sip server or a sip and rtp proxy  on the firewall(or beside) to workaround it.

                                Treinamentos de Elite: http://sys-squad.com

                                Help a community developer! ;D

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

                                  It's hard enough with single NAT/PAT.

                                  For future reference:

                                  Free Diagramming Software: https://forum.pfsense.org/index.php?topic=1630.0

                                  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
                                  • O
                                    Ofloo
                                    last edited by

                                    That's the whole point SIP does work but it uses UDP, I wanted to give clients access to it using TCP cause in some networks UDP can't get passed a proxy, you need TCP but sip does work when it's using UDP it uses the same rules as TCP but for some reason TCP doesn't work.

                                    And I have a sip server

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

                                      "You do not need outbound rules with only 1 WAN/default gateway.  pfSense is stateful."

                                      Agreed.. But from his first few statements..
                                      "I've got a second cable modem with isp setup the isp for some reason doesn't want to provide bridge"

                                      But seems he using a different copy of pfsense, which is my bad for not reading it correctly.  But which is why I asked if 2 wan connections.
                                      "You have 2 wan connections right.."
                                      " What wan connection will it go out of - the normal wan, or this new double nat wan?"
                                      "If your traffic comes in in isp 2, and you send out the traffic in answer out isp 1?"

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

                                      1 Reply Last reply Reply Quote 0
                                      • O
                                        Ofloo
                                        last edited by

                                        double, still working on that network map, have it ready in a bit

                                        1 Reply Last reply Reply Quote 0
                                        • O
                                          Ofloo
                                          last edited by

                                          sorry not really good in these drawings tried to be as clear as possible

                                          network.png
                                          WAN2.png
                                          WAN2.png_thumb
                                          network.png_thumb

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            mikeisfly
                                            last edited by

                                            What ISP are you using, I may be able to help? Why not put your firewall in the DMZ of the ISP NAT device. Most of the time their DMZ will forward all unsolicited traffic to the DMZ IP.

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