API创建Scaleway Stardust IPv6 VPS

发布于 2022-11-28  1,606 次阅读


创建账号

官网https://console.scaleway.com/,需绑定信用卡之后可以开通Stardust星尘VPS。如果想开通其他如CPU、GPU独服等,还需上传身份信息。

添加SSH Key

去其他Linux vps上,在root目录输入ssh-keygen根据提示创建ssh key。

进入/root/.ssh/目录,将id_rsa和id_rsa.pub保存下来,打开id_rsa.pub,将其中文本复制 ,并填入Scaleway账户Credentials的SSH Keys中(点击add a new SSH key)。

API创建vps

Scaleway命令行cli

从github下载Scaleway命令行cli程序:https://github.com/scaleway/scaleway-cli/releases/

Windows下建议直接重命名为scw.exe,进入scw.exe目录。

先初始化,并根据提示登录:

scw.exe init

创建Scaleway Stardust VPS

scw instance server create type=STARDUST1-S zone=fr-par-1 image=debian_buster root-volume=l:10G name=aa-1 ip=none ipv6=true project-id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
type= VPS的型号,scaleway就是STARDUST1-S,不用修改
 
zone= VPS的地区,fr-par-1指的是巴黎,nl-ams-1指的是阿姆斯特丹
 
image= VPS的系统,比如你要debian10就选择 debian_buster 你要ubuntu16就选择ubuntu_xenial 要centos7就填centos_7.6
 
root-volume= VPS的硬盘大小,数值l:10G就是创建1个名为local的10G硬盘,不用修改
 
name= VPS的名称
 
ip=  ipv6= 开启/关闭ipv4和ipv6,如果不开Ipv4只开IPv6就是ip=none ipv6=true
 
project-id= 即初始化时,CMD中出现的default_project_id

BAT循环开机

创建好后,可能会因为没有available资源,遇到无法开机的情况。可创建bat文件循环开机。

@echo off
:scw
scw instance server start xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx
timeout /T 10 /NOBREAK
goto scw
echo. 
exit

开机之后在Instances-Security Groups中设置入站出站规则。

修改DNS访问IPV4资源

nano /etc/resolv.conf 
#修改nameserver后的地址
#荷兰 2a03:7900:2:0:31:3:104:161
#荷兰 2a00:1098:2b::1
#德国 2a01:4f8:c2c:123f::1
#英国 2a00:1098:2c::1

WGCF WARP添加IPv4网络

开启服务器的tun模块

modprobe tun 
lsmod | grep tun

安装wireguard客户端

apt install net-tools iproute2 openresolv dnsutils -y
apt install wireguard-tools --no-install-recommends
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable
apt-get update
apt -t $(lsb_release -sc)-backports install linux-image-$(dpkg --print-architecture) linux-headers-$(dpkg --print-architecture) --install-recommends -y
apt-get install wireguard-dkms wireguard-tools
 
reboot

安装WGCF (Cross-platform, unofficial CLI for Cloudflare Warp)

curl -fsSL git.io/wgcf.sh | sudo bash
wgcf register
wgcf generate
 
上述命令若执行成功,当前目录会生成wgcf-account.toml和wgcf-profile.conf两个文件。如果没生成,反复执行上述第二三条命令。
如果第一步卡住,请先添加dns64。
将engage.cloudflareclient.com替换为[2606:4700:d0::a29f:c001]
注释掉 AllowedIPs = ::/0 
DNS = 1.1.1.1替换为DNS = 2606:4700:4700::1111

编辑wgcf.conf

cp wgcf-profile.conf /etc/wireguard/wgcf.conf
wg-quick up wgcf
curl https://1.1.1.1
如有返回值,代表ipv4已添加成功

设置开启自启动

crontab -e
@reboot systemctl start wg-quick@wgcf 

Love is merely a madness.