使用gost进行ipv6的转发

论坛里涉及ipv6的转发比较少,且几乎是清一色iptables和ralm,由于某些纯v6的vps的ipv4不通github(
而且github的ipv6经常抽风连不上
所以只通过脚本一键安装gost是不太可行的

鸣谢:https://github.com/KANIKIG/Multi-EasyGost 的Gost脚本

我的SSH工具:finalshell VPS系统:Debian 12
使用中发现https://raw.githubusercontent.com 的连接是正常的,所以以下方法都是基于https://raw.githubusercontent.com 能够正常连接,并且你本地能正常连接github的情况

**1、运行 **
wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh && chmod +x gost.sh && ./gost.sh

#如果你的vps打不开https://raw.githubusercontent.com 的话,就请本地打开github上gost.sh脚本内容并在vps上创建gost.sh,然后复制粘贴就行了,脚本内容就在https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh 里面(

2、下载完gost.sh就会跳进脚本里(如下)

gost 一键安装配置脚本[1.1.1]

  1. 安装 gost
  2. 更新 gost
  3. 卸载 gost
    ————————————
  4. 启动 gost
  5. 停止 gost
  6. 重启 gost
    ————————————
  7. 新增gost转发配置
  8. 查看现有gost配置
  9. 删除一则gost配置
    ————————————
  10. gost定时重启配置
  11. 自定义TLS证书配置
    ————————————

请输入数字 [1-9]:

这时先点1安装,然后会让你选择源,记得选GitHub源(就是点n),然后就会卡在连接github上了,然后在上面找到gost文件的下载链接(然后Ctrl+C退出脚本,这个就不必多说了)

例如:若为国内机器建议使用大陆镜像加速下载
是否使用?[y/n]:n
--xxxx-xx-xx xx:xx:xx-- https://github.com/ginuerzh/gost/releases/download/v2.11.2/gost-linux-amd64-2.11.2.gz
Resolving github.com (github.com)... 20.27.177.113

3、然后从你自己的电脑上点开https://github.com/ginuerzh/gost/releases/download/v2.11.2/gost-linux-amd64-2.11.2.gz 下载下来并传到服务器上(没有finalshell的直接用ftp/sftp之类的工具即可),注意下载到/root文件夹(和你的gost.sh应该在一块)

4、点开/root下的gost.sh文件,没有编辑器的请移步Notepad++(

5、找到这一部分:

#check_new_ver
echo -e "若为国内机器建议使用大陆镜像加速下载"
read -e -p "是否使用?[y/n]:" addyn
[[ -z ${addyn} ]] && addyn="n"
if [[ ${addyn} == [Yy] ]]; then
rm -rf gost-linux-"$bit"-"$ct_new_ver".gz
wget --no-check-certificate https://gotunnel.oss-cn-shenzhen.aliyuncs.com/gost-linux-"$bit"-"$ct_new_ver".gz
gunzip gost-linux-"$bit"-"$ct_new_ver".gz
mv gost-linux-"$bit"-"$ct_new_ver" gost
mv gost /usr/bin/gost
chmod -R 777 /usr/bin/gost
wget --no-check-certificate https://gotunnel.oss-cn-shenzhen.aliyuncs.com/gost.service && chmod -R 777 gost.service && mv gost.service /usr/lib/systemd/system
mkdir /etc/gost && wget --no-check-certificate https://gotunnel.oss-cn-shenzhen.aliyuncs.com/config.json && mv config.json /etc/gost && chmod -R 777 /etc/gost
else

rm -rf gost-linux-"$bit"-"$ct_new_ver".gz
wget --no-check-certificate https://github.com/ginuerzh/gost/releases/download/v"$ct_new_ver"/gost-linux-"$bit"-"$ct_new_ver".gz

gunzip gost-linux-"$bit"-"$ct_new_ver".gz
mv gost-linux-"$bit"-"$ct_new_ver"  gost

mv gost /usr/bin/gost
chmod -R 777 /usr/bin/gost
wget --no-check-certificate https://gotunnel.oss-cn-shenzhen.aliyuncs.com/gost.service && chmod -R 777 gost.service && mv gost.service /usr/lib/systemd/system
mkdir /etc/gost && wget --no-check-certificate https://gotunnel.oss-cn-shenzhen.aliyuncs.com/config.json && mv config.json /etc/gost && chmod -R 777 /etc/gost
else

rm -rf gost-linux-"$bit"-"$ct_new_ver".gz
wget --no-check-certificate https://github.com/ginuerzh/gost/releases/download/v"$ct_new_ver"/gost-linux-"$bit"-"$ct_new_ver".gz

gunzip gost-linux-"$bit"-"$ct_new_ver".gz
mv gost-linux-"$bit"-"$ct_new_ver" gost
mv gost /usr/bin/gost
chmod -R 777 /usr/bin/gost
wget --no-check-certificate https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.service && chmod -R 777 gost.service && mv gost.service /usr/lib/systemd/system
mkdir /etc/gost && wget --no-check-certificate https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/config.json && mv config.json /etc/gost && chmod -R 777 /etc/gost

直接把我标加粗斜体删除线的去掉(看清楚缩进o) ac06 ,然后保存(记得要保存

6、记得不要再跑 

wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh && chmod +x gost.sh && ./gost.sh

 来进入gost脚本了,否则会覆盖你刚编辑的内容

7、运行 bash gost.sh 再进入脚本,直接点1安装gost,等到脚本跑完,就会提醒你gost安装成功了,那么我们的目的也就达到了。
ac04

附:
ipv6地址记得解析到域名,不然转发的时候可能不会报错,但是会转发不出去

#感谢paulchan的提醒,没有域名的话给ipv6地址加上[]