Aching Notes

技术笔记、折腾记录和长期项目整理

rathole 内网穿透服务

注意事项

  1. 配置server和client的service名称时需要一样

Server端配置

1、server.toml配置

[server]
bind_addr = "0.0.0.0:62334"

[server.services.Win_Client_01]
type = "tcp"
bind_addr = "0.0.0.0:60981"
token = "<TOKEN_01>"

[server.services.Win_Client_02]
type = "tcp"
bind_addr = "0.0.0.0:60982"
token = "<TOKEN_02>"

[server.services.Win_Client_03]
type = "tcp"
bind_addr = "0.0.0.0:60983"
token = "<TOKEN_03>"

2、docker-server配置

services:
  rathole-server:
    image: rapiz1/rathole:latest
    container_name: rathole-server
    restart: unless-stopped
    command: ["--server", "/config/server.toml"]
    network_mode: host

    security_opt:
      - apparmor=unconfined
      - seccomp=unconfined

    volumes:
      - /data/docker/appdata/rathole-server:/config:ro

    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "5"

Client端配置

rathole client windows

1、client.toml配置

[client]
remote_addr = "your-server.example.com:62334"

[client.services.Win_Client_01]
type = "tcp"
local_addr = "127.0.0.1:3389"
token = "<TOKEN_01>"

[client.services.Win_Client_02]
type = "tcp"
local_addr = "127.0.0.1:3389"
token = "<TOKEN_02>"

[client.services.Win_Client_03]
type = "tcp"
local_addr = "127.0.0.1:3389"
token = "<TOKEN_03>"

2、docker-client配置

services:
  rathole-client:
    image: rapiz1/rathole:latest
    container_name: rathole-client
    restart: unless-stopped
    command: ["--client", "/config/client.toml"]
    network_mode: host

    security_opt:
      - apparmor=unconfined
      - seccomp=unconfined

    volumes:
      - /data/docker/appdata/rathole-client:/config:ro

    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "5"

3、windows-nssm配置

cd "C:Program Filesnssm-2.24win64"

# 删除旧服务
.nssm.exe remove rathole-RDP confirm

# 重新安装服务
.nssm.exe install rathole-RDP "D:ratholerathole.exe" "client.toml"

# 设置工作目录
.nssm.exe set rathole-RDP AppDirectory "D:rathole"

# 设置日志输出
.nssm.exe set rathole-RDP AppStdout "D:ratholerathole.out.log"
.nssm.exe set rathole-RDP AppStderr "D:ratholerathole.err.log"

# 设置异常自动重启
.nssm.exe set rathole-RDP AppExit Default Restart
.nssm.exe set rathole-RDP AppThrottle 1500


.nssm.exe remove rathole-SSH confirm

.nssm.exe install rathole-SSH "C:rathole-sshrathole.exe" "client.toml"
.nssm.exe set rathole-SSH AppDirectory "C:rathole-ssh"

.nssm.exe set rathole-SSH AppStdout "C:rathole-sshrathole.out.log"
.nssm.exe set rathole-SSH AppStderr "C:rathole-sshrathole.err.log"

.nssm.exe set rathole-SSH AppExit Default Restart
.nssm.exe set rathole-SSH AppThrottle 1500



.nssm.exe remove rathole-Client-VM confirm

# 重新安装服务
.nssm.exe install rathole-Client-VM "D:rathole-vmrathole.exe" "client.toml"

# 设置工作目录
.nssm.exe set rathole-Client-VM AppDirectory "D:rathole-vm"

# 设置日志输出
.nssm.exe set rathole-Client-VM AppStdout "D:rathole-vmrathole.out.log"
.nssm.exe set rathole-Client-VM AppStderr "D:rathole-vmrathole.err.log"

# 设置异常自动重启
.nssm.exe set rathole-Client-VM AppExit Default Restart
.nssm.exe set rathole-Client-VM AppThrottle 1500

# 启动服务
.nssm.exe start rathole-Client-VM

已发布

分类

来自

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注