I've a Google Compute Engine running on Ubuntu 16.04, where i want to start a node.js Websocket Server. Whenever i try to start listening on the external IP, i get the error: "Cannot assign requested address". It works with my internal IP or 127.0.0.1, but then i can not access it from outside.
I've created all the necessary firewall rules.
I can not see my external IP when i run ifconfig. Is this a problem? If so, how could i solve this? I already tried to setup a new instance.
And there is no other process listening on that port.
I guess you're binding explicitly to the external IP? You can try omitting the host parameter, which effectively binds to all interfaces, both internal IP and external IP: NodeJs: server.listen(port[, hostname][, backlog][, callback])
If you run
ifconfig
on the VM, you will find the external IP is not there. I believe the external IP is a virtual IP in Compute Engine, the underlying networking infrastructure automatically translates it to the internal IP.