Skip to content

Instantly share code, notes, and snippets.

@kozak127
Last active December 24, 2023 15:52
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kozak127/ab80fc31f400f4565bbcb3dc35a61744 to your computer and use it in GitHub Desktop.
Save kozak127/ab80fc31f400f4565bbcb3dc35a61744 to your computer and use it in GitHub Desktop.
#############################
### GENERATE CERT AND KEY ###
#############################
# when generating key and cert, use password provided by administrator
cd ~/Workspace/Silvermedia/vpn
kozak127@callisto:~/Workspace/Silvermedia/vpn$ openssl pkcs12 -in michal.wesoly.p12 -nocerts -nodes -out michal.wesoly.key
Enter Import Password:
MAC verified OK
kozak127@callisto:~/Workspace/Silvermedia/vpn$ openssl pkcs12 -in michal.wesoly.p12 -clcerts -nokeys -out michal.wesoly.crt
Enter Import Password:
MAC verified OK
######################################
### RUN CLIENT AND MANAGEMENT TOOL ###
######################################
cd ~/Downloads/vpnclient
kozak127@callisto:~/Downloads/vpnclient$ sudo ./vpnclient start
The SoftEther VPN Client service has been started.
kozak127@callisto:~/Downloads/vpnclient$ sudo ./vpncmd
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.21 Build 9613 (English)
Compiled 2016/04/24 16:39:47 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)
Select 1, 2 or 3: 2
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).
Hostname of IP Address of Destination:
Connected to VPN Client "localhost".
######################################
### CREATE VIRTUAL NETWORK ADAPTER ###
######################################
VPN Client>nicCreate
NicCreate command - Create New Virtual Network Adapter
Virtual Network Adapter Name: silvermedia
The command completed successfully.
###########################
### CREATE USER ACCOUNT ###
###########################
VPN Client>accountcreate silvermedia
AccountCreate command - Create New VPN Connection Setting
Destination VPN Server Host Name and Port Number: remote.silvermedia.pl:443
Destination Virtual Hub Name: SILVERMEDIA
Connecting User Name: michal.wesoly
Used Virtual Network Adapter Name: silvermedia
The command completed successfully.
###############################
### ADD KEY AND CERTIFICATE ###
###############################
VPN Client>AccountCertSet silvermedia
AccountCertSet command - Set User Authentication Type of VPN Connection Setting to Client Certificate Authentication
Read X.509 certificate from file name: /home/kozak127/Workspace/Silvermedia/vpn/michal.wesoly.crt
Read private key from file name: /home/kozak127/Workspace/Silvermedia/vpn/michal.wesoly.key
The command completed successfully.
######################
### VERIFY ACCOUNT ###
######################
VPN Client>accountget silvermedia
AccountGet command - Get Setting of VPN Connection Setting
Item |Value
-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------
VPN Connection Setting Name |silvermedia
Destination VPN Server Host Name |remote.silvermedia.pl
Destination VPN Server Port Number |443
Destination VPN Server Virtual Hub Name |SILVERMEDIA
Proxy Server Type |Direct TCP/IP Connection
Verify Server Certificate |Disable
Device Name Used for Connection |silvermedia
Authentication Type |Client Certificate Authentication
User Name |michal.wesoly
Client Certificate for Authentication Use |CN=michal.wesoly, SERIAL="00" (Digest: MD5="XXX", SHA1="XXX")
Number of TCP Connections to Use in VPN Communication|1
Interval between Establishing Each TCP Connection |1
Connection Life of Each TCP Connection |Infinite
Use Half Duplex Mode |Disable
Encryption by SSL |Enable
Data Compression |Disable
Connect by Bridge / Router Mode |Disable
Connect by Monitoring Mode |Disable
No Adjustment for Routing Table |Disable
Do not Use QoS Control Function |Disable
The command completed successfully.
#######################
### CONNECT ACCOUNT ###
#######################
VPN Client>accountconnect silvermedia
AccountConnect command - Start Connection to VPN Server using VPN Connection Setting
The command completed successfully.
#############################
### ENABLE IP4 FORWARDING ###
#############################
kozak127@callisto:~$ sudo echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
kozak127@callisto:~$ sudo sysctl -p
######################
### ALTER IP TABLE ###
######################
# this is not a typo - in vpncmd is silvermedia, in iptables is vpn_silvermedia
kozak127@callisto:~$ sudo dhclient vpn_silvermedia
######################################
### AFTER REBOOT, TO RUN VPN AGAIN ###
######################################
cd ~/Downloads/vpnclient
kozak127@callisto:~/Downloads/vpnclient$ sudo ./vpnclient start
The SoftEther VPN Client service has been started.
kozak127@callisto:~/Downloads/vpnclient$ sudo ./vpncmd
vpncmd command - SoftEther VPN Command Line Management Utility
SoftEther VPN Command Line Management Utility (vpncmd command)
Version 4.21 Build 9613 (English)
Compiled 2016/04/24 16:39:47 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)
Select 1, 2 or 3: 2
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).
Hostname of IP Address of Destination:
Connected to VPN Client "localhost".
VPN Client>accountconnect silvermedia
AccountConnect command - Start Connection to VPN Server using VPN Connection Setting
The command completed successfully.
kozak127@callisto:~$ sudo dhclient vpn_silvermedia
#################
### AND VOLIA ###
#################
@hlbfrancois
Copy link

Hi, can you help? When I use the command 'sudo dhclient vpn_se', it sets up a new nic and assigns an ip, but then softether switches from 'Connected' to 'Connecting'.

The log says this:
2018-02-23 03:07:27.817 VPN Connection Setting "mysetting": The connection has been either disconnected or it failed. Cause: Connection to the server failed. Check network connection and make sure that address and port number of destination server are correct. (code 1).

Thanks!

@florian9600
Copy link

@francoishalbach

Hi, have you been able to solve this issue? I have the same issue on my Ubuntu 16.04 machine. Fun fact is, that on Ubuntu 14.04 it worked just fine. But becouse in a few month 14.04 is not going to be supported anymore I decided to upgrade to 16.04. Now the VPN Client is not working anymore.

@B0GDAN
Copy link

B0GDAN commented Jun 3, 2020

Same problem here. Did you guys found some way to overcome the problem with DHCP on Linux?

@biteableniles
Copy link

biteableniles commented Jul 12, 2022

For me, there is an intermittent issue with IP routing with the linux client. Sometimes the route to the VPN connection is not automatically updated.

In my case, following dhclient and IP address assignment, the IP routing table needs to be updated:

For my example, my local network gateway was 10.146.0.1
My remote network IP was 73.200.69.170

Run "sudo netstat -rn" and take note of the Iface of your current network.

Run "sudo ip route add 73.200.69.170/32 via 10.146.0.1"
Run "sudo ip route del default via 10.146.0.1"

Update with your relevant IP addresses.

Better writeup here:
https://github.com/bgilmer77/SoftEther-VPN-Client-Setup-on-Linux/blob/master/softether-linux-howto.md

To disconnect the VPN and restore normal connections you'd need to restore the default route you deleted. I just restart my computer instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment