1. SoftEther VPN Clientのダウンロード
以下のURLから、ソースコードをダウンロードします。 http://www.softether-download.com/en.aspx?product=softether「Mac OS Xでの使用はおすすめしません」と記載されていますが、気にせずダウンロードします。最新バージョンはVer 4.24, Build 9651, betaです。Release Dateは2017-10-23なので、開発自体は継続的に行われているようです。
2.コンパイル
Macのターミナルを開いて、ダウンロードしたソースコードを展開します。$tar xvzf softether-vpnclient-v4.24-9651-beta-2017.10.23-macos-x64-64bit.tar.gzvpnclientディレクトリに入って、makeを実行します。 最初にライセンス同意を求められるので、全て1.Yesを入力すると、コンンパイルが実行されます。
$cd vpnclient $make : gcc code/vpnclient.a -O2 -fsigned-char -m64 -lm -lpcap -lpthread -L./ lib/libssl.a lib/libcrypto.a lib/libiconv.a lib/libcharset.a lib/libedit.a lib/libncurses.a lib/libz.a -o vpnclient正常にコンパイルが終了すると、vpnclientとvpncmdが生成されます。
3.仮想ネットワークデバイスTUN/TAPのインストール
$brew cask install tuntap ==> Tapping caskroom/cask Cloning into '/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask'... :(中略) ==> installer: Installing at base path / ==> installer: The install was successful. tuntap was successfully installed!
4.接続先設定の作成
Windows用のVPNクライアントは、GUIで設定が行えますが、Macでは同様の設定をvpnclient/vpncmdを使ってコマンドラインで行います。設定は、vpn_clinet.configというファイルに格納されます。cd vpnclient ./vpncmd NicCreate VPN NicCreate command - Create New Virtual Network Adapter The command completed successfully. AccountCreate command - Create New VPN Connection Setting Name of VPN Connection Setting: AtarashiiSetsuzoku Destination VPN Server Host Name and Port Number:satoshi69.softether.net:443 Destination Virtual Hub Name: satoshi-vpn Connecting User Name: satoshi69 Used Virtual Network Adapter Name: VPN The command completed successfully. AccountPasswordSet AccountPasswordSet command - Set User Authentication Type of VPN Connection Setting to Password Authentication Name of VPN Connection Setting: AtarashiiSetsuzoku Please enter the password. To cancel press the Ctrl+D key. Password: ********* Confirm input: ********* Specify standard or radius: standard You cannot make a blank specification. Specify standard or radius: standard The command completed successfully.
4.VPN接続/終了スクリプトの作成
以下のようなVPN接続/終了スクリプトを作成します。VPN接続用
#!/bin/sh set -e VPNPATH=~/vpnclient VPNCLIENT=${VPNPATH}/vpnclient VPNCMD=${VPNPATH}/vpncmd # start vpn client echo "starting vpn client" printf "password: " read -s pwd echo "${pwd}" | sudo -S ${VPNCLIENT} start echo "done" # exec vpncmd ${VPNCMD} << EOF 2 localhost AccountConnect AtarashiiSetsuzoku EOF # get ip address by dhcp echo "${pwd}" | sudo -S ipconfig set tap0 dhcp
VPN終了用
#!/bin/sh set -e VPNPATH=~/vpnclient VPNCLIENT=${VPNPATH}/vpnclient VPNCMD=${VPNPATH}/vpncmd # exec vpncmd ${VPNCMD} << EOF 2 localhost AccountDisconnect AtarashiiSetsuzoku EOF # stop vpn client echo "stopping vpn client" printf "password: " read -s pwd echo "${pwd}" | sudo -S ${VPNCLIENT} stop echo "done"
5.VPN接続
VPN接続を開始するには、start_vpn.shをターミナルで実行します。接続開始にはsudoのパスワード入力が発生します。./start_vpn.sh starting vpn client password: Password:The SoftEther VPN Client service has been started. done vpncmd command - SoftEther VPN Command Line Management Utility SoftEther VPN Command Line Management Utility (vpncmd command) Version 4.22 Build 9634 (English) Compiled 2016/11/27 15:23:56 by yagi at pc30 Copyright (c) SoftEther VPN Project. All Rights Reserved. By using vpncmd program, the following can be achieved. 1. Management of VPN Server or VPN Bridge 2. Management of VPN Client 3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool) Specify the host name or IP address of the computer that the destination VPN Client is operating on. If nothing is input and Enter is pressed, connection will be made to localhost (this computer). Connected to VPN Client "localhost". AccountConnect command - Start Connection to VPN Server using VPN Connection Setting The command completed successfully.
6.終了
VPN接続を終了するには、stop_vpn.shをターミナルで実行します。接続終了にはsudoのパスワード入力が発生します。./stop_vpn.sh vpncmd command - SoftEther VPN Command Line Management Utility SoftEther VPN Command Line Management Utility (vpncmd command) Version 4.22 Build 9634 (English) Compiled 2016/11/27 15:23:56 by yagi at pc30 Copyright (c) SoftEther VPN Project. All Rights Reserved. By using vpncmd program, the following can be achieved. 1. Management of VPN Server or VPN Bridge 2. Management of VPN Client 3. Use of VPN Tools (certificate creation and Network Traffic Speed Test Tool) Specify the host name or IP address of the computer that the destination VPN Client is operating on. If nothing is input and Enter is pressed, connection will be made to localhost (this computer). Connected to VPN Client "localhost". AccountDisconnect command - Disconnect VPN Connection Setting During Connection The command completed successfully. stopping vpn client password: Stopping the SoftEther VPN Client service ... SoftEther VPN Client service has been stopped. done