Share a LAN (subnet routers)
Let your Devices reach a whole LAN, such as your home network, through one Device on it.
A subnet router is a Device that shares the LAN it sits on with the rest of your Network. Through it, your laptop or phone can open things that cannot run Tiltas themselves, such as the router's own page, a printer, a camera or a smart home hub, from anywhere.
Three steps, all needed:
- The Device offers the LAN. You tell Tiltas on that Device which subnets it shares.
- An Owner or Admin approves it in the console.
- An Access rule says who may use it. Nothing reaches the LAN without one.
Your LAN is the network your router hands out, written as a subnet: a NAS at 192.168.1.20 with the mask
255.255.255.0 is on 192.168.1.0/24.
On a Linux server
The server must be on the LAN, joined to your Network (Add a Linux server).
Turn on IP forwarding
The server passes packets between your Network and the LAN, so Linux must forward them:
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tiltas.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tiltas.conf
sudo sysctl -p /etc/sysctl.d/99-tiltas.confIf the server runs a firewall that filters forwarded traffic, it must let traffic from the tiltas0 interface through
to the LAN.
Offer the LAN
sudo tiltas set --advertise-routes=192.168.1.0/24Separate several subnets with commas. The setting is kept across restarts.
Approve the route
In the console, open Devices, then the server. Under Subnet routes, the LAN shows as Offered: switch it on to approve it. It then shows as Approved.
Allow it
Open Access rules and choose Add a rule. Under Who, choose who may use the LAN. Under May reach, choose
Subnet and type 192.168.1.0/24, with ports if you want to narrow it, such as 80, 443. Choose Add rule.
Your laptop and phone use approved routes by themselves, with no setting on their side. From anywhere, open
http://192.168.1.1 (your router, say).
In Docker and on a NAS
The Tiltas image offers the LAN from the TILTAS_ROUTES environment variable, such as TILTAS_ROUTES=192.168.1.0/24,
and is approved and allowed the same way. See Docker, Synology,
Unraid and TrueNAS SCALE.
Stop sharing
sudo tiltas set --advertise-routes=Or switch the route off under the Device's Subnet routes: nothing reaches the LAN through it from then on. The Access rule stays until you remove it.
Good to know
- Only routes the Device offers can be approved. The console lists exactly what it offers.
- Two routers for one LAN: only one is needed. Approve the route on the Device you want to carry the traffic.
- The LAN sees the traffic as coming from the subnet router, not from your laptop, so devices on the LAN need no setting.
- The same subnet at both ends: if your laptop's own LAN is also
192.168.1.0/24, addresses there are ambiguous. Give the shared LAN another range on its router if that happens often.