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

    How to set TTL?

    General pfSense Questions
    5
    10
    6.0k
    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
      Mascot
      last edited by

      I need to set same TTL for all outbound packets of my LAN.

      I could not find where exactly this setting is in pfSense webGUI?

      It can be easily done in OpenWrt or RouterOS, but how to do it in pfSense?

      Please, help.

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

        Maybe I wasn't clear enough.

        Here is what I need: if one of my LAN devices sends IP packets with, say, TTL=63, and another one with TTL=128, then when going through pfSense to WAN they all must have TTL=X (where "X" is whatever value I would set in pfSense).

        How do I set this up in pfSense? Do I need to create some filtering rule or... ?

        1 Reply Last reply Reply Quote 0
        • JKnottJ
          JKnott
          last edited by

          TTL is determined by the originating OS and only decremented by routers. I'd suspect changing TTL or hop limit on IPv6 might be a security risk. On IPv6, a hop limit of 255 is used to ensure a packet did not originate off the local LAN. Also, if routers could set TTL, then it would be possible to create a loop that defeats the TTL and results in packets travelling in that loop forever.

          PfSense running on Qotom mini PC
          i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
          UniFi AC-Lite access point

          I haven't lost my mind. It's around here...somewhere...

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            Altering the TTL is a great way to cause routing loops.

            pf does not have a way to set the TTL on packets.

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

            A 1 Reply Last reply Reply Quote 0
            • A
              AndrewZ @jimp
              last edited by

              @jimp said in How to set TTL?:

              Altering the TTL is a great way to cause routing loops.

              This is also a common way to hide the phone/modem tethering from the wireless carrier. I guess that is what is driving the OP.

              JKnottJ 1 Reply Last reply Reply Quote 1
              • JKnottJ
                JKnott @AndrewZ
                last edited by

                @andrewz said in How to set TTL?:

                This is also a common way to hide the phone/modem tethering from the wireless carrier. I guess that is what is driving the OP.

                Do they still do that?

                PfSense running on Qotom mini PC
                i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                UniFi AC-Lite access point

                I haven't lost my mind. It's around here...somewhere...

                A 1 Reply Last reply Reply Quote 0
                • A
                  AndrewZ @JKnott
                  last edited by

                  @jknott
                  yup, common techniques to prevent ToS violations are TTL checking and IMEI lookup. Some carriers are also implementing some sort of behavioral analysis, i.e. Android phone should not be talking with Windows Update web site.

                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User
                    last edited by A Former User

                    With pf scrub you can have a "minimum TTL" and all packets can be rewritten to make sure they meet this minimum TTL.

                    Maybe not quite what you're after? Certainly there's no GUI for this, you'd be out on your own.

                    Manual.

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      Mascot @A Former User
                      last edited by

                      @muppet said in How to set TTL?:

                      With pf scrub you can have a "minimum TTL" and all packets can be rewritten to make sure they meet this minimum TTL.

                      Maybe not quite what you're after? Certainly there's no GUI for this, you'd be out on your own.

                      Manual.

                      As far as I understood, scrub min-ttl enforces a minimum TTL. I.e. if I would set TTL on pfSense to be, say, 64 and some of my LAN devices would send packets with TTL=128, then pfSense won't change this one down to 64? Right?

                      In this case my only option to have same TTL with "pf scrub" is to set it to maximum value of 255? (Side question: are there any downsides of having TTL=255?)

                      Also, shouldn't there be possible some workaround to avoid looping? Like router somehow recognizing and ignoring packets if they are in a loop?

                      Also, maybe for FreeBSD there is something like "iptables mangle" for Linux?

                      1 Reply Last reply Reply Quote 0
                      • JKnottJ
                        JKnott
                        last edited by

                        @mascot said in How to set TTL?:

                        In this case my only option to have same TTL with "pf scrub" is to set it to maximum value of 255? (Side question: are there any downsides of having TTL=255?)
                        Also, shouldn't there be possible some workaround to avoid looping? Like router somehow recognizing and ignoring packets if they are in a loop?
                        Also, maybe for FreeBSD there is something like "iptables mangle" for Linux?

                        Well, as I mentioned, on IPv6 255 indicates a packet that's intended for the local LAN only. Will a router pass it? Also, recognizing packets it's seen before, that would require saving the packets it already sent and then comparing them with any new packets. That might keep a router a bit busy. Also, if a router sees a packet with 255, the assumption can only be that the previous router decremented from 0 and sent it on, violating the rule that says packets with or decremented to 0 must be discarded. You're trying to defeat the entire purpose of MTU, which is to prevent a packet from being sent forever around a loop.

                        PfSense running on Qotom mini PC
                        i5 CPU, 4 GB memory, 32 GB SSD & 4 Intel Gb Ethernet ports.
                        UniFi AC-Lite access point

                        I haven't lost my mind. It's around here...somewhere...

                        1 Reply Last reply Reply Quote 0
                        • GertjanG Gertjan referenced this topic on
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.