Skip to content

Instantly share code, notes, and snippets.

@pindank
Forked from abegodong/initd-nodhcp
Created December 20, 2018 09:51
Show Gist options
  • Select an option

  • Save pindank/d69195c1ea22451a2719db885093398d to your computer and use it in GitHub Desktop.

Select an option

Save pindank/d69195c1ea22451a2719db885093398d to your computer and use it in GitHub Desktop.

Revisions

  1. pindank revised this gist Dec 21, 2018. 2 changed files with 8 additions and 8 deletions.
    12 changes: 6 additions & 6 deletions softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -26,17 +26,17 @@ TARGET="/usr/local/"
    apt-get update && apt-get -qq upgrade
    apt-get -y install wget build-essential dnsmasq expect
    sleep 2
    wget http://www.softether-download.com/files/softether/v4.19-9599-beta-2015.10.19-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    tar xzvf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz -C $TARGET
    rm -rf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/releases/download/v4.28-9669-beta/softether-vpnserver-v4.28-9669-beta-2018.09.11-linux-x64-64bit.tar.gz
    tar xzvf softether-vpnserver-v4.28-9669-beta-2018.09.11-linux-x64-64bit.tar.gz -C $TARGET
    rm -rf softether-vpnserver-v4.28-9669-beta-2018.09.11-linux-x64-64bit.tar.gz
    cd ${TARGET}vpnserver
    expect -c 'spawn make; expect number:; send 1\r; expect number:; send 1\r; expect number:; send 1\r; interact'
    find ${TARGET}vpnserver -type f -print0 | xargs -0 chmod 600
    chmod 700 ${TARGET}vpnserver/vpnserver ${TARGET}vpnserver/vpncmd
    mkdir -p /var/lock/subsys
    echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/ipv4_forwarding.conf
    sysctl --system
    wget -P /etc/init.d https://gist.github.com/abegodong/15948f26c8683ab1f5be/raw/6fefa2600ae7730e4aa97328a78c94bbaa25fcf1/vpnserver
    wget -P /etc/init.d https://gist.github.com/pindank/d69195c1ea22451a2719db885093398d/raw/58e02f19fcd404145ca13355223d50b30951d247/vpnserver
    sed -i "s/\[SERVER_IP\]/${SERVER_IP}/g" /etc/init.d/vpnserver
    chmod 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start
    update-rc.d vpnserver defaults
    @@ -48,8 +48,8 @@ ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD IP
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD BridgeCreate ${HUB} /DEVICE:soft /TAP:yes
    cat <<EOF >> /etc/dnsmasq.conf
    interface=tap_soft
    dhcp-range=tap_soft,10.100.10.128,10.100.10.254,12h
    dhcp-option=tap_soft,3,10.100.10.1
    dhcp-range=tap_soft,192.168.44.128,10.100.10.254,12h
    dhcp-option=tap_soft,3,192.168.44.1
    EOF
    service dnsmasq restart
    service vpnserver restart
    4 changes: 2 additions & 2 deletions vpnserver
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@
    # description: SoftEther VPN Server
    DAEMON=/usr/local/vpnserver/vpnserver
    LOCK=/var/lock/subsys/vpnserver
    TAP_ADDR=10.100.10.1
    TAP_NETWORK=10.100.10.0/24
    TAP_ADDR=192.168.44.1
    TAP_NETWORK=192.168.44.0/24
    SERVER_IP=[SERVER_IP]
    test -x $DAEMON || exit 0
    case "$1" in
  2. @abegodong abegodong revised this gist Feb 14, 2016. 1 changed file with 28 additions and 0 deletions.
    28 changes: 28 additions & 0 deletions initd-nodhcp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/bin/sh
    # chkconfig: 2345 99 01
    # description: SoftEther VPN Server
    DAEMON=/usr/local/vpnserver/vpnserver
    LOCK=/var/lock/subsys/vpnserver
    SERVER_IP=[SERVER_IP]
    test -x $DAEMON || exit 0
    case "$1" in
    start)
    $DAEMON start
    touch $LOCK
    sleep 1
    ;;
    stop)
    $DAEMON stop
    rm $LOCK
    ;;
    restart)
    $DAEMON stop
    sleep 3
    $DAEMON start
    sleep 1
    ;;
    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    esac
    exit 0
  3. @abegodong abegodong revised this gist Feb 10, 2016. 1 changed file with 56 additions and 0 deletions.
    56 changes: 56 additions & 0 deletions softetherbridget-centos.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    #!/bin/bash
    # Softether VPN Bridge with dnsmasq for Ubuntu
    # References:
    # - https://gist.github.com/AyushSachdev/edc23605438f1cccdd50
    # - https://www.digitalocean.com/community/articles/how-to-setup-a-multi-protocol-vpn-server-using-softether
    # - http://blog.lincoln.hk/blog/2013/05/17/softether-on-vps-using-local-bridge/
    SERVER_IP=""
    SERVER_PASSWORD=""
    SHARED_KEY=""
    USER=""

    echo -n "Enter Server IP: "
    read SERVER_IP
    echo -n "Set VPN Username to create: "
    read USER
    read -s -p "Set VPN Password: " SERVER_PASSWORD
    echo ""
    read -s -p "Set IPSec Shared Keys: " SHARED_KEY
    echo ""
    echo "+++ Now sit back and wait until the installation finished +++"
    HUB="VPN"
    HUB_PASSWORD=${SERVER_PASSWORD}
    USER_PASSWORD=${SERVER_PASSWORD}
    TARGET="/usr/local/"

    yum update
    yum -y install wget dnsmasq expect gcc zlib-devel openssl-devel readline-devel ncurses-devel
    sleep 2
    wget http://www.softether-download.com/files/softether/v4.19-9599-beta-2015.10.19-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    tar xzvf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz -C $TARGET
    rm -rf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    cd ${TARGET}vpnserver
    expect -c 'spawn make; expect number:; send 1\r; expect number:; send 1\r; expect number:; send 1\r; interact'
    find ${TARGET}vpnserver -type f -print0 | xargs -0 chmod 600
    chmod 700 ${TARGET}vpnserver/vpnserver ${TARGET}vpnserver/vpncmd
    mkdir -p /var/lock/subsys
    echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/ipv4_forwarding.conf
    sysctl --system
    wget -P /etc/init.d https://gist.github.com/abegodong/15948f26c8683ab1f5be/raw/6fefa2600ae7730e4aa97328a78c94bbaa25fcf1/vpnserver
    sed -i "s/\[SERVER_IP\]/${SERVER_IP}/g" /etc/init.d/vpnserver
    chmod 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start
    update-rc.d vpnserver defaults
    ${TARGET}vpnserver/vpncmd localhost /SERVER /CMD ServerPasswordSet ${SERVER_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD HubCreate ${HUB} /PASSWORD:${HUB_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD UserCreate ${USER} /GROUP:none /REALNAME:none /NOTE:none
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD UserPasswordSet ${USER} /PASSWORD:${USER_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD IPsecEnable /L2TP:yes /L2TPRAW:yes /ETHERIP:yes /PSK:${SHARED_KEY} /DEFAULTHUB:${HUB}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD BridgeCreate ${HUB} /DEVICE:soft /TAP:yes
    cat <<EOF >> /etc/dnsmasq.conf
    interface=tap_soft
    dhcp-range=tap_soft,10.100.10.128,10.100.10.254,12h
    dhcp-option=tap_soft,3,10.100.10.1
    EOF
    service dnsmasq restart
    service vpnserver restart
    echo "+++ Installation finished +++"
  4. @abegodong abegodong revised this gist Dec 1, 2015. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/bin/sh
    #!/bin/bash
    # Softether VPN Bridge with dnsmasq for Ubuntu
    # References:
    # - https://gist.github.com/AyushSachdev/edc23605438f1cccdd50
    @@ -13,10 +13,10 @@ echo -n "Enter Server IP: "
    read SERVER_IP
    echo -n "Set VPN Username to create: "
    read USER
    echo -n "Set VPN Password: "
    read -s SERVER_PASSWORD
    echo -n "Set IPSec Shared Keys: "
    read -s SHARED_KEY
    read -s -p "Set VPN Password: " SERVER_PASSWORD
    echo ""
    read -s -p "Set IPSec Shared Keys: " SHARED_KEY
    echo ""
    echo "+++ Now sit back and wait until the installation finished +++"
    HUB="VPN"
    HUB_PASSWORD=${SERVER_PASSWORD}
  5. @abegodong abegodong revised this gist Dec 1, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,7 @@ mkdir -p /var/lock/subsys
    echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/ipv4_forwarding.conf
    sysctl --system
    wget -P /etc/init.d https://gist.github.com/abegodong/15948f26c8683ab1f5be/raw/6fefa2600ae7730e4aa97328a78c94bbaa25fcf1/vpnserver
    sed -i s/\[SERVER_IP\]/${SERVER_IP}/g /etc/init.d/vpnserver
    sed -i "s/\[SERVER_IP\]/${SERVER_IP}/g" /etc/init.d/vpnserver
    chmod 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start
    update-rc.d vpnserver defaults
    ${TARGET}vpnserver/vpncmd localhost /SERVER /CMD ServerPasswordSet ${SERVER_PASSWORD}
  6. @abegodong abegodong revised this gist Dec 1, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,9 @@ read SERVER_IP
    echo -n "Set VPN Username to create: "
    read USER
    echo -n "Set VPN Password: "
    read SERVER_PASSWORD
    read -s SERVER_PASSWORD
    echo -n "Set IPSec Shared Keys: "
    read SHARED_KEY
    read -s SHARED_KEY
    echo "+++ Now sit back and wait until the installation finished +++"
    HUB="VPN"
    HUB_PASSWORD=${SERVER_PASSWORD}
  7. @abegodong abegodong revised this gist Dec 1, 2015. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,10 @@ expect -c 'spawn make; expect number:; send 1\r; expect number:; send 1\r; expec
    find ${TARGET}vpnserver -type f -print0 | xargs -0 chmod 600
    chmod 700 ${TARGET}vpnserver/vpnserver ${TARGET}vpnserver/vpncmd
    mkdir -p /var/lock/subsys
    wget -P /etc/init.d https://gist.github.com/abegodong/15948f26c8683ab1f5be/raw/fbafaec0cebe5332f0bc8103c009fa194f676a00/vpnserver
    echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/ipv4_forwarding.conf
    sysctl --system
    wget -P /etc/init.d https://gist.github.com/abegodong/15948f26c8683ab1f5be/raw/6fefa2600ae7730e4aa97328a78c94bbaa25fcf1/vpnserver
    sed -i s/\[SERVER_IP\]/${SERVER_IP}/g /etc/init.d/vpnserver
    chmod 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start
    update-rc.d vpnserver defaults
    ${TARGET}vpnserver/vpncmd localhost /SERVER /CMD ServerPasswordSet ${SERVER_PASSWORD}
    @@ -48,10 +51,6 @@ interface=tap_soft
    dhcp-range=tap_soft,10.100.10.128,10.100.10.254,12h
    dhcp-option=tap_soft,3,10.100.10.1
    EOF
    echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/ipv4_forwarding.conf
    sysctl --system
    iptables -t nat -A POSTROUTING -s 10.100.10.0/24 -j SNAT --to-source ${SERVER_IP}
    apt-get install iptables-persistent
    service dnsmasq restart
    service vpnserver restart
    echo "+++ Installation finished +++"
  8. @abegodong abegodong revised this gist Dec 1, 2015. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions vpnserver
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,17 @@
    DAEMON=/usr/local/vpnserver/vpnserver
    LOCK=/var/lock/subsys/vpnserver
    TAP_ADDR=10.100.10.1
    TAP_NETWORK=10.100.10.0/24
    SERVER_IP=[SERVER_IP]
    test -x $DAEMON || exit 0
    case "$1" in
    start)
    $DAEMON start
    touch $LOCK
    sleep 1
    /sbin/ifconfig tap_soft $TAP_ADDR
    iptables -t nat -F
    iptables -t nat -A POSTROUTING -s ${TAP_NETWORK} -j SNAT --to-source ${SERVER_IP}
    ;;
    stop)
    $DAEMON stop
    @@ -22,6 +26,8 @@ sleep 3
    $DAEMON start
    sleep 1
    /sbin/ifconfig tap_soft $TAP_ADDR
    iptables -t nat -F
    iptables -t nat -A POSTROUTING -s ${TAP_NETWORK} -j SNAT --to-source ${SERVER_IP}
    ;;
    *)
    echo "Usage: $0 {start|stop|restart}"
  9. @abegodong abegodong revised this gist Nov 17, 2015. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ echo -n "Set VPN Password: "
    read SERVER_PASSWORD
    echo -n "Set IPSec Shared Keys: "
    read SHARED_KEY

    echo "+++ Now sit back and wait until the installation finished +++"
    HUB="VPN"
    HUB_PASSWORD=${SERVER_PASSWORD}
    USER_PASSWORD=${SERVER_PASSWORD}
    @@ -53,4 +53,5 @@ sysctl --system
    iptables -t nat -A POSTROUTING -s 10.100.10.0/24 -j SNAT --to-source ${SERVER_IP}
    apt-get install iptables-persistent
    service dnsmasq restart
    service vpnserver restart
    service vpnserver restart
    echo "+++ Installation finished +++"
  10. @abegodong abegodong revised this gist Nov 17, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -25,7 +25,7 @@ TARGET="/usr/local/"

    apt-get update && apt-get -qq upgrade
    apt-get -y install wget build-essential dnsmasq expect

    sleep 2
    wget http://www.softether-download.com/files/softether/v4.19-9599-beta-2015.10.19-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    tar xzvf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz -C $TARGET
    rm -rf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
  11. @abegodong abegodong renamed this gist Nov 17, 2015. 1 changed file with 14 additions and 8 deletions.
    22 changes: 14 additions & 8 deletions sofetherbridged.sh → softetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -4,27 +4,33 @@
    # - https://gist.github.com/AyushSachdev/edc23605438f1cccdd50
    # - https://www.digitalocean.com/community/articles/how-to-setup-a-multi-protocol-vpn-server-using-softether
    # - http://blog.lincoln.hk/blog/2013/05/17/softether-on-vps-using-local-bridge/

    SERVER_IP=""
    SERVER_PASSWORD=""
    HUB=""
    HUB_PASSWORD=${SERVER_PASSWORD}
    SHARED_KEY=""
    USER=""

    echo -n "Enter Server IP: "
    read SERVER_IP
    echo -n "Set VPN Username to create: "
    read USER
    echo -n "Set VPN Password: "
    read SERVER_PASSWORD
    echo -n "Set IPSec Shared Keys: "
    read SHARED_KEY

    HUB="VPN"
    HUB_PASSWORD=${SERVER_PASSWORD}
    USER_PASSWORD=${SERVER_PASSWORD}
    TARGET="/usr/local/"

    apt-get update && apt-get -qq upgrade
    apt-get -y install wget build-essential dnsmasq
    apt-get -y install wget build-essential dnsmasq expect

    wget http://www.softether-download.com/files/softether/v4.19-9599-beta-2015.10.19-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    tar xzvf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz -C $TARGET
    rm -rf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    cd ${TARGET}vpnserver
    echo "++++++++++++++++++++++++++++++++++++++++++\n"
    echo "+ Please agree to the License Aggreement +\n"
    echo "++++++++++++++++++++++++++++++++++++++++++\n"
    make
    expect -c 'spawn make; expect number:; send 1\r; expect number:; send 1\r; expect number:; send 1\r; interact'
    find ${TARGET}vpnserver -type f -print0 | xargs -0 chmod 600
    chmod 700 ${TARGET}vpnserver/vpnserver ${TARGET}vpnserver/vpncmd
    mkdir -p /var/lock/subsys
  12. @abegodong abegodong revised this gist Nov 16, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions sofetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -34,9 +34,9 @@ update-rc.d vpnserver defaults
    ${TARGET}vpnserver/vpncmd localhost /SERVER /CMD ServerPasswordSet ${SERVER_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD HubCreate ${HUB} /PASSWORD:${HUB_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD UserCreate ${USER} /GROUP:none /REALNAME:none /NOTE:none
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD UserPasswordSet ${USER} /PASSWORD:{$USER_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD IPsecEnable /L2TP:yes /L2TPRAW:yes /ETHERIP:yes /PSK:${SHARED_KEY} /DEFAULTHUB:${HUB}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB ${HUB} /CMD BridgeCreate ${HUB} /DEVICE:soft /TAP:yes
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD UserPasswordSet ${USER} /PASSWORD:${USER_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD IPsecEnable /L2TP:yes /L2TPRAW:yes /ETHERIP:yes /PSK:${SHARED_KEY} /DEFAULTHUB:${HUB}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD BridgeCreate ${HUB} /DEVICE:soft /TAP:yes
    cat <<EOF >> /etc/dnsmasq.conf
    interface=tap_soft
    dhcp-range=tap_soft,10.100.10.128,10.100.10.254,12h
  13. @abegodong abegodong revised this gist Nov 16, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sofetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ TARGET="/usr/local/"
    apt-get update && apt-get -qq upgrade
    apt-get -y install wget build-essential dnsmasq

    wget http://www.softether-download.com/files/softether/v4.19-9599-beta-2015.10.19-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit$
    wget http://www.softether-download.com/files/softether/v4.19-9599-beta-2015.10.19-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    tar xzvf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz -C $TARGET
    rm -rf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    cd ${TARGET}vpnserver
  14. @abegodong abegodong revised this gist Nov 16, 2015. 1 changed file with 50 additions and 0 deletions.
    50 changes: 50 additions & 0 deletions sofetherbridged.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    #!/bin/sh
    # Softether VPN Bridge with dnsmasq for Ubuntu
    # References:
    # - https://gist.github.com/AyushSachdev/edc23605438f1cccdd50
    # - https://www.digitalocean.com/community/articles/how-to-setup-a-multi-protocol-vpn-server-using-softether
    # - http://blog.lincoln.hk/blog/2013/05/17/softether-on-vps-using-local-bridge/

    SERVER_IP=""
    SERVER_PASSWORD=""
    HUB=""
    HUB_PASSWORD=${SERVER_PASSWORD}
    SHARED_KEY=""
    USER=""
    USER_PASSWORD=${SERVER_PASSWORD}
    TARGET="/usr/local/"

    apt-get update && apt-get -qq upgrade
    apt-get -y install wget build-essential dnsmasq

    wget http://www.softether-download.com/files/softether/v4.19-9599-beta-2015.10.19-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit$
    tar xzvf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz -C $TARGET
    rm -rf softether-vpnserver-v4.19-9599-beta-2015.10.19-linux-x64-64bit.tar.gz
    cd ${TARGET}vpnserver
    echo "++++++++++++++++++++++++++++++++++++++++++\n"
    echo "+ Please agree to the License Aggreement +\n"
    echo "++++++++++++++++++++++++++++++++++++++++++\n"
    make
    find ${TARGET}vpnserver -type f -print0 | xargs -0 chmod 600
    chmod 700 ${TARGET}vpnserver/vpnserver ${TARGET}vpnserver/vpncmd
    mkdir -p /var/lock/subsys
    wget -P /etc/init.d https://gist.github.com/abegodong/15948f26c8683ab1f5be/raw/fbafaec0cebe5332f0bc8103c009fa194f676a00/vpnserver
    chmod 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start
    update-rc.d vpnserver defaults
    ${TARGET}vpnserver/vpncmd localhost /SERVER /CMD ServerPasswordSet ${SERVER_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /CMD HubCreate ${HUB} /PASSWORD:${HUB_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD UserCreate ${USER} /GROUP:none /REALNAME:none /NOTE:none
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD UserPasswordSet ${USER} /PASSWORD:{$USER_PASSWORD}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB:${HUB} /CMD IPsecEnable /L2TP:yes /L2TPRAW:yes /ETHERIP:yes /PSK:${SHARED_KEY} /DEFAULTHUB:${HUB}
    ${TARGET}vpnserver/vpncmd localhost /SERVER /PASSWORD:${SERVER_PASSWORD} /HUB ${HUB} /CMD BridgeCreate ${HUB} /DEVICE:soft /TAP:yes
    cat <<EOF >> /etc/dnsmasq.conf
    interface=tap_soft
    dhcp-range=tap_soft,10.100.10.128,10.100.10.254,12h
    dhcp-option=tap_soft,3,10.100.10.1
    EOF
    echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/ipv4_forwarding.conf
    sysctl --system
    iptables -t nat -A POSTROUTING -s 10.100.10.0/24 -j SNAT --to-source ${SERVER_IP}
    apt-get install iptables-persistent
    service dnsmasq restart
    service vpnserver restart
  15. @abegodong abegodong revised this gist Nov 16, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion vpnserver
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    !/bin/sh
    #!/bin/sh
    # chkconfig: 2345 99 01
    # description: SoftEther VPN Server
    DAEMON=/usr/local/vpnserver/vpnserver
  16. @abegodong abegodong created this gist Nov 16, 2015.
    30 changes: 30 additions & 0 deletions vpnserver
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    !/bin/sh
    # chkconfig: 2345 99 01
    # description: SoftEther VPN Server
    DAEMON=/usr/local/vpnserver/vpnserver
    LOCK=/var/lock/subsys/vpnserver
    TAP_ADDR=10.100.10.1
    test -x $DAEMON || exit 0
    case "$1" in
    start)
    $DAEMON start
    touch $LOCK
    sleep 1
    /sbin/ifconfig tap_soft $TAP_ADDR
    ;;
    stop)
    $DAEMON stop
    rm $LOCK
    ;;
    restart)
    $DAEMON stop
    sleep 3
    $DAEMON start
    sleep 1
    /sbin/ifconfig tap_soft $TAP_ADDR
    ;;
    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    esac
    exit 0