Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Can't connect via non-primary network connection (ENETUNREACH) #27

Closed
Dador opened this issue Feb 12, 2014 · 21 comments
Closed

Can't connect via non-primary network connection (ENETUNREACH) #27

Dador opened this issue Feb 12, 2014 · 21 comments

Comments

@Dador
Copy link

Dador commented Feb 12, 2014

dispatch list:

C:\windows\system32>dispatch list
Wireless connection
    fe80::28b9:89c2:6feb:bc63 (IPv6)
    192.168.0.104 (IPv4)

3G connection
    10.215.12.205 (IPv4)

Loopback Pseudo-Interface 1
    ::1 (IPv6, internal)
    127.0.0.1 (IPv4, internal)

Ethernet 2
    2001:0:9d38:90d7:2837:3cb1:a29b:e90e (IPv6)
    fe80::2837:3cb1:a29b:e90e (IPv6)

3G (10.215.12.205) is primary connection in Windows. I thinks so cause whatismyip.com says that I have ip from 3G when I open it in browser without proxy.
Wi-fi (192.168.0.104) is non-primary connection.

I start proxy on non-primary connection:

C:\windows\system32>dispatch start 192.168.0.104
SOCKS server started on localhost:1080
Dispatching to addresses 192.168.0.104@1

And get errors:

     error [6d525a] serverConnection
           Error: connect ENETUNREACH
               at errnoException (net.js:901:11)
               at Object.afterConnect [as oncomplete] (net.js:892:19)
     error [6d525a] clientConnection
           Error: read ECONNRESET
               at errnoException (net.js:901:11)
               at TCP.onread (net.js:556:19)
     error [7dd649] serverConnection
           Error: connect ENETUNREACH
               at errnoException (net.js:901:11)
               at Object.afterConnect [as oncomplete] (net.js:892:19)
     error [7dd649] clientConnection
           Error: read ECONNRESET
               at errnoException (net.js:901:11)
               at TCP.onread (net.js:556:19)
     error [18590a] serverConnection
           Error: connect ENETUNREACH
               at errnoException (net.js:901:11)
               at Object.afterConnect [as oncomplete] (net.js:892:19)
     error [18590a] clientConnection
           Error: read ECONNRESET
               at errnoException (net.js:901:11)
               at TCP.onread (net.js:556:19)

I see the same errors when I start proxy using both internet connections. There is no errors when I start proxy using primary internet connection.
Log with debug enabled

I already tried on 3 computers (2 Win7 and 1 Linux) - on all of them proxy using non-primary connection is not working.

Am I'm missed some setting or something?

BTW, thanks for your program. I've dreamed of such thing for the whole time.

@alexkirsz
Copy link
Owner

Is the wi-fi connection working properly on its own? Have you tried starting a proxy on the wi-fi connection only?

@Dador
Copy link
Author

Dador commented Feb 12, 2014

Yes, both connections (wi-fi and 3g) working properly.
I'm turned off 3g connection and then started proxy using wi-fi connection. Proxy working perfectly.

Debug log, but there is nothing useful cause proxy is working.

@alexkirsz
Copy link
Owner

Your system might be disabling the secondary connection while the primary is running. Could you try to set the wi-fi as your primary connection and the 3g as your secondary connection?

@Dador
Copy link
Author

Dador commented Feb 12, 2014

Ping to wi-fi router is working means that connection is not disabled.


I think calling it "primary" not absolutely correct. I don't found any settings (without custom programs) that sets connection priority. What I'm call "primary" is just connection that Windows prefer.

As I mentioned before I'm tried on 3 diffrent computers. First is just my Windows. Second one is almost clean installation of Windows. The last one is clean installation of Linux (Ubuntu). The problem is same everywhere.

Also I tried connecting only two modems (without wi-fi connection). Result pretty similar: start proxy with first connection - proxy wokring, start proxy with other connection - proxy doesn't working (or vice versa - first connection doesn't working and the second connection is working).


My first guess is that problem somewhere in "route" settings. I don't touched them yet but seen solutions using these settings.
My second guess is that problem may be solved after installing Connectify. It has similar function and maybe it automatically setup routes. I'll try to install Connectify.


Feel free to express guesses. I can try any variants or give access to my computer if that necessary.

@alexkirsz
Copy link
Owner

To set adapter priority order on Windows, go to Control Panel -> Network and Internet -> Network and sharing center -> Change adapter settings, press Alt on the keyboard, then go to Advanced -> Advanced settings.

@Dador
Copy link
Author

Dador commented Mar 23, 2014

Adapter priority did not help.

I surge against this problem for almost a month. I tryed others proxy servers, tryed writing my own on C#. All of them has same problem - once I connect two network connections at the same time then only one of two connections works.

I can't understand why it don't working for me and working for you and others users of dispatch-proxy.

Can you say which OS you are using? And also which network connections do you dispatch (3G, wire, wireless)?

@alexkirsz
Copy link
Owner

I've tried it on Mac OS X and Windows, using 3G from my phone + wifi, and wifi + ethernet connection. I've never run into your problem.

@Dador
Copy link
Author

Dador commented Mar 24, 2014

Thank you. Which version of Windows - 7 or 8? 32-bit or 64-bit?

@alexkirsz
Copy link
Owner

Windows 8 and 8.1 64bit.

@tchlyah
Copy link

tchlyah commented Dec 16, 2014

Did you manage to solve your problem? Cause I have the exact same problem on my raspberry pi.
Maybe it's caused by a newer version of nodejs. With which version it work?

@Dador
Copy link
Author

Dador commented Dec 17, 2014

No, I wasn't solved it. I had similar problems with other proxy servers too (only one internet connection works at the same time). So I decided that problem in my hardware, drivers or something like this.

P.S. Cause I still needed several connections per one PC, I created a virtual machine per each connection and launched proxy server on each of this VMs. That's pretty dirty trick but it works.

@tchlyah
Copy link

tchlyah commented Dec 17, 2014

I finally could solve it, but with Linux. I'm launching the proxy in a Raspberry Pi, and I'm using it on my PC and phone. It working great.

I'll write the solution in an other Ubuntu 12.04 not working issue.

@Stepman123
Copy link

The same problem watching on windows XP.
Solution not found?

@Stepman123
Copy link

MS TCP Loopback interface
127.0.0.1 (IPv4, internal)

C:\Documents and Settings\Alex>dispatch start 192.168.42.163 10.136.157.215 -p 1098
SOCKS server started on localhost:1098
Dispatching to addresses 192.168.42.163@1, 10.136.157.215@1
error [802848] serverConnection
Error: connect EHOSTUNREACH 145.108.224.57:280
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [802848] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [95a998] serverConnection
Error: connect EHOSTUNREACH 145.108.224.57:280
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [95a998] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
^CЗавершить выполнение пакетного файла [Y(да)/N(нет)]? y

C:\Documents and Settings\Alex>dispatch list
Подключение по локальной сети 34
192.168.42.163 (IPv4)

Подключение по локальной сети 27
192.168.0.1 (IPv4)

MTS
10.136.157.215 (IPv4)

MS TCP Loopback interface
127.0.0.1 (IPv4, internal)

C:\Documents and Settings\Alex>dispatch start 192.168.42.163 10.136.157.215 -p 1098
SOCKS server started on localhost:1098
Dispatching to addresses 192.168.42.163@1, 10.136.157.215@1
error [0fdb27] serverConnection
Error: connect EHOSTUNREACH 145.108.224.57:280
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [0fdb27] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [945206] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [63298c] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [63298c] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [594f86] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [594f86] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
^CЗавершить выполнение пакетного файла [Y(да)/N(нет)]? y

C:\Documents and Settings\Alex>dispatch list
Подключение по локальной сети 34
192.168.42.163 (IPv4)

Подключение по локальной сети 27
192.168.0.1 (IPv4)

MTS
10.161.7.169 (IPv4)

MS TCP Loopback interface
127.0.0.1 (IPv4, internal)

C:\Documents and Settings\Alex>dispatch start 192.168.42.163 10.161.7.169 -p 1098
SOCKS server started on localhost:1098
Dispatching to addresses 192.168.42.163@1, 10.161.7.169@1
error [7f5f1a] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [7f5f1a] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [b1b2cd] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [b1b2cd] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [4e8b9d] serverConnection
Error: connect EHOSTUNREACH 145.108.224.57:280
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [4e8b9d] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [91f67b] serverConnection
Error: bind EADDRNOTAVAIL 192.168.42.163
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at connect (net.js:809:18)
at net.js:929:9
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
error [91f67b] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [59f40c] serverConnection
Error: connect EHOSTUNREACH 145.108.224.57:280
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [59f40c] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [df7c23] serverConnection
Error: bind EADDRNOTAVAIL 192.168.42.163
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at connect (net.js:809:18)
at net.js:929:9
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
error [df7c23] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [9c4bb7] serverConnection
Error: connect EHOSTUNREACH 145.108.224.57:280
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [9c4bb7] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [64c470] serverConnection
Error: bind EADDRNOTAVAIL 192.168.42.163
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at connect (net.js:809:18)
at net.js:929:9
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
error [64c470] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [cda949] serverConnection
Error: bind EADDRNOTAVAIL 192.168.42.163
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at connect (net.js:809:18)
at net.js:929:9
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
error [cda949] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [249919] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [249919] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [10ef45] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [10ef45] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [8efae1] serverConnection
Error: bind EADDRNOTAVAIL 192.168.42.163
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at connect (net.js:809:18)
at net.js:929:9
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
error [8efae1] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [b07c7e] serverConnection
Error: bind EADDRNOTAVAIL 192.168.42.163
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at connect (net.js:809:18)
at net.js:929:9
at nextTickCallbackWith0Args (node.js:453:9)
at process._tickCallback (node.js:382:13)
error [b07c7e] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [85ecbd] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [85ecbd] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [958d5e] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [958d5e] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
^CЗавершить выполнение пакетного файла [Y(да)/N(нет)]? y

C:\Documents and Settings\Alex>dispatch list
Подключение по локальной сети 35
10.161.7.169 (IPv4)

Подключение по локальной сети 27
192.168.0.1 (IPv4)

MS TCP Loopback interface
127.0.0.1 (IPv4, internal)

C:\Documents and Settings\Alex>dispatch list
Подключение по локальной сети 35
10.161.7.169 (IPv4)

Подключение по локальной сети 34
192.168.42.207 (IPv4)

Подключение по локальной сети 27
192.168.0.1 (IPv4)

MS TCP Loopback interface
127.0.0.1 (IPv4, internal)

C:\Documents and Settings\Alex>dispatch start 192.168.42.207 10.161.7.169 -p 1098
SOCKS server started on localhost:1098
Dispatching to addresses 192.168.42.207@1, 10.161.7.169@1
error [a731dd] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [067579] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [067579] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)
error [56031d] serverConnection
Error: connect EHOSTUNREACH 149.255.59.157:80
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete
error [56031d] clientConnection
Error: read ECONNRESET
at exports._errnoException (util.js:856:11)
at TCP.onread (net.js:546:26)

@Dador
Copy link
Author

Dador commented Feb 14, 2016

No, I didn't found an solution.
I've seen some solutions with routes (Windows) or iptables (Linux) but (if I remember correctly) they didn't worked for me. Also they not convenient for 3G/4G modem cause IP address changes every time you reconnect (and these route rules required exact IP address).
P.S. I think it's a good idea to test/debug on Windows 7/8/10 or on Linux but not on Windows XP.

@Stepman123
Copy link

I used manually routes and now everything works.
It is necessary to prescribe the route 0.0.0.0 0.0.0.0 ... and for each network card to prescribe the same metric.
Or, if you are using a dial-up wan modem then you need to disable the option "use default gateway"

@Dador
Copy link
Author

Dador commented Mar 11, 2016

@Stepman123, thanks, suggest to disable "use default gateway" was very useful. BTW, metric doesn't matter. It working with different metrics.

So, here is complete solution (for the ones who would find this page in Google).

Solution

0) Disable "use default gateway" if using 3G/4G dongle

If you using 3G/4G dongle (modem) then you need to disable option "use default gateway" (that can be done in "Network connections" -> right click on connection -> Properties -> "Networking" tab -> select Version 4 -> click Propetries -> uncheck "use default gateway")

Then you need to add route for non-primary network. In my case I have Wi-Fi (gateway 192.168.0.1) and dongle (gateway "On-link" or 0.0.0.0).

1) Open cmd as Administrator.

2) Run route print -4 to check existing routes. We interested in routes with network address 0.0.0.0.

In my case I have 0.0.0.0 route only for Wi-Fi (192.168.0.1) and there is no 0.0.0.0 route for dongle. So I need to add 0.0.0.0 route for dongle.
Output of route print -4:

          0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.110     25
         10.0.0.0        255.0.0.0         On-link     10.203.127.81     26
    10.203.127.81  255.255.255.255         On-link     10.203.127.81    281
   10.255.255.255  255.255.255.255         On-link     10.203.127.81    281
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306

3) Add route for non-primary network:

route -p add 0.0.0.0 mask 0.0.0.0 [gateway] metric 50 if [network interface id]

Replace [gateway] with gateway (for example 192.168.0.1 in case of Wi-Fi or 0.0.0.0 in case of dongle).
Replace [network interface id], you can find it in the begining of output route print -4.

Example for Wi-Fi:
route -p add 0.0.0.0 mask 0.0.0.0 192.168.0.1 metric 50 if 2
Example for dongle:
route -p add 0.0.0.0 mask 0.0.0.0 0.0.0.0 metric 50 if 3

@Dador
Copy link
Author

Dador commented Mar 11, 2016

@Morhaus, I think you can close this issue.
Also I think it's good idea to add link to solution in the instruction for Windows users.

@Stepman123
Copy link

If used 2 3G modem, there's no way to add persistent routes.
ID and gateways are everytime changing when you reconnect.

Here is the list of interfaces:

0x1 ........................... MS TCP Loopback interface
0x2 ...00 30 18 15 d1 df ...... VIA PCI 10/100Mb Fast Ethernet

0x60004 ...00 1e 10 1f 3e 8b ...... HUAWEI Mobile Connect - 3G Network Card #5 - Kerio Control
0x280006 ...00 53 45 00 00 00 ...... WAN (PPP/SLIP) Interface
0x2a0005 ...00 53 45 00 00 00 ...... WAN (PPP/SLIP) Interface

@kjames2001
Copy link

found the solution to this (the simple way) for windows 10 (could work on windows 7/8/xp too).
go to "Network connections" -> right click on connection -> Properties -> "Networking" tab -> select Version 4 -> click Propetries -> Advanced -> untick Auto metric -> enter any number below it -> click OK.
See my screenshot if my translation is wrong.
repeat this for all the networks you want to use together, and use the same number under metric for all of them.
Run dispatch, and voila.
2020-03-20 100628

@rlindsberg
Copy link
Collaborator

found the solution to this (the simple way) for windows 10 (could work on windows 7/8/xp too).
go to "Network connections" -> right click on connection -> Properties -> "Networking" tab -> select Version 4 -> click Propetries -> Advanced -> untick Auto metric -> enter any number below it -> click OK.
See my screenshot if my translation is wrong.
repeat this for all the networks you want to use together, and use the same number under metric for all of them.
Run dispatch, and voila.
2020-03-20 100628

Hi and thank you so much for sharing with us the solution!

I hope you liked this tool and the owner will come back for maintenance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants