Reach a Home Service from Your Laptop
A service on a machine at home becomes a local port on your laptop, wherever the laptop is. The home machine opens no port and gets no public link: only machines of your account reach it.
Goal
On the laptop, curl http://127.0.0.1:18080/ reaches a web app on port 8080 of home-server, a machine at home.
Prerequisites
- The home machine (here
home-server) and the laptop, each with thenfltrCLI, each enrolled in your account once withnfltr config login. A machine's name in your account is the namenfltr machines listshows.
1. A service at home
On home-server, use your own service on any port. This tutorial serves one page on port 8080:
$ echo 'hello from home' > index.html
$ python3 -u -m http.server 8080
Serving HTTP on :: port 8080 (http://[::]:8080/) ...
2. Serve it
On home-server, in a second terminal, serve port 8080 as the service web:
$ nfltr cat serve web --forward localhost:8080
Connected — waiting for requests... (press Ctrl+C to stop)
SERVICE TYPE AGENT ACCESS NOTE
web tcp home-server/web nfltr cat forward home-server/web --listen 127.0.0.1:<local-port> the relay can read this
It runs until you stop it. It opens no port: it holds one connection out to the relay, and dials localhost:8080 only for a session that comes from a machine of your account.
3. Connect from the laptop
On the laptop, nfltr cat forward turns the service into a local port. Another machine names it <machine>.<agent>/<service>, and the agent is the serving machine's name:
$ nfltr cat forward home-server.home-server/web --listen 127.0.0.1:18080
connect forward: listening -> home-server.home-server/web on 127.0.0.1:18080
$ curl -s http://127.0.0.1:18080/
hello from home
A browser, ssh, psql or any TCP client uses the local port the same way. The port stays open while home-server is offline; a connection made then is closed at once, and the next one after it is back goes through.
This session goes through the relay, which can read it (the table's note says so). To keep the relay out of it, put both machines in an organisation and serve with --allow-group: the session is then end to end encrypted between the two machines.
4. Clean up
Press Ctrl+C in the nfltr cat forward terminal on the laptop, then in the nfltr cat serve terminal on home-server, then stop the web server.
# Ctrl+C in the nfltr cat forward terminal
# Ctrl+C in the nfltr cat serve terminal
Next
- Give a friend an address: someone without an account reaches the same service.
- An organisation with two machines: sessions end to end encrypted between your machines.
- Reach a private LAN: other hosts on the home network, through one machine on it.