I am using SoftEther VPN 5.01 Build 9674 in Ubuntu 22.04 to connect to a private network.
I have done the configurations in vpnclient and I am using the below script to establish the connection.
#!/bin/bash
sudo vpnclient start
echo 'Waiting 3s'
sleep 3
echo
echo 'Getting IP'
sudo dhclient vpn_vpn
echo
echo 'CURRENT ROUTES'
sudo ip route show
echo
echo 'Removing default route'
sudo ip route del default dev vpn_vpn
echo
echo 'CURRENT ROUTES'
sudo ip route show
echo
echo 'ADDING ROUTE'
sudo ip route add 172.16.20.0/24 via 172.16.0.152
echo
echo 'CURRENT ROUTES'
sudo ip route show
echo
echo "PINGING"
ping 172.16.20.3
Below shows the relevant output once the script is executed
trikto@hp-notebook:~/Downloads$ sudo ./vpn_start.sh
Getting IP
RTNETLINK answers: File exists
CURRENT ROUTES
default via 172.16.0.8 dev vpn_vpn
default via 192.168.28.25 dev wlo1 proto dhcp metric 600
169.254.0.0/16 dev wlo1 scope link metric 1000
172.16.0.0/22 dev vpn_vpn proto kernel scope link src 172.16.2.112
192.168.28.0/24 dev wlo1 proto kernel scope link src 192.168.28.1 metric 600
Removing default route
CURRENT ROUTES
default via 192.168.28.25 dev wlo1 proto dhcp metric 600
169.254.0.0/16 dev wlo1 scope link metric 1000
172.16.0.0/22 dev vpn_vpn proto kernel scope link src 172.16.2.112
192.168.28.0/24 dev wlo1 proto kernel scope link src 192.168.28.1 metric 600
ADDING ROUTE
CURRENT ROUTES
default via 192.168.28.25 dev wlo1 proto dhcp metric 600
169.254.0.0/16 dev wlo1 scope link metric 1000
172.16.0.0/22 dev vpn_vpn proto kernel scope link src 172.16.2.112
172.16.20.0/24 via 172.16.0.152 dev vpn_vpn
192.168.28.0/24 dev wlo1 proto kernel scope link src 192.168.28.1 metric 600
PINGING
PING 172.16.20.3 (172.16.20.3) 56(84) bytes of data.
64 bytes from 172.16.20.3: icmp_seq=1 ttl=63 time=623 ms
64 bytes from 172.16.20.3: icmp_seq=2 ttl=63 time=303 ms
64 bytes from 172.16.20.3: icmp_seq=3 ttl=63 time=294 ms
64 bytes from 172.16.20.3: icmp_seq=4 ttl=63 time=306 ms
64 bytes from 172.16.20.3: icmp_seq=5 ttl=63 time=302 ms
64 bytes from 172.16.20.3: icmp_seq=6 ttl=63 time=301 ms
64 bytes from 172.16.20.3: icmp_seq=7 ttl=63 time=307 ms
64 bytes from 172.16.20.3: icmp_seq=8 ttl=63 time=525 ms
64 bytes from 172.16.20.3: icmp_seq=9 ttl=63 time=434 ms
64 bytes from 172.16.20.3: icmp_seq=10 ttl=63 time=400 ms
64 bytes from 172.16.20.3: icmp_seq=11 ttl=63 time=323 ms
64 bytes from 172.16.20.3: icmp_seq=12 ttl=63 time=306 ms
64 bytes from 172.16.20.3: icmp_seq=13 ttl=63 time=292 ms
^C
--- 172.16.20.3 ping statistics ---
28 packets transmitted, 13 received, 53.5714% packet loss, time 27354ms
rtt min/avg/max/mdev = 292.006/362.782/623.087/100.859 ms
Parallelly I monitored ifconfig.
The interface vpn_vpn gets created but goes down after a while. That's the reason the initial ping worked but later on, it had stopped.
I have also monitored /var/log/syslog. It doesn't give any detailed error descriptions, but only shows that the interface is down.
Please guide me on further troubleshooting steps to fix this issue.