Skip to content

Instantly share code, notes, and snippets.

@tomzhang
Forked from jolestar/ipsec-shadowsocks.sh
Created November 12, 2016 06:08
Show Gist options
  • Save tomzhang/d15f9c0bc5df712d8083a63f0e439a8b to your computer and use it in GitHub Desktop.
Save tomzhang/d15f9c0bc5df712d8083a63f0e439a8b to your computer and use it in GitHub Desktop.
Run ipsec vpn and shadowsocks by docker, for ubuntu 16
PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-engine
service docker start
docker run --name=shadowsocks --restart=always -d -p 8388:8388 -e "PASSWORD=$PASSWORD" vimagick/shadowsocks-libev
IPSEC_PSK=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
cat <<EOT >> /root/vpn.env
VPN_IPSEC_PSK=$IPSEC_PSK
VPN_USER=vpn
VPN_PASSWORD=$PASSWORD
EOT
docker run \
--name ipsec-vpn-server \
--env-file /root/vpn.env \
-p 500:500/udp \
-p 4500:4500/udp \
-v /lib/modules:/lib/modules:ro \
-d --privileged \
--restart=always \
hwdsl2/ipsec-vpn-server
echo "Your shadowsocks port: 8388, password: $PASSWORD "
echo "Your l2tp over ipsec username: vpn, password: $PASSWORD, ipsec_psk: $IPSEC_PSK "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment