Cannot access to WSL2 port opened via IPv6 from Windows host - node.js

I have a node-server running at WSL2 Ubuntu-20.04.
netstat -tulpn in WSL shows the following ports:
The ports specified as 0.0.0.0:8080 can be accessed in both WSL and Windows via 127.0.0.1:8080 url
My issue is that the ports specified as :::3006 can be accessed via 127.0.0.1:3006 only inside WSL, but from Windows, it works only via the network URL like http://172.28.100.200:3006.
When I send the request to 127.0.0.1:3006 from Windows, there is no connection error, but the server inside WSL does not receive it while using the network address, it does.
How can I investigate this and make the Windows port at 127.0.0.1:3006 forward requests into the same port in WSL?
UPDATE:
So I solved this by adding a port proxy, but again, WSL network IP is needed for this to work:
Any chance to avoid using network IP?

Related

Connecting to host from inside a docker container on linux requires opening firewall port

Background: I'm trying to have XDebug connect to my IDE from within a docker container (my php app is running inside a container on my development machine). On my Macbook, it has no issue doing this. However, on linux, I discovered that from within the container, the port I was using (9000) was not visibile on the host gateway (Using sudo nmap -sT -p- 172.20.0.1 where 172.20.0.1 is my host gateway in docker).
I was able to fix this issue by opening port 9000 on my development machine (sudo ufw allow 9000/tcp). Once I did this, the container could see port 9000 on the host gateway.
My Question: Is this completely necessary? I don't love the idea of opening up a firewall port just so a docker container, running on my machine, can connect to it. Is there a more secure alternative to this?
From what you've told us, opening the port does sound necessary. If a firewall blocks a port, all traffic over that port is blocked and you won't be able to use the application on the container from the host machine.
What you can do to make this more secure is to specify a specific interface to open the port for as specified here:
ufw allow in on docker0 port 9000 proto tcp
Obviously replace docker0 with the docker interface on your machine. You can find this by looking at the output of ip address show or by following the steps here if the interface name is not obvious.

How do I install Gitlab on a VM?

I installed Gitlab on a VMWare VM, using NAT, where the VM is running Ubuntu 16.04. Everything installed OK, but I can't access it via the browser. It says I need to configure an external URL. I only need to access the VM from my Mac (where the VM is running). How do I configure a URL so I can access it from my Mac?
Thanks!
When the VM is running locally on the Mac in NAT network config, this means that the ports are available directly on the Mac IP. If you only need to access it from the Mac itself, you could access the application at the port via the loopback (local only) IP 127.0.0.1
If gitlab is running on port 80 in the VM, on the Mac you should be able to access with http://127.0.0.1
If this doesn't work, there are a few options:
Confirm no other service/webserver is running on port 80 locally on the Mac. If there is, you should change the port of the gitlab webserver in your VM, and access using http://127.0.0.1:port
Confirm that port 80 is allowed in the VM firewall, and that the webserver is running https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-gitlab-on-ubuntu-16-04

Cannot access eclipse orion server from local machine using local IP

I have been given a centos server to lauch eclipse orion code editor. I installed eclipse orion as per the instruction on https://wiki.eclipse.org/Orion/How_Tos/Install_Orion_on_Localhost (steps for linux using jetty server). It works fine on centos browser. The centos os is running on 198.168.1.226. So that I can access the following urls on web browser of centos.
198.168.1.226:8080
localhost:8080
127.0.0.1:8080
0.0.0.0:8080
But when I tried to access the 198.168.1.226:8080 from other local machines on local network, that is not accessible. I searched the StackOverflow Questions like how to make jetty server accessible from LAN? and Unable to access jetty server with local IP address but both are useless for me. How can I fix this situation? Can I fix it editing the code on orion.ini file or need to deal with configuration file or something else?
I have also tried the orion for windows computer but it worked itself for accessing the orion system for any other computer in local network. But I am surprised to face it on centos using the jetty server for setting up eclipse-orion system .
First of all check that have you allowed specific port (8080) from eclispse.
add rule with that port no. in centos iptables as below:-
iptables -A INPUT -p tcp --dport 8080 (adjust according your port no.) -j ACCEPT

Listening port putty tunnel does not work

The goal is to connect to my home computer from outside. The ISP blocks all the ports (and demands $$$ for business package with static ip address), so simple port forwarding on home router does not work.
I have used putty to tunnel a listening port to a remote server: R2221:###.###.###.###:2221 (to make things simpler, the test server is a simple ftp server running on my home windows machine) (the entire ip address has to be specified -- with OpenSSH 1.0 running on the linux box wildcard address results in refusal of connection) (GatewayPorts are set to on).
Netstat -a confirms that port 2221 on the linux box is open and listening. However, whenever I try to connect to that port, it simply hangs. Command line ftp client says "connected to ###.###.###.###" and that's it. Running netstat again shows dozens of opened connections to port 2221, all coming from my windows box (I tried using browser as well as command line ftp client).
Which step am I missing?
Tried with RDP, VNC and FTP -- all of them hang, all of them connect when connecting through my home network (or my home router).
EDIT The setup is as follows:
PC 1 (windows) has FTP service running on port 2221. It uses PuTTY to tunnel a listening port to PC 2 (linux). PC 2 does show listening port when running netstat. Connecting to port 2221 on PC 2 either form PC 2 or from PC 3 results in hanging.
EDIT 2 Aaaand it worked. Using 127.0.0.1 instead of the remote machine's ip address was what corrected it. Thanks a lot.
Are you sure your -R command is correct? From what you say I suppose the command should be R2221:127.0.0.1:2221. The -R ssh option in form of port:host:hostport does the following: it opens port port on the remote side and forwards the connection to that port to local address host:hostport, and this connection is made from the local machine.
To make your local machine (the one that is running ssh client, e.g. PuTTY) connect to your local FTP server running on the same machine, use 127.0.0.1 as an address.
It also explains why you see a strange behaviour: when you actually connect to xxx.xxx.xxx.xxx:2221, it forwards the connection to the same address xxx.xxx.xxx.xxx:2221 and you get some kind of a loop.

How to access nginx server from host machine, installed on guest VM ?

Host Machine - Win 7
Guest - Fedora
I have installed nginx web server on guest fedora machine and I can access the webpage inside guest machine using the interface address. How can I access the web page from host machine's browser ?
I am using bridged connection.
Router is assigning 192.168.0.16 to the guest machine's interface. I tried same address in my host machine but it doesn't work.
Based on your description:
First you should check your web application's config. You don't mention which type of your web application running on your Apache server, some are launched with the specific ip argment 127.0.0.1( or localhost), so kind of these web application can only be visited on your localhost computer. You should change the ip argument to 0.0.0.0
Second if the "Fisrt" failed, check the connection of the two server(host and your guest) by using telnet.
On your Win7, you can use the command:
telnet ip port
for example:
telnet 192.168.0.16 80
80 is the default port of Apache Http(s) Server.
if the command don't show the "connection refused" error, your Apache server is goood, so it might be something wrong of your web application.
If that, show me your error msg then we go on further.

Resources