Score:0

prevent ssh connection being lost after connecting to vpn server on Azure ubuntu 20.04 vm

us flag

I've created an Ubuntu 20.04 scale set (2 vms) on Azure and access these vms via ssh from my laptop's shell.

I want one of them to be connected to nordvpn (using nordvpn connect command, default is openvpn connection protocol).

Once the vm connects to nordvpn server the ssh session hangs and no new ssh session can be established, so only hard reset of the vm helps to reconnect to it.

I tried to follow this tutorial but it seems to not work:

Interfaces:

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0d:3a:52:90:00 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.7/24 brd 10.0.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20d:3aff:fe52:9000/64 scope link
       valid_lft forever preferred_lft forever

Routing Table:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    100    0        0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
168.63.129.16   10.0.0.1        255.255.255.255 UGH   100    0        0 eth0
169.254.169.254 10.0.0.1        255.255.255.255 UGH   100    0        0 eth0

vpnbypass routing table created:

# echo "250   vpnbypass" >> /etc/iproute2/rt_tables
# cat /etc/iproute2/rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
250   vpnbypass

Routing rules applied:

ip rule add table vpnbypass from 10.0.0.0/16
ip rule add table vpnbypass to 10.0.0.0/16
ip rule add table vpnbypass to 169.254.169.254
ip rule add table vpnbypass to 168.63.129.16
ip route add table vpnbypass to 10.0.0.0/16 dev eth0
ip route add table vpnbypass default via 10.0.0.1 dev eth0

port 22 and the ip subnet are whitelisted for nordvpn client:

nordvpn whitelist add port 22
nordvpn whitelist add subnet 10.0.0.0/16

After I issue nordvpn connect command the ssh session still hangs.

What am I doing wrong?

Any help is extremely appreciated.

djdomi avatar
za flag
offtopic, i suspect that you want to ask on superuser.com as private, home and anduser questions are not on topic for this business related question requirement
us flag
@djdomi thank you, did as you suggested.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.