You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/post/2025/04-29-rathole-traefik-home-server/_resources/index-devto.md
+6-65Lines changed: 6 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ Another point is that, with option 2, we avoid the gap of unencrypted traffic on
23
23
24
24
The downside is that Rathole will exclusively occupy ports `80` and `443` on the VPS, preventing any other process from using them. We won't be able to run other web servers on that VPS, so it's best to use a small one dedicated to this purpose.
25
25
26
+
Unless we use a load balancer [Load balancing multiple Rathole tunnels with Traefik HTTP and TCP routers](https://nemanjamitic.com/blog/2025-05-29-traefik-load-balancer).
@@ -60,7 +62,7 @@ docker run -it --rm rapiz1/rathole --genkey
60
62
61
63
Then we define two tunnels: one for HTTP and another for HTTPS. For the HTTP tunnel, we define the name `server.services.traefik-http`, set the value for `token`, and choose port `5080`, and again we bind it to all container interfaces with `0.0.0.0`. Similarly, for HTTPS, we set the name to `server.services.traefik-https`, provide a `token` value, and choose port `5443`.
62
64
63
-
An important note is that, aside from a different name, a different token value is sufficient to create another tunnel (Rathole service). This practically means we can use a single Rathole server container to expose multiple home servers (Rathole clients) on the same ports `5080` and `5443`, which is pretty convenient.
65
+
Every tunnel has to have a unique name, token value, and port. With that fulfilled, a single Rathole server instance can have as many Rathole clients as needed, which is pretty convenient. For example, besides the existing home server on ports `5080` and `5443`, we can expose another one using ports `5081` and `5444`.
64
66
65
67
Token is just a random base64 string, we generate it by running this:
66
68
@@ -258,70 +260,9 @@ docker compose -f docker-compose.local.yml up -d
258
260
259
261
## Exposing multiple servers
260
262
261
-
Fortunately, Rathole makes it trivial to run multiple tunnels using a single Rathole server. We don't need to open any additional ports or run multiple container instances. We just use a different tunnel name, e.g., `server.services.traefik-http`, and the value for the `token` for each tunnel/service. That's it.
262
-
263
-
**Rathole server:**
264
-
265
-
Rathole server configuration file example [rathole.server.toml](https://github.com/nemanjam/rathole-server/blob/5226ff53992abe930302098677a570151ebff927/rathole.server.toml):
266
-
267
-
```toml
268
-
[server]
269
-
bind_addr = "0.0.0.0:2333"
270
-
271
-
[server.transport]
272
-
type = "noise"
273
-
274
-
[server.transport.noise]
275
-
local_private_key = "private_key"
276
-
277
-
# separated based on token, use the same ports
278
-
279
-
# home server 1 - local
280
-
[server.services.traefik-http]
281
-
token = "secret_token_1"
282
-
bind_addr = "0.0.0.0:5080"
283
-
284
-
[server.services.traefik-https]
285
-
token = "secret_token_1"
286
-
bind_addr = "0.0.0.0:5443"
287
-
288
-
# home server 2 - pi
289
-
[server.services.pi-traefik-http]
290
-
token = "secret_token_2"
291
-
bind_addr = "0.0.0.0:5080"
292
-
293
-
[server.services.pi-traefik-https]
294
-
token = "secret_token_2"
295
-
bind_addr = "0.0.0.0:5443"
296
-
```
297
-
298
-
In the code above I use this Rathole server to connect a two Rathole client home servers `traefik-http` and `pi-traefik-http` for HTTP tunnels, and `traefik-https` and `pi-traefik-https` for HTTPS tunnels.
299
-
300
-
**Rathole client:**
263
+
Fortunately, Rathole makes it trivial to run multiple tunnels using a single Rathole server. We don't need to open any additional ports in the firewall or run multiple container instances. What we do need are different tunnel names, token values, and ports. Those must be unique for each tunnel/service. Also, you will need a load balancer to bind ports `80` and `443` to more than one destination port, respectively.
301
264
302
-
On the each Rathole client you just specify which tunnels you are using. For example, on the "pi" home server you will use just its HTTP/HTTPS par and omit the other ones, [core/rathole.client.toml.example](https://github.com/nemanjam/traefik-proxy/blob/e8fece09e31ec99ddd21559f343d0ddea9fb55bf/core/rathole.client.toml.example):
303
-
304
-
```toml
305
-
# core/rathole.client.toml.example
306
-
307
-
[client]
308
-
remote_addr = "123.123.123.123:2333"
309
-
310
-
[client.transport]
311
-
type = "noise"
312
-
313
-
[client.transport.noise]
314
-
remote_public_key = "public_key"
315
-
316
-
# pi
317
-
[client.services.pi-traefik-http]
318
-
token = "secret_token_2"
319
-
local_addr = "traefik:80"
320
-
321
-
[client.services.pi-traefik-https]
322
-
token = "secret_token_2"
323
-
local_addr = "traefik:443"
324
-
```
265
+
I wrote a detailed tutorial on how to expose multiple home servers using a single Rathole server. You can read it here: [Load balancing multiple Rathole tunnels with Traefik HTTP and TCP routers](/blog/2025-05-29-traefik-load-balancer).
325
266
326
267
## Open the firewall on the VPS
327
268
@@ -336,7 +277,7 @@ Like for any webserver, on the VPS you will need to open ports `80` and `443` to
336
277
337
278
## Conclusion
338
279
339
-
Most consumer-grade internet connections are behind a CGNAT. This setup allows you to bypass CGNAT and host an unlimited number of websites from your home almost for free. You can use it for web servers in virtual machines, LXC containers, SBC computers, etc. - anywhere you can run Docker.
280
+
Most consumer-grade internet connections are behind a CGNAT. This setup allows you to bypass CGNAT and host an unlimited number of websites on your home server almost for free. You can use it for web servers in virtual machines, LXC containers, SBC computers, etc. - anywhere you can run Docker.
340
281
341
282
It is simple, cheap, and you can set it up in 30 minutes. Like anything, it also has some downsides, one of them is the overhead latency caused by an additional network hop between the VPS and your home network, but it's a reasonable tradeoff.
Copy file name to clipboardExpand all lines: src/content/post/2025/04-29-rathole-traefik-home-server/_resources/index-hashnode.md
+6-65Lines changed: 6 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ Another point is that, with option 2, we avoid the gap of unencrypted traffic on
23
23
24
24
The downside is that Rathole will exclusively occupy ports `80` and `443` on the VPS, preventing any other process from using them. We won't be able to run other web servers on that VPS, so it's best to use a small one dedicated to this purpose.
25
25
26
+
Unless we use a load balancer [Load balancing multiple Rathole tunnels with Traefik HTTP and TCP routers](https://nemanjamitic.com/blog/2025-05-29-traefik-load-balancer).
@@ -60,7 +62,7 @@ docker run -it --rm rapiz1/rathole --genkey
60
62
61
63
Then we define two tunnels: one for HTTP and another for HTTPS. For the HTTP tunnel, we define the name `server.services.traefik-http`, set the value for `token`, and choose port `5080`, and again we bind it to all container interfaces with `0.0.0.0`. Similarly, for HTTPS, we set the name to `server.services.traefik-https`, provide a `token` value, and choose port `5443`.
62
64
63
-
An important note is that, aside from a different name, a different token value is sufficient to create another tunnel (Rathole service). This practically means we can use a single Rathole server container to expose multiple home servers (Rathole clients) on the same ports `5080` and `5443`, which is pretty convenient.
65
+
Every tunnel has to have a unique name, token value, and port. With that fulfilled, a single Rathole server instance can have as many Rathole clients as needed, which is pretty convenient. For example, besides the existing home server on ports `5080` and `5443`, we can expose another one using ports `5081` and `5444`.
64
66
65
67
Token is just a random base64 string, we generate it by running this:
66
68
@@ -258,70 +260,9 @@ docker compose -f docker-compose.local.yml up -d
258
260
259
261
## Exposing multiple servers
260
262
261
-
Fortunately, Rathole makes it trivial to run multiple tunnels using a single Rathole server. We don't need to open any additional ports or run multiple container instances. We just use a different tunnel name, e.g., `server.services.traefik-http`, and the value for the `token` for each tunnel/service. That's it.
262
-
263
-
**Rathole server:**
264
-
265
-
Rathole server configuration file example [rathole.server.toml](https://github.com/nemanjam/rathole-server/blob/5226ff53992abe930302098677a570151ebff927/rathole.server.toml):
266
-
267
-
```toml
268
-
[server]
269
-
bind_addr = "0.0.0.0:2333"
270
-
271
-
[server.transport]
272
-
type = "noise"
273
-
274
-
[server.transport.noise]
275
-
local_private_key = "private_key"
276
-
277
-
# separated based on token, use the same ports
278
-
279
-
# home server 1 - local
280
-
[server.services.traefik-http]
281
-
token = "secret_token_1"
282
-
bind_addr = "0.0.0.0:5080"
283
-
284
-
[server.services.traefik-https]
285
-
token = "secret_token_1"
286
-
bind_addr = "0.0.0.0:5443"
287
-
288
-
# home server 2 - pi
289
-
[server.services.pi-traefik-http]
290
-
token = "secret_token_2"
291
-
bind_addr = "0.0.0.0:5080"
292
-
293
-
[server.services.pi-traefik-https]
294
-
token = "secret_token_2"
295
-
bind_addr = "0.0.0.0:5443"
296
-
```
297
-
298
-
In the code above I use this Rathole server to connect a two Rathole client home servers `traefik-http` and `pi-traefik-http` for HTTP tunnels, and `traefik-https` and `pi-traefik-https` for HTTPS tunnels.
299
-
300
-
**Rathole client:**
263
+
Fortunately, Rathole makes it trivial to run multiple tunnels using a single Rathole server. We don't need to open any additional ports in the firewall or run multiple container instances. What we do need are different tunnel names, token values, and ports. Those must be unique for each tunnel/service. Also, you will need a load balancer to bind ports `80` and `443` to more than one destination port, respectively.
301
264
302
-
On the each Rathole client you just specify which tunnels you are using. For example, on the "pi" home server you will use just its HTTP/HTTPS par and omit the other ones, [core/rathole.client.toml.example](https://github.com/nemanjam/traefik-proxy/blob/e8fece09e31ec99ddd21559f343d0ddea9fb55bf/core/rathole.client.toml.example):
303
-
304
-
```toml
305
-
# core/rathole.client.toml.example
306
-
307
-
[client]
308
-
remote_addr = "123.123.123.123:2333"
309
-
310
-
[client.transport]
311
-
type = "noise"
312
-
313
-
[client.transport.noise]
314
-
remote_public_key = "public_key"
315
-
316
-
# pi
317
-
[client.services.pi-traefik-http]
318
-
token = "secret_token_2"
319
-
local_addr = "traefik:80"
320
-
321
-
[client.services.pi-traefik-https]
322
-
token = "secret_token_2"
323
-
local_addr = "traefik:443"
324
-
```
265
+
I wrote a detailed tutorial on how to expose multiple home servers using a single Rathole server. You can read it here: [Load balancing multiple Rathole tunnels with Traefik HTTP and TCP routers](/blog/2025-05-29-traefik-load-balancer).
325
266
326
267
## Open the firewall on the VPS
327
268
@@ -336,7 +277,7 @@ Like for any webserver, on the VPS you will need to open ports `80` and `443` to
336
277
337
278
## Conclusion
338
279
339
-
Most consumer-grade internet connections are behind a CGNAT. This setup allows you to bypass CGNAT and host an unlimited number of websites from your home almost for free. You can use it for web servers in virtual machines, LXC containers, SBC computers, etc. - anywhere you can run Docker.
280
+
Most consumer-grade internet connections are behind a CGNAT. This setup allows you to bypass CGNAT and host an unlimited number of websites on your home server almost for free. You can use it for web servers in virtual machines, LXC containers, SBC computers, etc. - anywhere you can run Docker.
340
281
341
282
It is simple, cheap, and you can set it up in 30 minutes. Like anything, it also has some downsides, one of them is the overhead latency caused by an additional network hop between the VPS and your home network, but it's a reasonable tradeoff.
Copy file name to clipboardExpand all lines: src/content/post/2025/04-29-rathole-traefik-home-server/index.mdx
+6-63Lines changed: 6 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,8 @@ Another point is that, with option 2, we avoid the gap of unencrypted traffic on
48
48
49
49
The downside is that Rathole will exclusively occupy ports `80` and `443` on the VPS, preventing any other process from using them. We won't be able to run other web servers on that VPS, so it's best to use a small one dedicated to this purpose.
50
50
51
+
Unless we use a load balancer [Load balancing multiple Rathole tunnels with Traefik HTTP and TCP routers](/blog/2025-05-29-traefik-load-balancer).
@@ -84,7 +86,7 @@ docker run -it --rm rapiz1/rathole --genkey
84
86
85
87
Then we define two tunnels: one for HTTP and another for HTTPS. For the HTTP tunnel, we define the name `server.services.traefik-http`, set the value for `token`, and choose port `5080`, and again we bind it to all container interfaces with `0.0.0.0`. Similarly, for HTTPS, we set the name to `server.services.traefik-https`, provide a `token` value, and choose port `5443`.
86
88
87
-
An important note is that, aside from a different name, a different token value is sufficient to create another tunnel (Rathole service). This practically means we can use a single Rathole server container to expose multiple home servers (Rathole clients) on the same ports `5080` and `5443`, which is pretty convenient.
89
+
Every tunnel has to have a unique name, token value, and port. With that fulfilled, a single Rathole server instance can have as many Rathole clients as needed, which is pretty convenient. For example, besides the existing home server on ports `5080` and `5443`, we can expose another one using ports `5081` and `5444`.
88
90
89
91
Token is just a random base64 string, we generate it by running this:
90
92
@@ -277,68 +279,9 @@ docker compose -f docker-compose.local.yml up -d
277
279
278
280
## Exposing multiple servers
279
281
280
-
Fortunately, Rathole makes it trivial to run multiple tunnels using a single Rathole server. We don't need to open any additional ports or run multiple container instances. We just use a different tunnel name, e.g., `server.services.traefik-http`, and the value for the `token` for each tunnel/service. That's it.
281
-
282
-
**Rathole server:**
283
-
284
-
Rathole server configuration file example [rathole.server.toml](https://github.com/nemanjam/rathole-server/blob/5226ff53992abe930302098677a570151ebff927/rathole.server.toml):
285
-
286
-
```toml title="rathole.server.toml"
287
-
[server]
288
-
bind_addr = "0.0.0.0:2333"
289
-
290
-
[server.transport]
291
-
type = "noise"
292
-
293
-
[server.transport.noise]
294
-
local_private_key = "private_key"
295
-
296
-
# separated based on token, use the same ports
297
-
298
-
# home server 1 - local
299
-
[server.services.traefik-http]
300
-
token = "secret_token_1"
301
-
bind_addr = "0.0.0.0:5080"
302
-
303
-
[server.services.traefik-https]
304
-
token = "secret_token_1"
305
-
bind_addr = "0.0.0.0:5443"
282
+
Fortunately, Rathole makes it trivial to run multiple tunnels using a single Rathole server. We don't need to open any additional ports in the firewall or run multiple container instances. What we do need are different tunnel names, token values, and ports. Those must be unique for each tunnel/service. Also, you will need a load balancer to bind ports `80` and `443` to more than one destination port, respectively.
306
283
307
-
# home server 2 - pi
308
-
[server.services.pi-traefik-http]
309
-
token = "secret_token_2"
310
-
bind_addr = "0.0.0.0:5080"
311
-
312
-
[server.services.pi-traefik-https]
313
-
token = "secret_token_2"
314
-
bind_addr = "0.0.0.0:5443"
315
-
```
316
-
317
-
In the code above I use this Rathole server to connect a two Rathole client home servers `traefik-http` and `pi-traefik-http` for HTTP tunnels, and `traefik-https` and `pi-traefik-https` for HTTPS tunnels.
318
-
319
-
**Rathole client:**
320
-
321
-
On the each Rathole client you just specify which tunnels you are using. For example, on the "pi" home server you will use just its HTTP/HTTPS par and omit the other ones, [core/rathole.client.toml.example](https://github.com/nemanjam/traefik-proxy/blob/e8fece09e31ec99ddd21559f343d0ddea9fb55bf/core/rathole.client.toml.example):
322
-
323
-
```toml title="core/rathole.client.toml.example"
324
-
[client]
325
-
remote_addr = "123.123.123.123:2333"
326
-
327
-
[client.transport]
328
-
type = "noise"
329
-
330
-
[client.transport.noise]
331
-
remote_public_key = "public_key"
332
-
333
-
# pi
334
-
[client.services.pi-traefik-http]
335
-
token = "secret_token_2"
336
-
local_addr = "traefik:80"
337
-
338
-
[client.services.pi-traefik-https]
339
-
token = "secret_token_2"
340
-
local_addr = "traefik:443"
341
-
```
284
+
I wrote a detailed tutorial on how to expose multiple home servers using a single Rathole server. You can read it here: [Load balancing multiple Rathole tunnels with Traefik HTTP and TCP routers](/blog/2025-05-29-traefik-load-balancer).
342
285
343
286
## Open the firewall on the VPS
344
287
@@ -353,7 +296,7 @@ Like for any webserver, on the VPS you will need to open ports `80` and `443` to
353
296
354
297
## Conclusion
355
298
356
-
Most consumer-grade internet connections are behind a CGNAT. This setup allows you to bypass CGNAT and host an unlimited number of websites from your home almost for free. You can use it for web servers in virtual machines, LXC containers, SBC computers, etc. - anywhere you can run Docker.
299
+
Most consumer-grade internet connections are behind a CGNAT. This setup allows you to bypass CGNAT and host an unlimited number of websites on your home server almost for free. You can use it for web servers in virtual machines, LXC containers, SBC computers, etc. - anywhere you can run Docker.
357
300
358
301
It is simple, cheap, and you can set it up in 30 minutes. Like anything, it also has some downsides, one of them is the overhead latency caused by an additional network hop between the VPS and your home network, but it's a reasonable tradeoff.
0 commit comments