Gost 端口转发教程

vps.dance 2021-10-11 2023-11-08 3579℃

Gost介绍

Gost是GO语言开发的隧道工具, GitHub主页.
支持: 端口转发、支持http/socks/ss/SNI代理、负载均衡、DNS代理.

安装Gost

可通过Vkit 安装, 安装的版本号为最新的Gost.

Gost 命令行 转发

  • TCP转发: gost -L=tcp://:123/test.com:456 本机 123 端口, 转发到 test.com 的 456 端口
  • UDP转发: gost -L=udp://:111/8.8.8.8:222 本机 111 端口, 转发到 8.8.8.8 的 222 端口

创建 Gost开机自启服务

  • 创建Gost配置文件, 新建 /root/gost.json, 内容类似:

    {
     "Debug": true,
     "Retries": 0,
     "ServeNodes": [
    "tcp://:123/test.com:456",
    "tcp://:111/8.8.8.8:222",
     ]
    }
  • Gost开机自启动

    echo -e '[Unit]nDescription=gostnAfter=network-online.targetnWants=network-online.target systemd-networkd-wait-online.servicen[Service]nType=simplenUser=rootnRestart=on-failurenRestartSec=5snExecStart=/usr/bin/gost -C /root/gost.jsonn[Install]nWantedBy=multi-user.target' > /etc/systemd/system/gost.service;
    systemctl daemon-reload;
    systemctl enable gost;

    启动服务: systemctl restart gost, 这样以后重启也自动启动gost了.

Realm和Gost比较

  • Realm比Gost占用资源更小
  • Gost功能比Realm多些(支持隧道协议)
  • IPv6转发 Realm2和Gost 都支持
    Realm介绍
标签: Gost, 转发

非特殊说明, 所有文章均为原创.