Skip to content

Instantly share code, notes, and snippets.

@TrueCarry
Last active March 27, 2022 11:06
Show Gist options
  • Save TrueCarry/c8adc9aa96892a421acbbfbdbba64f42 to your computer and use it in GitHub Desktop.
Save TrueCarry/c8adc9aa96892a421acbbfbdbba64f42 to your computer and use it in GitHub Desktop.
Subspace
apt-get update
apt-get install -y wireguard curl ca-certificates
curl https://get.docker.com | bash
# Remove dnsmasq because it will run inside the container.
apt-get remove -y dnsmasq
# Disable systemd-resolved listener if it blocks port 53.
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
systemctl restart systemd-resolved
# Set Cloudfare DNS server.
echo nameserver 1.1.1.1 > /etc/resolv.conf
echo nameserver 1.0.0.1 >> /etc/resolv.conf
# Load modules.
modprobe wireguard
modprobe iptable_nat
modprobe ip6table_nat
# Enable modules when rebooting.
echo "wireguard" > /etc/modules-load.d/wireguard.conf
echo "iptable_nat" > /etc/modules-load.d/iptable_nat.conf
echo "ip6table_nat" > /etc/modules-load.d/ip6table_nat.conf
# Enable IP forwarding.
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv6.conf.all.forwarding=1
mkdir /data
publicip=$(curl ifconfig.me)
docker create \
--name subspace \
--restart always \
--network host \
--cap-add NET_ADMIN \
--volume /data:/data \
--volume "/etc/dnsmasq.d":"/etc/dnsmasq.d" \
--env SUBSPACE_HTTP_HOST="$publicip.nip.io" \
--env SUBSPACE_NAMESERVERS="1.1.1.1,8.8.8.8" \
--env SUBSPACE_LISTENPORT="51820" \
--env SUBSPACE_IPV4_POOL="10.99.97.0/24" \
--env SUBSPACE_IPV6_POOL="fd00::10:97:0/64" \
--env SUBSPACE_IPV4_GW="10.99.97.1" \
--env SUBSPACE_IPV6_GW="fd00::10:97:1" \
--env SUBSPACE_IPV6_NAT_ENABLED=1 \
--env SUBSPACE_DISABLE_DNS=0 \
subspacecommunity/subspace:latest
sudo docker start subspace
docker create \
--name subspace \
--restart always \
--network host \
--cap-add NET_ADMIN \
--volume /data:/data \
--volume "/etc/dnsmasq.d":"/etc/dnsmasq.d" \
--env SUBSPACE_HTTP_HOST="vpn.159.69.220.76.nip.io" \
--env SUBSPACE_NAMESERVERS="1.1.1.1,8.8.8.8" \
--env SUBSPACE_LISTENPORT="51820" \
--env SUBSPACE_IPV4_POOL="10.99.97.0/24" \
--env SUBSPACE_IPV6_POOL="fd00::10:97:0/64" \
--env SUBSPACE_IPV4_GW="10.99.97.1" \
--env SUBSPACE_IPV6_GW="fd00::10:97:1" \
--env SUBSPACE_IPV6_NAT_ENABLED=1 \
--env SUBSPACE_DISABLE_DNS=0 \
subspacecommunity/subspace:latest
sudo docker start subspace
apt-get update
apt-get install -y wireguard
# Remove dnsmasq because it will run inside the container.
apt-get remove -y dnsmasq
# Disable systemd-resolved listener if it blocks port 53.
echo "DNSStubListener=no" >> /etc/systemd/resolved.conf
systemctl restart systemd-resolved
# Set Cloudfare DNS server.
echo nameserver 1.1.1.1 > /etc/resolv.conf
echo nameserver 1.0.0.1 >> /etc/resolv.conf
# Load modules.
modprobe wireguard
modprobe iptable_nat
modprobe ip6table_nat
# Enable modules when rebooting.
echo "wireguard" > /etc/modules-load.d/wireguard.conf
echo "iptable_nat" > /etc/modules-load.d/iptable_nat.conf
echo "ip6table_nat" > /etc/modules-load.d/ip6table_nat.conf
# Enable IP forwarding.
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv6.conf.all.forwarding=1
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
mkdir /data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment