How to access http service running on windows from docker inside wsl2 - windows-subsystem-for-linux

I'm running an http service on win 10, listen at 0.0.0.0:8890
and a container instance running on wsl2
I want to access the 8890 port opened on windows from inside the container, I know ssh port portwarding from wsl2 to windows can do this, but is there an easier way to do this ?

Related

Connect to Redis on WSL Windows 10 from remote client

I've a Redis instance running on a Windows 10 Machine and connecting to Redis locally works perfectly.
When i try to reach Redis from a remote client in the network it doesn't seem to work.
The
Windows machine has the ip 172.22.23.112
Ubuntu WSL 172.22.160.1.
The Firewall for Windows is down, the Port 6379 is enabled on Ubuntu, firewall is down there too.
in redis.conf
bind 127.0.0.1 172.22.23.51 172.22.23.55
protected-mode no
i thought when i connect to the windows machine with a redis client and the appropriate port, windows will forward this request to the WSL Redis Server?
Since i get a timeout i guess i'm doing something wrong!
i set bind to 0.0.0.0
and issued the following command in windows
netsh interface portproxy add v4tov4 listenport=6379 listenaddress=0.0.0.0 connectport=6379 connectaddress=172.x.x.x
where connectaddress is the WSL ip address
connection works, now i've to ensure
the wsl ip address is static
the command is issued everytime the computer starts
other than that it works

How to acquire Windows 10 Host IP from an ubuntu HyperV Virtual Machine

I have a server running on my windows machine and a hyper-v ubuntu VM
I am trying to test the frontend from my VM but I want to make requests to windows 10
host, how can I get the host's IP?
Go to Wired Connected -> Wired Settings and just copy the DNS IP

Apache Solr 5.0.0 Port 8983 Connection timed out

I have successfully installed Apache Solr using terminal on the remote server (Ubuntu 14.04 on Windows Azure Servers). The status of Solr when checked using Terminal is listening on Port 8983 Happy Searching. But when I open http://MyIPAddress:8983/solr the connections gets timed out. Am I missing something here.
Have you opened the port? By default only port 22 is open for SSH and the other ports are closed by a firewall.
To open ports, go to the Windows Azure management console. Click on "Virtual Machines" choose your VM, and click on "Endpoints" at the top. Click on "Add Endpoint", and fill in the details: protocol (TCP/UDP), public port (8983), and private port (8983).

I cannot access the default Apache webserver page, which is hosted in a VirtualBox VM, from my machine

My machine is a regular laptop with Windows 7. I have a Virtualbox VM running Ubuntu Server 14.04.1 and I have apache2 installed. When I try to access the default webserver page (10.0.2.15) from my machine, it cannot find the page. I have disabled my machine's firewall so that isn't causing the issue. The network for my VM is NAT, but I also tried the bridged adapter setting to no avail. Any suggestions would help.
Can you ping the server? If so, try the netstat command in server terminal to determine if it listens to port 80. If you cannot ping it, check the network address, f.x with ifconfig
If you can ping apache from the server, you probably have a problem with the network.
Try to add an host only interface. Then, in your VM, sudo ifconfig. Use the eth1's ip.

How do I connect to a localhost service from a hyper-v VM?

I have a WCF service running on "http://localhost:12345/ServiceName". I also have a VM running under hyper-v in Windows 8 public beta. Is there any way that I can connect to this service from the VM? I cant seem to set up a bridged network connection in the hyper-v manager. An alternative would be for the WCF service to bind to the Win8 machine name or IP, but I don't know how I would find out what that endpoint is from the VM side. The WCF service can be changed in any way needed...
Any help would be much appreciated!
Many thanks,
Jon
Not sure this will work with a Windows VM, but I managed to open host's URL from inside an Ubuntu VM:
On Host disable the Firewall or add a rule to allow connections to the respective port (12345 in your case).
On VM edit /etc/hosts, replace 127.0.0.1 localhost with IP_OF_HOST localhost.
Now http://localhost:12345/ServiceName should open from inside the VM.
you can create Virtual Switch in Hyper-V(Virtual Switch Manager) Then you can connect it to your VM(right click on VM ->setting -> create Legaci network adapter -> connect abouve virtual switch to it). after that you should install intigration to Hyper-V for your OS in VM. then you can connect to your virtual switch in your VM. after that you can access internet as well. you your host machine has it. type your host machine's IP address in web browser and you can access any service in host machine
You also need to run as admin on the host machine command shell netsh http add urlacl url=http://*:12345/ user=Everyone where 12345 is the port number of your service.