# Lima with VPN

**URL:** https://discourse.roots.io/t/lima-with-vpn/27081
**Category:** trellis
**Tags:** trellis
**Created:** 2024-05-01T23:21:46Z
**Posts:** 7

## Post 1 by @adleviton — 2024-05-01T23:21:46Z

Is there a way or can anyone point me in the right direction of using Lima with a VPN (Express VPN)? With the VPN turned on, I get the following error

`INFO[0060] [hostagent] 2024/05/01 19:39:16 tcpproxy: for incoming conn 127.0.0.1:54814, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused `

`DEBU[0060] [hostagent] stdout="", stderr="kex_exchange_identification: Connection closed by remote host\r\nConnection closed by 127.0.0.1 port 54742\r\n", err=failed to execute script "ssh": stdout="", stderr="kex_exchange_identification: Connection closed by remote host\r\nConnection closed by 127.0.0.1 port 54742\r\n": exit status 255 `

---

## Post 2 by @Tetrahedrax — 2024-05-02T13:08:13Z

Weird. I use Lima with PrivateVPN using the WireGuard client.

Are you using the official WireGuard client or are you using the Express VPN client?

---

## Post 3 by @adleviton — 2024-05-02T17:30:57Z

I’m using the Express VPN client.

---

## Post 4 by @Tetrahedrax — 2024-05-03T11:24:55Z

Nice. Does it work if you try the WireGuard client?

---

## Post 5 by @adleviton — 2024-05-04T17:08:18Z

