Skip to content

Instantly share code, notes, and snippets.

@yunyuyuan
Last active February 18, 2025 14:42
Show Gist options
  • Save yunyuyuan/b158014ef5779095245d19413b4791aa to your computer and use it in GitHub Desktop.
Save yunyuyuan/b158014ef5779095245d19413b4791aa to your computer and use it in GitHub Desktop.
stardust ipv6初始化

命令行脚本

scw instance server create type=STARDUST1-S zone=fr-par-1 image=arch_linux root-volume=l:10G name=v6instance ip=none ipv6=true project-id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx

基本初始化

  • 安装keyring:pacman -S archlinux-keyring
  • 全面更新系统:pacman -Syu
  • 安装vi并编辑DNS64:
pacman -S vi
vi /etc/resolve.conf
nameserver 2001:67c:2b0::4
nameserver 2001:67c:2b0::6
nameserver 2001:67c:27e4::64
nameserver 2001:67c:27e4::60
  • 安装一些基础包:pacman -S base-devel git vim
  • 新建用户:useradd --create-home yunyuyuan,改密:passwd yunyuyuan
  • 添加至sudoer:usermod -aG wheel yunyuyuanvisudo打开wheel
  • 临时git地址,vi /etc/hosts
2a01:4f8:c010:d56::2 github.com
2a01:4f8:c010:d56::3 api.github.com
2a01:4f8:c010:d56::4 codeload.github.com
2a01:4f8:c010:d56::5 objects.githubusercontent.com
  • su yunyuyuan切换到非sudo用户
  • 安装yay:
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

搭建v2ray

  • 安装配置v2ray
yay -S v2ray
sudo vim /etc/v2ray/config.json

{
  "inbounds": [
    {
      "port": 18686,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "b831381d-6324-4d53-ad4f-8cda48b30811"
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
        "path": "/wspath"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}

sudo systemctl enable --now v2ray
  • 安装配置cloudflared tunnel
yay -S cloudflared
cloudflared tunnel login
cloudflared tunnel create scaleway
cloudflared tunnel list
cloudflared tunnel route dns scaleway v2ray-sw-cf.yunyuyuan.net
vim ~/.cloudflared/config.yml

tunnel: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
credentials-file: /home/yunyuyuan/.cloudflared/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.json
ingress:
  - hostname: v2ray-sw-cf.yunyuyuan.net
    service: http://localhost:18686
  - service: http_status:404

cloudflared tunnel --edge-ip-version=6 run scaleway
@Laitr0n
Copy link

Laitr0n commented Feb 22, 2023

After editing the nameserver for DNS64, we should run /etc/rc.d/network restart to restart the network. This way, maybe we can avoid rebooting when starting clatd.

@yunyuyuan
Copy link
Author

不使用clatd,而是使用warp开启双栈貌似更好,但是如果开启的是全局模式,则会导致cloudflared tunnel无法使用。解决办法:改成双栈非全局,然后让v2ray outbount走warp接口就行了:

  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "outboundTag": "warp-out",
        "ip": ["0.0.0.0/0", "::/0"],
        "network": "tcp,udp"
      }
    ]
  },
  "outbounds": [
    {
      "tag": "warp-out",
      "protocol": "freedom",
      "settings": {},
      "streamSettings": {
        "sockopt": {
          "bindToDevice": "warp"
        }
      }
    },
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    }
  ]

优点是不影响vps本机的网络(例如cloudflared tunnel),缺点也是如此,本机可能无法访问一些网站,可能导致apt-get update或者yay -Syu无法成功执行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment