16
votes

[I've flagged this question to be deleted by moderator until I get answer to my this question]

My javascript client is working fine when talking to node.js(on Ubuntu, more here) server through WebSocket interface with IPV4 IP address.

Even though my Hosting provider is ready to allocate me IPV4, let me instead use IPV6 since there is limited supply of IPV4 now.

When using the IPV6 IP I'm getting this error:

WebSocket connection to 'ws://[2600:3c00::f03c:91ff:fe73:2b08]:31333/' failed: Error in connection establishment: net::ERR_ADDRESS_UNREACHABLE

I've checked that port 31333 is indeed open using tool: http://www.subnetonline.com/pages/ipv6-network-tools/online-ipv6-port-scanner.php

I've even tried solution as in IPv6 address giveing syntax error in internet explorer-10 websocket -- that is : 2600-3c00-0-0-f03c-91ff-fe73-2b08.ipv6-literal.net

I've run this client and is able to connect to the server when both are running on remote Ubuntu based server:

var WebSocket = require('ws')
  , ws = new WebSocket('ws://[2600:3c00::f03c:91ff:fe73:2b08]:31333');
ws.on('open', function() {
    ws.send('something');
});
ws.on('message', function(message) {
    console.log('received: %s', message);
});

However when I run this same client from my home Windows 7 while the server is remote Ubuntu one, it is not able to connect:

> $ node c2.js events.js:85
>       throw er; // Unhandled 'error' event
>             ^ Error: connect ENETUNREACH
>     at exports._errnoException (util.js:746:11)
>     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)

I've even run this code in Google Chrome :

var ws = new WebSocket("ws://[2600:3c00::f03c:91ff:fe73:2b08]:31333");

ws.onerror = function(err)
{ 
    console.log(err);
    alert("Connection is error..."); 
};

But I get the same error:

WebSocket connection to 'ws://[2600:3c00::f03c:91ff:fe73:2b08]:31333/' failed: Error in connection establishment: net::ERR_ADDRESS_UNREACHABLE websocket.html:37 Event

What could be the issue?

PS: at the moment I've stopped the server at port 31333.

2
Did you check whether your firewall is blocking access? E.g. if you use the IP for localhost and listen on your local IPv6 address, then connecting to ws://[::1]:31333 seems to work as expected (Chrome 44.0.2403.125, Linux). - Rob W
At the moment client server are able to communicate when on the same server. - user5858
Does your (local) network connection support IPv6? - Rob W
TCP/IPv6 is checked in Local Area Connection properties in my Win7 PC. and I'm not able to ping to even ipv6.google.com from 3 Windows-7 computers I've tried. - user5858
So you're not getting a reply when you use ping -6 ipv6.google.com (or on Linux: ping6 ipv6.google.com)? Then you've found your problem, and you should try to get IPv6 connectivity (this is not an issue with Chrome or your application, but your network). - Rob W

2 Answers

2
votes

IPv6 is not enabled on your Realtek PCIe GBE Family Controller. If it was, there would be a line saying "Link-local IPv6 Address" in the ipconfig result.

Go to control panel > Network > Change Adapter Settings > Right click on the adapter > Properties. Check IPv6 on.

0
votes

IPv6 will need to be enabled on the system, and every router between it and the ISP, and the ISP must be IPv6 ready and providing it to the end-user. The reason nslookup works is that it is just returning AAAA records, not actually connecting via IPv6. IPv4 cannot directly communicate with IPv6, or vice versa. You can't ping an IPv6 host with an IPv4 host.