Looks like [Express VPN is incompatible with Wireguard](https://www.expressvpn.com/what-is-vpn/protocols).

---

## Post 6 by @Tetrahedrax — 2024-05-06T08:24:46Z

Well that’s… something.

Weird. I really thought every VPN service supported it these days.

---

## Post 7 by @adleviton — 2024-06-26T23:36:26Z

Just playing around with this once again. With Express VPN enabled, it spends about 2 minutes cycling through a number of ports (shown below). And then the virtual machine is “running” but not accessible. If Express VPN is turned off, it takes 18 seconds to boot up without issue.

**With Express VPN Enabled**

```
INFO[0000] SSH Local Port: 56010                        
INFO[0000] [hostagent] [VZ] - vm state change: running  
INFO[0000] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0010] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0010] [hostagent] 2024/06/26 19:27:51 tcpproxy: for incoming conn 127.0.0.1:56014, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0020] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0020] [hostagent] 2024/06/26 19:28:01 tcpproxy: for incoming conn 127.0.0.1:56015, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0030] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0030] [hostagent] 2024/06/26 19:28:11 tcpproxy: for incoming conn 127.0.0.1:56017, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0040] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0040] [hostagent] 2024/06/26 19:28:21 tcpproxy: for incoming conn 127.0.0.1:56018, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0050] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0050] [hostagent] 2024/06/26 19:28:31 tcpproxy: for incoming conn 127.0.0.1:56019, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0060] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0060] [hostagent] 2024/06/26 19:28:41 tcpproxy: for incoming conn 127.0.0.1:56020, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0070] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0070] [hostagent] 2024/06/26 19:28:51 tcpproxy: for incoming conn 127.0.0.1:56022, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0081] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0081] [hostagent] 2024/06/26 19:29:01 tcpproxy: for incoming conn 127.0.0.1:56024, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0091] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0091] [hostagent] 2024/06/26 19:29:12 tcpproxy: for incoming conn 127.0.0.1:56025, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0101] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0101] [hostagent] 2024/06/26 19:29:22 tcpproxy: for incoming conn 127.0.0.1:56027, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0111] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0111] [hostagent] 2024/06/26 19:29:32 tcpproxy: for incoming conn 127.0.0.1:56028, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0121] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0121] [hostagent] 2024/06/26 19:29:42 tcpproxy: for incoming conn 127.0.0.1:56030, error dialing "192.168.5.15:22": connect tcp 192.168.5.15:22: connection was refused 
INFO[0131] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0131] [hostagent] The essential requirement 1 of 2 is satisfied 
INFO[0131] [hostagent] Waiting for the essential requirement 2 of 2: "user session is ready for ssh" 
INFO[0134] [hostagent] The essential requirement 2 of 2 is satisfied 
INFO[0134] [hostagent] Waiting for the guest agent to be running 
INFO[0134] [hostagent] Guest agent is running           
INFO[0134] [hostagent] Waiting for the final requirement 1 of 1: "boot scripts must have finished" 
INFO[0134] [hostagent] Forwarding TCP from 127.0.0.1:11211 to 127.0.0.1:11211 
WARN[0135] [hostagent] failed to set up forwarding tcp port 11211 (negligible if already forwarded) 
INFO[0135] [hostagent] Forwarding TCP from 0.0.0.0:80 to 127.0.0.1:80 
INFO[0135] [hostagent] Forwarding "0.0.0.0:80" (guest) to "/tmp/lima-psl-127.0.0.1-80-1679964575/sock" (host) 
INFO[0135] [hostagent] The final requirement 1 of 1 is satisfied
```

**With Express VPN Disabled**

```
INFO[0000] SSH Local Port: 56167                        
INFO[0000] [hostagent] [VZ] - vm state change: running  
INFO[0000] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0010] [hostagent] Waiting for the essential requirement 1 of 2: "ssh" 
INFO[0011] [hostagent] The essential requirement 1 of 2 is satisfied 
INFO[0011] [hostagent] Waiting for the essential requirement 2 of 2: "user session is ready for ssh" 
INFO[0014] [hostagent] The essential requirement 2 of 2 is satisfied 
INFO[0014] [hostagent] Waiting for the guest agent to be running 
INFO[0014] [hostagent] Guest agent is running           
INFO[0014] [hostagent] Waiting for the final requirement 1 of 1: "boot scripts must have finished" 
INFO[0014] [hostagent] Forwarding TCP from 127.0.0.1:11211 to 127.0.0.1:11211 
WARN[0014] [hostagent] failed to set up forwarding tcp port 11211 (negligible if already forwarded) 
INFO[0014] [hostagent] Forwarding TCP from 0.0.0.0:80 to 127.0.0.1:80 
INFO[0014] [hostagent] Forwarding "0.0.0.0:80" (guest) to "/tmp/lima-psl-127.0.0.1-80-730225602/sock" (host) 
INFO[0014] [hostagent] Stopping forwarding "0.0.0.0:80" (guest) to "/tmp/lima-psl-127.0.0.1-80-730225602/sock" (host) 
WARN[0014] [hostagent] failed to set up forwarding tcp port 80 (negligible if already forwarded) 
INFO[0014] [hostagent] Not forwarding TCP 0.0.0.0:22    
INFO[0014] [hostagent] Not forwarding TCP 127.0.0.53:53 
INFO[0014] [hostagent] Forwarding TCP from 127.0.0.1:3306 to 127.0.0.1:3306 
WARN[0014] [hostagent] failed to set up forwarding tcp port 3306 (negligible if already forwarded) 
INFO[0014] [hostagent] Forwarding TCP from [::]:80 to 127.0.0.1:80 
INFO[0014] [hostagent] Forwarding "[::]:80" (guest) to "/tmp/lima-psl-127.0.0.1-80-4217968089/sock" (host) 
INFO[0014] [hostagent] Stopping forwarding "[::]:80" (guest) to "/tmp/lima-psl-127.0.0.1-80-4217968089/sock" (host) 
WARN[0014] [hostagent] failed to set up forwarding tcp port 80 (negligible if already forwarded) 
INFO[0014] [hostagent] Forwarding TCP from [::]:8025 to 127.0.0.1:8025 
WARN[0014] [hostagent] failed to set up forwarding tcp port 8025 (negligible if already forwarded) 
INFO[0014] [hostagent] Forwarding TCP from [::]:1025 to 127.0.0.1:1025 
WARN[0015] [hostagent] failed to set up forwarding tcp port 1025 (negligible if already forwarded) 
WARN[0015] [hostagent] connection to the guest agent was closed unexpectedlyunexpected EOF 
ERRO[0016] [hostagent] r.CreateEndpoint() = no route to host 
INFO[0017] [hostagent] The final requirement 1 of 1 is satisfied
```
