2023年3月5日 星期日

Install Softether for vpnazure.net on Raspberry Pi 3B+

 A. Download VPN server souce code from Softether web site:

  1. Browser https://www.softether-download.com/files/softether/
  2. Choose the latest version
  3. Choose Linux
  4. Choose SoftEther_VPN_Server
  5. Choose 64bit_-_ARM_64bit
  6. Copy the link and download it by wget
wget https://www.softether-download.com/files/softether/v4.44-9807-rtm-2025.04.16-tree/Source_Code/softether-src-v4.44-9807-rtm.tar.gz -O vpnserver.tgz

B. Install VPN server

  1. Install required library

    sudo apt install libreadline-dev libssl-dev

  2. Untar the source code and make it

    tar zxf vpnserver.tgz
    cd vpnserver
    ./configure
    make
    make install

  3. After make install, the vpnserver and vpncmd can be found in the follwing directories

    /usr/vpnserver
    /usr/vpncmd
    /usr/bin

C. Configure VPN server

  1. Create /etc/init.d/vpnserver for vpnserver to auto start at boot time

    sudo vi /etc/init.d/vpnserver

    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides:          vpnserver
    # Required-Start:    $local_fs $network
    # Required-Stop:     $local_fs $network
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: VPN Server
    # Description:       SoftEther VPN Server
    ### END INIT INFO

    DAEMON=/usr/bin/vpnserver
    LOCK=/var/lock/subsys/vpnserver

    . /lib/lsb/init-functions

    test -x $DAEMON || exit 0
    case "$1" in
    start)
            $DAEMON start
            touch $LOCK
            ;;
    stop)
            $DAEMON stop
            rm $LOCK
            ;;
    restart)
            $DAEMON stop
            sleep 3
            $DAEMON start
            ;;
    *)
            echo "Usage: $0 {start|stop|restart}"
            exit 1
    esac
    exit 0

  2. Link vpnserver to appropriate boot level

    sudo mkdir -p /var/lock/subsys
    sudo chmod 755 /etc/init.d/vpnserver
    sudo update-rc.d vpnserver defaults


  3. Enable ipv4 forwarding by uncomment the following line in /etc/sysctl.conf

    sudo vi /etc/sysctl.conf

    # Uncomment the next line to enable packet forwarding for IPv4
    net.ipv4.ip_forward=1


  4. Enable vpnserver in systemd

    sudo systemctl enable vpnserver

  5. Star vpnserver to create user for vpnserver configuration

    sudo /etc/init.d/vpnserver start

D. Configure VPN server 

    Use vpncmd to do initial configure for VPN server (step 1 to 3) and following configuration may be done by vpncmd command line or through the GUI of SoftEther VPN Server Manager for Windows.

  1. Check installation status

    Execute vpncmd command, select 1. Management of VPN Server or VPN Bridge, press [Enter] for the first two hostname and virtual hub name question.

    sudo /usr/bin/vpncmd

    After VPN Server command prompt is shown, use check command to check server status.

    VPN Server>check

    If installation is correct, it will show that all check are "Pass".


  2. Create password for server configuration connection

    Use ServerPasswordSet command to set Set VPN Server Administrator Password.

    VPN Server>PasswordSet

  3. Select the DEFAULT hub

    VPN Server>Hub DEFAULT
    VPN Server/DEFAULT>


  4. Create a user for the DEFAULT hub and set password for the created user

    VPN Server/DEFAULT>UserCreate vpn

    VPN Server/DEFAULT>UserPasswordSet vpn


  5. Enable Secure NAT for the DEFAULT hub

    VPN Server/DEFAULT>SecureNatEnable
    VPN Server/DEFAULT>SecureNatStatusGet


  6. Enable VPN Azure for the VPN Server

    VPN Server/DEFAULT>Hub
    VPN Server>VpnAzureSetEnable yes
    VPN Server>VpnAzureGetStatus


  7. Take a note for the Hostname of this VPN Server on VPN Azure Service.

E. Reboot and try it!

沒有留言: