ivpn / desktop-app

Official IVPN Desktop app
https://www.ivpn.net/apps/
GNU General Public License v3.0
322 stars 48 forks source link

(Linux) v2ray/obfs4proxy: getting default gateway ip error #339

Closed nyuuzyou closed 4 months ago

nyuuzyou commented 7 months ago

Bug report

Describe your environment

A connection attempt using obfsproxy and v2ray failed due to the error "getting default gateway ip error : Unable to obtain default gateway IP"

Steps to reproduce:

  1. Try connect using v2ray/obfsproxy

Observed Results:


nyuuzyou@debian:~$ ivpn connect -o obfs4 -any -p openvpn
More than one server was found. Taking one random from found servers ...
obfsproxy configuration: obfs4, IAT0
[OpenVPN] Connecting to: Querétaro, MX (Mexico) mx.gw.ivpn.net TCP...
Connecting...
Disconnecting...
Error: failed to connect: connection error: failed to write configuration file: failed to generate openvpn configuration : failed to get local gateway: Unable to obtain default gateway IP
nyuuzyou@debian:~$ ivpn connect -o obfs3 -any -p openvpn
More than one server was found. Taking one random from found servers ...
obfsproxy configuration: obfs3
[OpenVPN] Connecting to: Budapest, HU (Hungary) hu.gw.ivpn.net TCP...
Connecting...
Disconnecting...
Error: failed to connect: connection error: failed to write configuration file: failed to generate openvpn configuration : failed to get local gateway: Unable to obtain default gateway IP
nyuuzyou@debian:~$ ivpn connect -v2ray quic -any
More than one server was found. Taking one random from found servers ...
V2Ray configuration: QUIC
[WireGuard] Connecting to: Frankfurt, DE (Germany) de.wg.ivpn.net UDP:443...
Connecting...
Disconnecting...
Error: failed to connect: failed to start V2Ray: failed to start v2ray: error applying route to remote V2Ray endpoint: getting default gateway ip error : Unable to obtain default gateway IP
nyuuzyou@debian:~$ ivpn connect -v2ray tcp -any
More than one server was found. Taking one random from found servers ...
V2Ray configuration: TCP
[OpenVPN] Connecting to: Sofia, BG (Bulgaria) bg.gw.ivpn.net TCP:80...
Connecting...
Disconnecting...
Error: failed to connect: failed to start V2Ray: failed to start v2ray: error applying route to remote V2Ray endpoint: getting default gateway ip error : Unable to obtain default gateway IP

Expected Results:

Successful connection with obfuscation

Relevant Code:

Nov 30 01:00:05.476 [netinf] Shell exec: /sbin/ip route
Nov 30 01:00:05.478 [prtcl ] ERROR protocol.go:1265:(in github.com/ivpn/desktop-app/daemon/protocol.(*Protocol).processConnectionRequests.func1): failed to start V2Ray: failed to start v2ray: error applying route to remote V2Ray endpoint: getting default gateway ip error : Unable to obtain default gateway IP
Nov 30 01:00:05.478 [prtcl ] [-->] 36804 DisconnectedResp [0]
Nov 30 01:00:05.478 [prtcl ] [-->] 52178 DisconnectedResp [0]
Nov 30 01:00:05.478 [prtcl ] [<--] 52178 Disconnect [5]
Nov 30 01:00:05.478 [prtcl ] [-->] 52178 DisconnectedResp [5]
Nov 30 01:00:05.479 [prtcl ] Client disconnected: 127.0.0.1:52178
Nov 30 01:00:05.479 [prtcl ] Current state not changing
Nov 30 01:00:26.581 [prtcl ] [<--] 36804 APIRequest [57] geo-lookup (IPv6)
Nov 30 01:00:26.581 [api   ] Trying to use alternate API IPs (IPv6)...
Nov 30 01:00:26.581 [prtcl ] [-->] 36804 APIResponse [57] geo-lookup Error!
Nov 30 01:00:26.778 [prtcl ] [<--] 36804 KillSwitchSetEnabled [58]
Nov 30 01:00:26.778 [frwl  ] Disabling...
stenya commented 6 months ago

v.3.13.5

gorkapernas commented 6 months ago

Verified fixed on v.3.13.5, tested on Ubuntu, first, I was able to reproduce the issue on v3.13.4 by configuring the default ip route without metric and then I verified the fix in the newest IVPN beta version. I can confirm that the app is able to establish successful connection with V2ray or obfsproxy when the default ip route does not have metric. This should be good to go.

nyuuzyou commented 6 months ago

I'm still experiencing the same problem with the newly compiled daemon, as described in the initial issue report. Unfortunately, I don't have additional technical details to provide beyond what's already specified in the issue header. The issue persists exactly as initially described, even with the updated daemon.

Version and Environment:

nyuuzyou@debian:~$ ivpn version
Command-line interface for IVPN client (www.ivpn.net)
version:3.13.5 (date:2023-12-18 commit:4262d0576e261b4007500ce180905c8ab08ac2dd) amd64

nyuuzyou@debian:~$ ip route
default via 192.168.50.1 dev enp7s0 onlink 
192.168.50.0/24 dev enp7s0 proto kernel scope link src 192.168.50.25 
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

nyuuzyou@debian:~$ uname -a
Linux debian 6.1.0-16-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.67-1 (2023-12-12) x86_64 GNU/Linux

nyuuzyou@debian:~$ ivpn connect -v2ray tcp -any
More than one server was found. Taking one random from found servers ...
V2Ray configuration: TCP
[OpenVPN] Connecting to: Amsterdam, NL (Netherlands) nl.gw.ivpn.net TCP:80...
Default config : AntiTracker Enabled (block list: 'Oisdbig')
Default config : Custom DNS 192.168.50.50
Connecting...
Disconnecting...
Error: failed to connect: failed to start V2Ray: failed to start v2ray: error applying route to remote V2Ray endpoint: getting default gateway ip error : Unable to obtain default gateway IP
stenya commented 6 months ago

@nyuuzyou Hi. How did you compile the damon? I see that you used the wrong commit version of application sources. You used the commit 4262d0576e261b4007500ce180905c8ab08ac2dd from the master branch. Please, note, that the fix does not exist in the master branch yet and not officially released.

For now, the fix is only available in the test/3.13.5 branch.

nyuuzyou commented 6 months ago

@stenya Hi.

Thank you for pointing out the error. I initially compiled using the master branch, which was indeed a mistake on my part. Following your advice, I have now compiled using the test/3.13.5 branch, and I'm happy to report that the problem no longer occurs in my environment.

stenya commented 4 months ago

v3.14.2 released