Web App on LAN VM: curl -L works from other vms, browser/curl on host doesn't - hadoop

I am in the process of setting up a Hadoop cluster of virtual machines on my LAN and a process on one of the vms (the ResourceManager) provides a Web UI which is exhibiting strange behavior. All vms run from my desktop and have been assigned ips.
The URL I am targeting is resourcemanager:8088 and here is the behavior.
From other vms running on my desktop:
curl -v resourcemanager:8088
returns an HTTP 302 Found response with Location: http://resourcemanager:8088/cluster. Looking this up I saw this is a redirect, and curl -L resourcemanager:8088 successfully retrieves the HTML.
From the desktop running the vms:
Trying to reach the URL from (Chrome) browser gives net::ERR_CONNECTION_REFUSED. Also
curl resourcemanager:8088
returns curl: (7) Failed to connect to resourcemanager port 8088: Connection refused.
Each vm has the same /etc/hosts:
::1 localhost
127.0.0.1 localhost
10.0.0.3 namenode
10.0.0.4 resourcemanager
10.0.0.5 datanode1
and the .../drivers/etc/hosts file on my (Windows) desktop looks the same minus the localhost lines.
To make matters more complicated, a second process (the NameNode) also provides a web ui, call it namenode:50070, and I am able to curl it from both the desktop and vms, and I can get to it via browser from my desktop.
Any ideas?
EDIT
Specs:
Desktop OS: Windows 10
VMs OS: Arch Linux latest (Linux kernel 4.5.4)
An initial Arch+hadoop VM was created with Hyper-V, then cloned to create the three "cluster" vms listed above. After cloning, each vm was given a unique hostname (listed above) and assigned a reserved IP address from my router (also listed above). All VMs use an "external vm switch".

I cannot comment, because I do not have 50 reputation yet, but that might have to do with the configuration of the service behind port 8088: The VM probably got a 'small' netmask from the virtual dhcp server, which presumably covered the IP range of all other VMs, not including the host machine. If that had happened and the service was configured like many others -to listen on all interfaces- it would not react on requests and your connection would reach a closed port, causing a 'connection refused' error. How is that?

Related

windows: ping url fails but ping -4 url works in local network

I have been learning some network and system administration and encountered a puzzling problem.
SETUP:
I setup a small local offline network with a Windows Server 2019 and a Ubuntu server hosting gitea. In the Windows Server I have assigned a static IP of 169.254.0.2 and installed DNS and DHCP roles. In the Ubuntu server I have assigned a static IP of 169.254.0.3.
DNS has been configured with a primary zone funlab.abc. I created a single A record for gitea.funlab.abc. to point to 169.254.0.3. DHCP has been configured to lease addresses from 169.254.0.100 to 169.254.255.254. Subnet mask is 255.255.0.0.
PROBLEM:
With this setup, I successfully got client machines to connect to the local LAN network, transparently get a dynamic IP address, and access gitea.funlab.abc through the browser.
But in windows 10 client machines, I am unable to run ping gitea.funlab.abc in command prompt. I get an error message :
Ping request could not find host gitea.funlab.abc. Please check the name and try again
Git clone/push operations involving the URL gitea.funlab.abc also does not work.
However I can run ping -4 gitea.funlab.abc successfully. Git clone/push operations can also work if I replace the URL with the static IP. nslookup gitea.funlab.abc works correctly as well.
QUESTION:
Why is this happening? What did I misconfigure such that ping and git commands do not work?
Turns out ping and git commands works just fine when I change the IP address to 192.168.X.X. I guess windows treat the 169.254.X.X addresses differently.

Connection refused from host into a linux container with Docker for Windows

I found a lot of material on this issue online, however I wasn't able to find a solution. Also majority of them are rather old (a few years) and things could have considerably changed meanwhile.
I have Docker Desktop Community v 2.3.0.3 running on my Windows machine and a simple container with Ubuntu and a Rails app running on localhost:5000 inside.
The container gets run using:
docker run -p 5000:5000 rails:6.0.3 foreman start
I would like to connect to the Rails app from my Windows host machine via browser, but connection gets refused.
The server is up and running:
> docker exec 3c167e206f60 wget localhost:5000
--2020-06-06 08:21:26-- http://localhost:5000/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:5000... connected.
HTTP request sent, awaiting response... 200 OK
Port forwarding doesn't seem to work correctly (run from WSL, but similarly from Windows via Chrome):
> wget localhost:5000
--2020-06-06 10:22:50-- http://localhost:5000/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:5000... failed: Connection refused.
It doesn't work when using container address instead of localhost, either:
> docker inspect --format '{{ .NetworkSettings.IPAddress }}' 3c167e206f60
172.17.0.2
> wget 172.17.0.2:5000
--2020-06-06 10:29:02-- http://172.17.0.2:5000/
Connecting to 172.17.0.2:5000... failed: Resource temporarily unavailable.
Also (as probably expected), I don't see any docker related entry in ifconfig (from WSL) or ipconfig (from Windows) output.
I also tried docker run --net host parameter, which didn't help either.
I would ideally prefer a solution which doesn't require me to modify the Windows host setup (network setup, etc), to avoid the possibility of breaking other scenarios.
I've been struggling with this issue for several days. What worked for me was to:
Uninstall Docker Desktop
Turn off the Hyper-V, Virtual Machine Platform, and Windows Hypervisor Platform via the Turn Windows Features On and Off control panel module
Reboot
Turn on all features in #2
Re-install Docker Desktop
This seems to reset all of the HyperV virtual networking interfaces. It's possible that uninstalling Docker Desktop isn't necessary but since it relies on at least some of these features I felt it wisest to do a complete cycle.

Why can't I connect to 127.0.0.1 HortonWorks Dashboard?

I have installed Virtual Box (Version 5.2.0 r118431 (Qt5.6.2)) on Windows 10 and i imported appliance HDP_2.4_virtualbox_v3 (downloaded from here).
I followed the tutorial from here step by step.
The virtual machine is running on the computer from where I am trying to access the Dashboard. I have set up the Host Only Adapter Option on the sandbox so the computer and the virtual machine can communicate
After the CentOs finished booting I am prompt to enter to the ip 127.0.0.1:8888, which is a different address from the tutorial,
and there is no server listening to that address because i get
"127.0.0.1 refused to connect." in the browser.
image here
Run the ipconfig command in your command prompt and identyfy your virtual box's ip under Ethernet adapter VirtualBox Host-Only Network.
Take that ip address and go to your Virtual Box.
Select your appliance and go to Settings->Network->Adapter 1->Port Forwarding.
Replace the Host IP 127.0.0.1 for the port you need 8080, 8888 and so on with the ip of your virtual box that should be sth like 192.168.x.x.
Now start your sandbox, login on it and try to connect in your browser to the new ip set 192.168.x.x:8888.
Use appliance HDP_2.4_virtualbox because in the most recent some linux commands like netstat are considered deprecated and no longer function, which willmake your life harder when trying to debug or identify a networking problem.
If you still encounter issues eith it, reinstall your operating system, reinstall your virtual box and reimport the sandbox, make the changes needed in the Port Forwarding settings and it should be ok.
try to connect using 127.0.0.1 to connect make sure the VM is running make sure there are no errors if there are debug them and at the last straw uninstall the Vm and retry (make sure to make a backup if there are any files)
you can also try to check all the local host ips on your network and try to connect to them
Make sure you set NAT in your VirtualBox network settings:

Windows Container with Docker: Cannot reach httpd in container from host (Win2016 TP5)

I have a Windows Server 2016 TP5 machine that I use as a container host.
I have a Windows Container running that I manage with Docker. Inside this container I have an Apache httpd running on port 88.
The port mapping when I start the container is: 0.0.0.0:80->88/tcp, so I map port 80 of my container host to port 88 of the container.
This is the output from docker inspect: http://pastebin.com/AVem1eGV
I can now reach the Apache http start page from any other computer in the network through the DNS or IP.
In my case:
http://10.10.1.162/
http://documents.test2016-3.company.com/
But the same does not work when I try to call the same from the host system itself or from inside the container. So, on the host system, I try to access the same URL via browser or wget, and getting:
C:\> wget -UseBasicParsing http://documents.test2016-3.company.com/
wget : Unable to connect to the remote server
in both cases.
But I can ping the host from both the host itself as well as the container.
From the host:
C:\>ping test2016-3.company.com
Ping wird ausgeführt für TEST2016-3.company.com [fe80::847a:1430:8a10:b120%4] mit 32 Bytes Daten:
From the container:
PS C:\> ping documents.test2016-3.company.com
Pinging documents.test2016-3.company.com [10.10.1.162] with 32 bytes of data:
which seems to be able to resolve the name just fine.
What does work though is to call the Apache default page via the container hostname (which is win-de6u4068naf) and its running port directly (not through the port mapping), both from the host as well as inside the container:
http://win-de6u4068naf:88/
Just going the route through the container host hostname and mapped port from the host or container itself does not work properly!
Firewall rules allow everything on port 80 from any remote address or to port 80 (=inbound and outbound rules are both set to "allow" for "any").
I know that Microsoft/Docker changed the networking code base of the container/docker support from Windows Server 2016 TP4 to TP5. Not sure if that's related, or whether this is a bug or I'm having something not configured correctly yet.
I made a test and left Docker/Container out of the picture above and installed a plain Apache httpd itself on the container host system on port 80 (and no Docker running at all) just to check whether such setup works or not, in order to be sure that it is actually somehow Docker/Container related and not a problem with my network/host configuration in general. And this works fine, I can reach the Apache from outside as well as from the host itself, thus it must be a Docker/Container related problem.
Environment:
Windows Server 2016 TP5
Docker version 1.12.0-dev, build 2b97201
Got a reply on Microsoft's Github:
https://github.com/Microsoft/Virtualization-Documentation/issues/253#issuecomment-217975932
This is a known limitation in our Windows NAT implementation (WinNAT)
that you cannot access the external port in a static port mapping
directly from the container (NAT) host.

Access Docker container running on OS X via boot2docker in Windows virtual machine

Overview:
Host: Mac OS X running boot2docker and Docker
Guest: Windows 7
The Problem:
For my web-development I have set up a docker container via boot2docker on OS X. Within OS X I can access my docker services via boot2docker.
Running boot2docker ip, I get:
The VM's Host only interface IP address is: 192.168.59.103
I am running a Django application on port 1234 (I have mapped the port 5000 on the docker image to port 1234 on my Mac) which I can access within OS X in an web-browser via the address 192.168.59.103:1234. Everything works fine in OS X.
Now I have to test the Web stuff on IE which is why I have downloaded IE8, IE10 and so forth via Microsofts modern.IE website. As a result I have some more VirtualBox images, which are running Windows 7 and come with the propriate IE version.
The question is now how to access the Docker container in those Windows instances to test it under several IE versions.
What I have done so far:
Idea 1
To access the Django application I have looked up my local IP address and tried to access it via NAT in the Windows guests. Given my local IP adress 192.168.178.24, I have tried to access 192.168.178.24:1234 from Windows. Although I can ping 192.168.178.24 from Windows, I do get only a timeout on the port 1234.
Idea 2
Boot2docker runs a VirtualBox machine called boot2docker-vm. It comes with two network adapters, NAT and a host-only adapter called vboxnet0. The latter has the address 192.168.59.3 (which is the one which boot2docker ip returns) with the network mask 255.255.255.0. It runs a DHCP-Server on Server Adress 192.168.59.99 which gives addresses from 192.168.59.103-254.
I have added a second network adapter for my Windows guest systems which can also access via a host-only adapter the network vboxnet0. When being connected to the network the Windows machines do get a valid IP and can ping the IP 192.168.59.103. But I cannot connect to my Django instance on port 1234. If I try to call 192.168.59.103:1234 within Windows, I get a timeout.
Why is it not possible to connect to the Django instance? Can you help me? Thanks in advance.
I have found a solution to my problem here.
To get access to the Django instance I had to open the port on the boot2docker-vm machine.
This can be done by either by boot2docker-vm → settings → Network → Adapter 1 (NAT) → Port Forwarding and add a new rule where Host IPand Guest IP can be left empty and Host Port and Guest Port should be set to 1234.
Another way to do so is executing the following command in the command line
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port1234,tcp,,1234,,1234";
Of course this needs to be done for all ports, if more than one port is being used.

Resources