KB: Install and Config SoftEther VPN Bridge on OpenWrt Router

Compile softethervpn Package

See https://openwrt.org/packages/pkgdata_lede17_1/softethervpn for the available compiled package. Compile package for your target architecture if not available. Reference:

  Install dependency libraries

apt-get update
apt-get install -y subversion make gcc g++ libncurses5-dev libghc-zlib-dev libreadline-dev libssl-dev gawk bzip2 patch xz-utils git unzip

  Get OpenWrt and SoftEther VPN source code

git clone https://git.openwrt.org/openwrt/openwrt.git ./openwrt
cd openwrt
git checkout openwrt-18.06

./scripts/feeds update
./scripts/feeds install softethervpn

  Compile

make defconfig
make menuconfig

make prepare
make package/softethervpn/compile V=99

 

Install – Standard Package

Installing package “softethervpn” will start all the softethervpnbridge, softethervpnserver and softethervpnclient services and may make the router unresponsive. Prepare and run the following shell script to stop the services and disable from autostart in next reboot.

#!/bin/sh

while :
do
        /etc/init.d/softethervpnbridge disable
        /etc/init.d/softethervpnserver disable
        /etc/init.d/softethervpnclient disable
        /etc/init.d/softethervpnbridge stop
        /etc/init.d/softethervpnserver stop
        /etc/init.d/softethervpnclient stop
        sleep 1
done

Install package softethervpn.

Install – For router with 8MB ROM

The pre-compiled package includes all client, bridge and server which can’t fit into router with 8MB ROM. Workaround by installing only softetherbridge.

Step 1: Install dependency packages manually

#!/bin/sh
opkg install libc
opkg install libpthread
opkg install librt
opkg install libreadline
opkg install libopenssl
opkg install libncurses
opkg install kmod-tun
opkg install zlib

Step 2: Expand the pre-compiled softethervpn package

tar xvfs softethervpn_4.22-9634-1_mips_24kc.ipk

Step 3: Remove softetherclient and softetherserver files from data.tar.gz

gunzip data.tar.gz
tar --delete --file data.tar ./usr/libexec/softethervpn/vpnclient
tar --delete --file data.tar ./usr/libexec/softethervpn/vpnserver
tar --delete --file data.tar ./usr/libexec/softethervpn/vpn_client.config
tar --delete --file data.tar ./usr/libexec/softethervpn/vpn_server.config
tar --list --file data.tar

Step 4: Upload data.tar to router and extract to root path /

cd /tar xvf /tmp/data.tar

 

Config VPN Bridge

Create a command file  (vpn_config.txt)

CascadeCreate hkvpn /SERVER:{vpnserver}:443 /HUB:{virtualhubname} /username:{username}
CascadePasswordSet {virtualhubname} /PASSWORD:{password} /TYPE:standard
CascadeOnline {virtualhubname}
BridgeCreate BRIDGE /DEVICE:{tap_devicename} /TAP:yes
CascadeList
BridgeList

Run vpncmd

vpncmd localhost:443 /SERVER /ADMINHUB:BRIDGE /IN:vpn_config.txt

 

Config Network Interface

{tbc}