Quantcast
Channel: Active questions tagged openvpn - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 823

Allow SSH connection to machine connected to VPN

$
0
0

My problem:

I am using Ubuntu 22.04 with a VPN from ExpressVPN set up using their cli tool (but I can also set it up with OpenVPN).

Before I started using the VPN I forwarded port 22 on my home router and I was able to access the machine via ssh from outside my network.

Now, when the machine is connected to the VPN, I am not able to connect via ssh.

What I tried:First I used tcpdump to ascertain that the problem was what I was thinking:the inbound connection comes in from the default interface connected to my router but the outbound packets are sent to the interface created by ExpressVPN/OpenVPN tun0.

Partial output of tcpdump:

19:17:22.488812 enp5s0 In  IP [src ip omitted] > 192.168.1.20.ssh: Flags [S], seq 2135016686, win 65535, options [mss 1400,sackOK,TS val 58875528 ecr 0,nop,wscale 9], length 0    19:17:22.488853 tun0  Out IP 192.168.1.20.ssh > [src ip omitted]: Flags [S.], seq 2642908921, ack 2135016687, win 64900, options [mss 1310,sackOK,TS val 638298497 ecr 58875528,nop,wscale 7], length 0    19:17:23.514229 tun0  Out IP 192.168.1.20.ssh > [src ip omitted]: Flags [S.], seq 2642908921, ack 2135016687, win 64900, options [mss 1310,sackOK,TS val 638299523 ecr 58875528,nop,wscale 7], length 0    19:17:23.515183 enp5s0 In  IP [src ip omitted] > 192.168.1.20.ssh: Flags [S], seq 2135016686, win 65535, options [mss 1400,sackOK,TS val 58876582 ecr 0,nop,wscale 9], length 0    19:17:23.515204 tun0  Out IP 192.168.1.20.ssh > [src ip omitted]: Flags [S.], seq 2642908921, ack 2135016687, win 64900, options [mss 1310,sackOK,TS val 638299524 ecr 58875528,nop,wscale 7], length 0    19:17:25.515204 enp5s0 In  IP [src ip omitted] > 192.168.1.20.ssh: Flags [S], seq 2135016686, win 65535, options [mss 1400,sackOK,TS val 58878582 ecr 0,nop,wscale 9], length 0    19:17:25.515227 tun0  Out IP 192.168.1.20.ssh > [src ip omitted]: Flags [S.], seq 2642908921, ack 2135016687, win 64900, options [mss 1310,sackOK,TS val 638301524 ecr 58875528,nop,wscale 7], length 0    19:17:27.546040 tun0  Out IP 192.168.1.20.ssh > [src ip omitted]: Flags [S.], seq 2642908921, ack 2135016687, win 64900, options [mss 1310,sackOK,TS val 638303555 ecr 58875528,nop,wscale 7], length 0    

I tried following the instructions provided in the answers in this threadHow to allow ssh into terminal after connecting to VPN serverwithout success.

I can't understand why the proposed solution does not work.

In essence what I need is a way to keep connections opened from outside my network via my public IP on the interface that is assigned to that network and not to tun0.

Is it possible to do this by manipulating routes from the ovpn definition (or command line)?Or is it better to use iptables?Or maybe the route I added using the solution proposed was not correct?


Viewing all articles
Browse latest Browse all 823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>