seems I need some help connecting from a virtual machine to an outside VPN server.

Here’s what I have:

  1. Home Windows 10 machine (host)
  2. Ubuntu VirtualBox machine running as guest on the above host (192.168.11.2)
  3. A VPN server somewhere on the Internet (172.16.245.1).

After establishing the VPN connection, I am able to connect from my Windows machine to the VPN server just fine by its internal VPN address:

telnet 172.16.245.1 80

(the above command lets me write to the HTTP stream and nginx on the VPN server responds)

I am also able to connect from Ubuntu guest to Windows host:

vagrant@homestead:~$ telnet 192.168.11.1 8000
Trying 192.168.11.1...
Connected to 192.168.11.1.
Escape character is '^]'.

Now I want to establish connection from Ubuntu guest to the outside VPN server. I am adding a route on the guest:

sudo ip route add 172.16.245.0/24 via 192.168.11.1 dev eth1

I verify that the route has been added:

vagrant@homestead:~$ ip route
default via 10.0.2.2 dev eth0 proto dhcp src 10.0.2.15 metric 100 
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 
10.0.2.2 dev eth0 proto dhcp scope link src 10.0.2.15 metric 100 
172.16.245.0/24 via 192.168.11.1 dev eth1 
192.168.11.0/24 dev eth1 proto kernel scope link src 192.168.11.2 

But when I’m trying to connect to 172.16.245.1 (VPN server) from the Ubuntu guest, telnet times out while connecting:

vagrant@homestead:~$ telnet 172.16.245.1 80
Trying 172.16.245.1...
telnet: Unable to connect to remote host: Connection timed out

What am I missing here?

Extra information if it may be helpful, this is how the networking set up for the guest virtual machine:

  • Adapter 1 is NAT
  • Adapter 2 is VirtualBox Host-Only Ethernet Adapter

This is what I see when I run ip addr show on Ubuntu guest:

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 fq_codel state UP group default qlen 1000
    link/ether 08:00:27:3b:5a:da brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
       valid_lft 85795sec preferred_lft 85795sec
    inet6 fe80::a00:27ff:fe3b:5ada/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 08:00:27:5a:59:bc brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.2/24 brd 192.168.11.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe5a:59bc/64 scope link 
       valid_lft forever preferred_lft forever

Leave a Reply

Your email address will not be published. Required fields are marked *