本文介绍通过代理的方式,即使身在目标服务区域之外,提供访问LLM的入门方案。
在LLM服务区申请vps搭建代理服务器 在美西申请一台龟壳云服务器(Ubuntu 24.04.4 LTS)
安装代理服务 $sudo apt update && sudo apt upgrade -y $bash <(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh) install $xray --version Xray 26.3.27 (Xray, Penetrates Everything.) d2758a0 (go1.26.1 linux/amd64) 配置 $xray uuid f1a2b3c4-5d6e-7f8a-9b0c-1d2e3f4a5b6c $xray x25519 Private key: yLTMMfcsJJ3Fh4t_Pjf777iDhCYx0-PSmksmKBrpRAI Public key: IGoeCjQm24_wA9M0N3WMVV3ze8NKXb_Yv7CEU_HKMwQ $openssl rand -hex 8 0123456789abcdef /usr/local/etc/xray/config.json
{ "log": { "loglevel": "warning" }, "inbounds": [ { "port": 443, "protocol": "vless", "settings": { "clients": [ { "id": "你的UUID", "flow": "xtls-rprx-vision" } ], "decryption": "none" }, "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "show": false, "dest": "www.
安装 $lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal sudo apt install wireguard wireguard-dkms -y wget algo/configs/localhost/wireguard/desktop.conf /etc/wireguard/wg0.conf sudo modprobe wireguard sudo ln -s /usr/bin/resolvectl /usr/local/bin/resolvconf sudo wg-quick up wg0
在公有云厂商的新加坡或香港地区免费申请一台免费云主机(可选) 利用terraform创建一台云主机
git clone
[email protected]:wubigo/iaas.git cd iaas\aws\ec2 .\apply Apply complete! Resources: 2 added, 0 changed, 0 destroyed. Outputs: instance_id = i-069i247af71871dd9 public_ip = 13.113.195.66 ssh
[email protected] ubuntu@ip-10-12-0-247:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal 也可以直接在web控制台根据向导创建
设置安全组 https://wubigo.com/post/vpn-with-wireguard/
stop ubuntu pop-up “Daemons using outdated libraries” when using apt /etc/needrestart/needrestart.conf
$nrconf{restart} = 'a' 搭建隧道服务器(定制的端口) git clone https://github.com/wubigo/algo.git sudo apt update git clone https://github.
git clone https://git.zx2c4.com/wireguard-go
install client pip install shadowsocks client.json
{ "server":"server-ip", "server_port":8000, "local_port":3050, "password":"your-password", "timeout":600, "method":"aes-256-cfb" } { "server":"your_server_ip", #ss服务器IP "server_port":your_server_port, #端口 "local_address": "127.0.0.1", #本地ip "local_port":1080, #本地端口 "password":"your_server_passwd",#连接ss密码 "timeout":300, #等待超时 "method":"rc4-md5", #加密方式 "fast_open": false, # true 或 false。如果你的服务器 Linux 内核在3.7+,可以开启 fast_open 以降低延迟。开启方法: echo 3 > /proc/sys/net/ipv4/tcp_fastopen 开启之后,将 fast_open 的配置设置为 true 即可 "workers": 1 # 工作线程数 } sudo apt-get install privoxy /etc/privoxy/config
listen-address 127.0.0.1:8118 forward-socks5 / 127.0.0.1:1080 . systemctl restart privoxy.
VPC之间的连接方式 专线
VPN托管服务
VPN Peering
自建或第三方VPN
PrivateLink
VPC与私有网络之间的连接方式 VPN托管服务
专线
专线+VPN
自建或第三方VPN
Transit VPC
VPN Hub
安装 sudo add-apt-repository ppa:wireguard/wireguard sudo apt-get update sudo apt-get install wireguard -y 打开安全组 南向Inbound rules(udp:51820)
配置 创建key
wg genkey | tee privatekey | wg pubkey > publickey private_key=$(wg genkey) public_key=$(echo $private_key | wg pubkey) 配置
ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP group default qlen 1000 link/ether 0a:81:39:72:97:90 brd ff:ff:ff:ff:ff:ff inet 10.
how-to-allow-local-network-when-using-wireguard-vpn-tunnel 允许非隧道流量
Open the WireGaurd Windows client. In the left pane, select the tunnel that you want local network routing to work, if you have more than one tunnel. Hit the Edit button. Uncheck Block untunneled traffic (kill-switch) option 增加本地的网络
AllowedIPs = 192.168.0.0/16, 0.0.0.0/1, 128.0.0.0/1, ::/1, 8000::/1 安装 https://download.wireguard.com/windows-client/wireguard-amd64-0.0.38.msi
配置 更改公钥
Endpoint所在的vpn服务器地址
https://github.com/Nyr/openvpn-install
https://github.com/hwdsl2/setup-ipsec-vpn
https://wireguard.isystem.io/
https://github.com/meshbird/meshbird
https://www.tinc-vpn.org/
https://github.com/isystem-io/wireguard-aws
Download and install the TunSafe, which is a Wireguard client for Windows.
安装客户端 sudo apt-get install m2crypto pip install shadowsocks /etc/shadowsocks.json
{ "server":"4.1.33.104", "server_port":8388, "local_address": "127.0.0.1", "local_port":1080, "password":"", "timeout":600, "method":"aes-256-cfb" } sslocal -c /etc/shadowsocks.json # To run in the background sudo sslocal -c /etc/shadowsocks.json -d start 配置代理 sudo apt-get install polipo /etc/polipo/config
logSyslog = true logFile = /var/log/polipo/polipo.log logSyslog = true logFile = /var/log/polipo/polipo.log proxyAddress = "0.0.0.0" socksParentProxy = "127.0.0.1:1080" socksProxyType = socks5 chunkHighMark = 50331648 objectHighMark = 16384 serverMaxSlots = 64 serverSlots = 16 serverSlots1 = 32 sudo service polipo stop sudo service polipo start export http_proxy=http://127.