Skip to content

Instantly share code, notes, and snippets.

@asac
Created July 22, 2020 15:34
Show Gist options
  • Save asac/6ba791ed83188c2cfa9f3eb55950898c to your computer and use it in GitHub Desktop.
Save asac/6ba791ed83188c2cfa9f3eb55950898c to your computer and use it in GitHub Desktop.
cat wg.sh
#!/bin/sh
# in cloudflare
echo 1 > /proc/sys/net/ipv4/ip_forward
# get wgcf
wget -O /usr/local/bin/wgcf \
https://github.com/ViRb3/wgcf/releases/download/v1.0.6/wgcf_1.0.6_linux_armv7
chmod a+x /usr/local/bin/wgcf
# get tools
apk add wireguard-tools \
iptables \
ip6tables
# enable
mkdir -p /etc/wireguard
wgcf register \
--accept-tos \
--config /etc/wireguard/wgcf-account.toml
# generate config
wgcf generate \
--config /etc/wireguard/wgcf-account.toml \
--profile /etc/wireguard/wg0.conf
# modules
modprobe -v xt_addrtype
modprobe -v xt_comment
modprobe -v xt_mark
modprobe -v xt_connmark
# up
wg-quick up wg0
wgcf trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment