2
0
mirror of https://github.com/pirate/wireguard-docs synced 2024-10-30 15:20:56 +00:00
wireguard-docs/example-internet-browsing-vpn/server/setup.sh

18 lines
648 B
Bash
Raw Normal View History

2019-05-28 09:33:04 +00:00
#!/bin/bash
# install wireguard
add-apt-repository ppa:wireguard/wireguard
apt update
apt install wireguard
# to enable kernel relaying/forwarding ability on bounce servers
2021-03-28 16:13:24 +00:00
echo "net.ipv4.ip_forward = 1" >>/etc/sysctl.conf
echo "net.ipv4.conf.all.proxy_arp = 1" >>/etc/sysctl.conf
sysctl -p /etc/sysctl.conf
2019-05-28 09:33:04 +00:00
# to add iptables forwarding rules on bounce servers
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wg0 -o wg0 -m conntrack --ctstate NEW -j ACCEPT
2019-06-24 10:11:21 +00:00
iptables -t nat -A POSTROUTING -s 10.0.44.0/24 -o eth0 -j MASQUERADE