Skip to content

Commit 4dd278c

Browse files
committed
updated Rathole tunnel article, Hashnode and Dev.to too, checked grammar
1 parent 36bc7fb commit 4dd278c

File tree

3 files changed

+18
-193
lines changed

3 files changed

+18
-193
lines changed

src/content/post/2025/04-29-rathole-traefik-home-server/_resources/index-devto.md

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Another point is that, with option 2, we avoid the gap of unencrypted traffic on
2323

2424
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.
2525

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).
27+
2628
![Rathole Traefik architecture diagram](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9s3u4wfhv5f2c6q8vs9m.png)
2729

2830
## Rathole server
@@ -60,7 +62,7 @@ docker run -it --rm rapiz1/rathole --genkey
6062

6163
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`.
6264

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`.
6466

6567
Token is just a random base64 string, we generate it by running this:
6668

@@ -258,70 +260,9 @@ docker compose -f docker-compose.local.yml up -d
258260

259261
## Exposing multiple servers
260262

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.
301264

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).
325266

326267
## Open the firewall on the VPS
327268

@@ -336,7 +277,7 @@ Like for any webserver, on the VPS you will need to open ports `80` and `443` to
336277

337278
## Conclusion
338279

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.
340281

341282
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.
342283

src/content/post/2025/04-29-rathole-traefik-home-server/_resources/index-hashnode.md

Lines changed: 6 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Another point is that, with option 2, we avoid the gap of unencrypted traffic on
2323

2424
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.
2525

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).
27+
2628
![Rathole Traefik architecture diagram](https://cdn.hashnode.com/res/hashnode/image/upload/v1746081593116/c38bd46b-e179-468c-9180-d587506b348b.png align="center")
2729

2830
## Rathole server
@@ -60,7 +62,7 @@ docker run -it --rm rapiz1/rathole --genkey
6062

6163
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`.
6264

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`.
6466

6567
Token is just a random base64 string, we generate it by running this:
6668

@@ -258,70 +260,9 @@ docker compose -f docker-compose.local.yml up -d
258260

259261
## Exposing multiple servers
260262

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.
301264

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).
325266

326267
## Open the firewall on the VPS
327268

@@ -336,7 +277,7 @@ Like for any webserver, on the VPS you will need to open ports `80` and `443` to
336277

337278
## Conclusion
338279

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.
340281

341282
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.
342283

src/content/post/2025/04-29-rathole-traefik-home-server/index.mdx

Lines changed: 6 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Another point is that, with option 2, we avoid the gap of unencrypted traffic on
4848

4949
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.
5050

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).
52+
5153
<Image {...IMAGE_SIZES.FIXED.MDX_MD} src={RatholeTraefikArchitectureImage} alt="Rathole Traefik architecture diagram" />
5254

5355
## Rathole server
@@ -84,7 +86,7 @@ docker run -it --rm rapiz1/rathole --genkey
8486

8587
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`.
8688

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`.
8890

8991
Token is just a random base64 string, we generate it by running this:
9092

@@ -277,68 +279,9 @@ docker compose -f docker-compose.local.yml up -d
277279

278280
## Exposing multiple servers
279281

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.
306283

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).
342285

343286
## Open the firewall on the VPS
344287

@@ -353,7 +296,7 @@ Like for any webserver, on the VPS you will need to open ports `80` and `443` to
353296

354297
## Conclusion
355298

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.
357300

358301
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.
359302

0 commit comments

Comments
 (0)