I'm trying to make an SSH connection to my VPN server.
I'm connection the VPN with openConnect like this
echo PASS | sudo openconnect --juniper https://example/ -u user --passwd-on-stdin
This will by my route -n
result
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 tun0
0.0.0.0 192.168.1.254 0.0.0.0 UG 100 0 0 enp3s0
151.151.91.171 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
151.151.91.9 192.168.1.254 255.255.255.255 UGH 0 0 0 enp3s0
161.251.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp3s0
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 enp3s0
I can ssh to my target witch in my case is
ssh [email protected] -p 22
IT WORKS!
But,
since I need to change the traffic to enp3s0 I'll use this command (I'm adding vpn-slice)
echo PASS | sudo openconnect --juniper https://example/ -u user --passwd-on-stdin -s 'vpn-slice 192.168.1.92'
But now I cant ssh to my destination, It will just hang
Also my route changed to this
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 enp3s0
0.0.0.0 192.168.1.254 0.0.0.0 UG 100 0 0 enp3s0
151.151.0.4 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
151.151.0.4 0.0.0.0 255.255.255.255 UH 1 0 0 tun0
151.151.0.5 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
151.151.0.5 0.0.0.0 255.255.255.255 UH 1 0 0 tun0
151.151.91.9 192.168.1.254 255.255.255.255 UGH 0 0 0 enp3s0
161.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp3s0
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 enp3s0
192.168.1.92 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
I tried to use -b
option with ssh
e.g ssh -b 151.151.91.179(local IP4) [email protected](destination) -p 22
but had no result
Question
How can I choose my tun0 route when SSH'ing to my destination