Skip to content

Instantly share code, notes, and snippets.

@nerdegem
Last active October 10, 2023 20:50
Show Gist options
  • Select an option

  • Save nerdegem/0ebbf27e32cc22854eb675f25c550f73 to your computer and use it in GitHub Desktop.

Select an option

Save nerdegem/0ebbf27e32cc22854eb675f25c550f73 to your computer and use it in GitHub Desktop.
HDHomeRun TTL Mangling with IPTables on OpenWRT
If you have a HDHomeRun tuner behind an OpenWRT device such as a cheap Gl-inet router (and within the 3 hop limit), you can very easily break the TTL packet setting that is now set on these devices with a simple shell command.
Based upon this work https://stuff.purdon.ca/?page_id=472
I figured out I could just add
iptables -t mangle -A FORWARD -s <hdhrip> -j TTL --ttl-set 64
iptables -t nat -A POSTROUTING -j MASQUERADE
to the existing rules and it would do what was required. Just add this command, replacing the <hdhrip> with the IP address of the HDHomerun box(s), into your startup scripts, and off you go - HDHomerun DVB TV via the internet once again.
@nerdegem

Copy link
Copy Markdown
Author

Testing what the TTL is on an interface in OpenWRT

  • install tcpdump then run...
  • tcpdump -vi wwan0 icmp

iptables -t mangle -I POSTROUTING -o wwan0 -j TTL --ttl-set 127

tcpdump: listening on wwan0, link-type RAW (Raw IP), capture size 262144 bytes
21:17:38.649477 IP (tos 0x0, ttl 127, id 53293, offset 0, flags [DF], proto ICMP (1), length 84)
10.174.174.174 > one.one.one.one: ICMP echo request, id 28781, seq 0, length 64
21:17:38.791432 IP (tos 0x0, ttl 54, id 60777, offset 0, flags [none], proto ICMP (1), length 84)
one.one.one.one > 10.174.174.174: ICMP echo reply, id 28781, seq 0, length 64

@nerdegem

Copy link
Copy Markdown
Author

Also this seems to be useful

iptables -t mangle -A FORWARD -j TTL --ttl-inc 5

https://unix.stackexchange.com/questions/605497/overriding-ip-packet-ttls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment