Skip to content

Commit

Permalink
Make UDP port configurable (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmagyar committed Sep 11, 2024
1 parent 28fea60 commit 343419d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tailscale/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,19 @@ your tailnet. This will prevent your Home Assistant instance from losing network
connection. This also means that using the same subnet on multiple nodes for load
balancing and failover is impossible with the current add-on behavior.

## Network

### Port: `41641/udp`

UDP port to listen on for WireGuard and peer-to-peer traffic.

Use this option (and router port forwarding) if you experience that Tailscale
can't establish peer-to-peer connections to some of your devices (usually behind
CGNAT networks). You can test connections with `tailscale ping
<hostname-or-ip>`.

When not set, an automatically selected port is used by default.

## Changelog & Releases

This repository keeps a change log using [GitHub's releases][releases]
Expand Down
2 changes: 2 additions & 0 deletions tailscale/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ devices:
- /dev/net/tun
map:
- share:rw
ports:
41641/udp: null
schema:
accept_dns: bool?
accept_routes: bool?
Expand Down
7 changes: 7 additions & 0 deletions tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Runs tailscale
# ==============================================================================
declare -a options
declare udp_port

bashio::log.info 'Starting Tailscale...'

Expand All @@ -16,6 +17,12 @@ if ! bashio::debug ; then
options+=(--no-logs-no-support)
fi

# Use configured UDP port
udp_port=$(bashio::addon.port "41641/udp")
if bashio::var.has_value "${udp_port}"; then
options+=(--port=${udp_port})
fi

# Use userspace networking by default when not set, or when explicitly enabled
if ! bashio::config.has_value "userspace_networking" || \
bashio::config.true "userspace_networking";
Expand Down
4 changes: 4 additions & 0 deletions tailscale/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ configuration:
Assistant instance, disable userspace networking mode, which will create a
`tailscale0` network interface on your host.
When not set, this option is enabled by default.
network:
41641/udp: >-
UDP port to listen on for WireGuard and peer-to-peer traffic.
When not set, an automatically selected port is used by default.

0 comments on commit 343419d

Please sign in to comment.