Skip to content

Instantly share code, notes, and snippets.

@saihtaM
Last active December 25, 2023 14:52
Show Gist options
  • Save saihtaM/d2641fbbec698777d29d4c7c6602dd46 to your computer and use it in GitHub Desktop.
Save saihtaM/d2641fbbec698777d29d4c7c6602dd46 to your computer and use it in GitHub Desktop.
HDHomeRun (legacy) streaming over VPN/VLANs using socat for port forwarding.
# This helps clients communicate with HDHR works across all VLANs and more, run this on a server with access to the clients prefix (because we need to see the broadcast).
[Unit]
Description=HDHomeRun socat port forwarding service
After=network.target
[Service]
ExecStartPre=/bin/sleep 5
ExecStart=/bin/bash -c '/usr/bin/socat udp4-recvfrom:65001,broadcast,fork udp4-sendto:HDHOMERUN-IP-HERE:65001 & /usr/bin/socat tcp4-listen:65001,reuseaddr,fork tcp4:HDHOMERUN-IP-HERE:65001'
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
#!/bin/bash
# When on vacation or on the go, this can be used to stream live TV from your HDHomeRun device to your location, on all your clients.
# It should work on any device, as long the other subnet is routable.
/usr/bin/socat udp4-recvfrom:65001,broadcast,fork udp4-sendto:HDHOMERUN-IP-HERE:65001 & # The client sends a UDP broadcast to discover HDHomeRuns on the network. This is also the port the HDHomeRun uses communicate with the client.
/usr/bin/socat tcp4-listen:65001,reuseaddr,fork tcp4:HDHOMERUN-IP-HERE:65001 # HDHomeRun switches to TCP, after the initial communication has been done with UDP. The channels are also sent over this connection I think.
If you have a legacy device, you should check this out: https://info.hdhomerun.com/info/using_the_app_with_legacy_hardware
When upgrading your firmware on your old devices, you can now use the HDHomeRun apps!
That was previously limited to only the new HDHR devices, with built in webserver that have the lineups.
Just be aware, I think you need to be on the same WAN IP address as where you did the scan.
And your scan is saved in the cloud, not on the device.
The app searches on [ff05::176]:65001 for HDHomeRuns. It's an Site-Local Scope Multicast Address.
If you want to do wild things, you could probably route this all the way. I can't do that in my current setup, and this setup was just for temporary use. The legacy device I tested with, didnt't have IPv6 (yet, hopefully comes in an update).
I've noticed the app seems to connect faster when hitting the IPv6 locally, doesn't matter that the other end of the socat is IPv4.
If you want to do your own testing, just change 4 to 6, and omit the ,broadcast. And the socat should work fine, as long the multicast reaches the system.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment