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

    How to NAT incomming traffic for certain source and certain port??

    Scheduled Pinned Locked Moved Firewalling
    13 Posts 4 Posters 1.1k Views 3 Watching
    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.
    • johnpozJ Offline
      johnpoz LAYER 8 Global Moderator @louis2
      last edited by johnpoz

      @louis2 said in How to NAT incomming traffic for certain source and certain port??:

      The incoming packages is not trigger the rule

      So you post lots of details of your port forward. But no mentioned of the rule on your wan? Where this traffic comes in.

      Normally when you create a port forward, it defaults to creating the wan rule. But order matters, source actually matters as well if for some reason say that source was rfc1918, which as source is blocked by default on wan, before any of your rules would be evaluated.

      Much easier to read if you would post up screen shot of your port forward, and also the rules you have on your wan, and if you have any rules on your floating tab that could also mess with your wan rules. Since floating are normally evaluated before interface rules (if they are marked quick).

      You don't actually say where source network is - is it rfc1918? And are you sure the source port is going to be 5060, or just the destination port?

      Posting your sniff where you see this traffic come into your wan would be helpful as well.

      edit: also btw why screenshot are way better, in you text you say 5600, but sip is 5060..

      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 25.07.1 | Lab VMs 2.8.1, 25.07.1

      1 Reply Last reply Reply Quote 0
      • S Offline
        SteveITS Galactic Empire @louis2
        last edited by

        @louis2 said in How to NAT incomming traffic for certain source and certain port??:

        source port range other 5600 other 5600

        Are you sure that's not the destination port? Normally source ports are randomized. Try allowing any source port.

        Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
        When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
        Upvote ๐Ÿ‘ helpful posts!

        johnpozJ 1 Reply Last reply Reply Quote 1
        • johnpozJ Offline
          johnpoz LAYER 8 Global Moderator @SteveITS
          last edited by

          exactly.. And dest port would normally be 5060 for sip.

          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 25.07.1 | Lab VMs 2.8.1, 25.07.1

          1 Reply Last reply Reply Quote 0
          • L Offline
            louis2
            last edited by

            Hello,

            I do not know why, perhaps as a consequence of restarts and/or switching on off the wan, whats ever ..... but the nat works .....

            For info, in a SIP-invite the source address is 5600 see below

            SipInviteFrame.JPG

            Below a couple of rule I am using to forward some traffic. Of course there are some related auto generated rules in the WAN-interface

            SomeNatRules.JPG

            There are some more rules required, however ........ I still do not have working telphonie ๐Ÿ˜ง ๐Ÿ˜ง I assume that is related with registration communication between the providers voip-platform and the Fritsbox.

            At this moment, despite lots of tests and wireshark-traces, I just do not know the remaining issues are and as a consequence even less how to fix them .....

            I even doubt if I will ever get it working .....
            Not every thing ..... is documented the way I would like ....... and the fritsbox is not intended to be used as voip access point, in opposite to its intended use as a router

            Louis

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              SteveITS Galactic Empire @louis2
              last edited by

              @louis2 So the IP .61 is KPN_IMS? And this is for a new call coming in to your server?

              In your second picture those are NAT forwards? What is the column after FritzBoxDect? On a NAT forward that would be "NAT Ports" and I did not think it possible to set that to any/*...?

              Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
              When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
              Upvote ๐Ÿ‘ helpful posts!

              1 Reply Last reply Reply Quote 0
              • Bob.DigB Offline
                Bob.Dig LAYER 8
                last edited by Bob.Dig

                Doesn't the fritzbox shows what ports are needed?
                For my SIP Provider (and ISP) I also have to use static port outbound NAT.

                Capture.PNG

                And keep alive (30sec) in the fritzbox for telephony but I don't have to open ports.

                L 1 Reply Last reply Reply Quote 0
                • L Offline
                  louis2 @Bob.Dig
                  last edited by

                  @bob-dig

                  Hi Bob, I used to have a rule like that in the past, however I do not understand the need for such a rule. Let me explain my thinking.

                  For incoming IPV4-traffic you need a NAT-rule and the related fw-rule to:
                  a) allow the traffic and
                  b) to map the the traffic from your external ip towards the local ip of the involved ipv4 machine

                  And if i connect the internet from the lan you also need nat to get an global valid IPV4-adress (the IPV4-address assigned to you). However .... that is standard and handled by the default auto generated NAT-rule.

                  So assuming that that is correct, you only need NAT-rules for incoming traffic.

                  With that in mind I did create,

                  • a NAT-rule to map and allow incoming SIP
                  • a NAT-rule to allow incoming RTP and
                  • a NAT-rule to allow some additional ports I found (but from I do not know if they are really used and if how)

                  I also noticed that there are ICMP status messages, so I should probably allow and NAT them as well (I still have to add that).

                  However I have to admit that it is only partly (not to say not) working at the moment.

                  • the incoming sip-invites which should pass, do not always pass and verdict I do get perhaps related crash reports (see 2.7 development section)
                  • the SIP registration process is probably not working as it should
                  • if the incoming SIP-invite is NAT as expected, than an incoming call / session is started ........ however ....... there is outgoing rtp is not audible at the remote site (despite the fact that there is two way audio in the WAN wireshark trace).

                  To resume:

                  • I do not understand the outgoing nat rule (including "static")
                  • more other aspects to understand and solve :(
                  Bob.DigB 1 Reply Last reply Reply Quote 0
                  • Bob.DigB Offline
                    Bob.Dig LAYER 8 @louis2
                    last edited by

                    @louis2 My understanding is, you can open ports all that you want. If the other side expects static outbound NAT then you have to do that anyways, there is no way around that.

                    1 Reply Last reply Reply Quote 0
                    • L Offline
                      louis2
                      last edited by louis2

                      Hello,

                      I know that the actual thread title does not reflect the original subject ...... but given previous post here my actual problem.

                      At this moment I can create an incoming call (from my mobile) towards my fritzbox and I can make a call from my fritzbox towards my mobile.

                      However, in case of the incoming call, there is no audible sound from the home set present. The mobile can not hear the home side (one way audio).

                      I case of the outgoing call it works like it should (two way audio).

                      The strange thing is that wireshark traces of both calls and in both involved vlans (the WAN and the LAN) show that there is two way RTP). I can listen to that using wireshark ....... But a said for in case of the incoming call, the audio from the home set is not audible on the mobile.

                      I did lot of tests, but I really do not understand the problem. So I really hope someone out there does understand and has the solution.

                      Below, screenshots of my actual settings

                      Louis

                      53a8526d-3531-4901-9251-946820438fd5-image.png

                      88e6c479-829b-4bcc-b71b-bdee5f191546-image.png

                      1 Reply Last reply Reply Quote 0
                      • L Offline
                        louis2
                        last edited by

                        I should have added, that if I directly connect the fritzbox with the glass access point, everything works as expected.

                        Up to now I did not manage to monitor / log the communication between the fritzbox and the glass access. That is difficult since it is pppoe with at least two vlans (4 and 6). Where the interface spec is ...... not really known.
                        Trying to connect the glass access and the fritsbox failed and of cause than it is also not possible to capture a wireshark trace using the switch its mirror capacity.

                        1 Reply Last reply Reply Quote 0
                        • L Offline
                          louis2
                          last edited by

                          With the actual settings, that are the settings shown above minus the top and botum NAT-froward rules and the two LAN-rules disabled. There is very low volume audio present.

                          So to a certain extend it works, however the audio is surrey not passing correctly yet

                          1 Reply Last reply Reply Quote 0
                          • L Offline
                            louis2
                            last edited by

                            Note,

                            That working on this issue I encountered three issues:

                            • a crash report
                            • strange nat interface behavoir
                            • an incorrect backup file, probably related to this activity

                            So, I did open some issues in the development forum, and will wait with further trails up to updates and jimps reaction

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