Mac M1: Dnsmasq not resolving the local host on new apple m1 chip - apple-m1

I'm trying to setup my M1 laptop for dev env. But some dnsmasq is not working. I executed the following commands for dnsmasq:
brew install dnsmasq
echo 'address=/.local/127.0.0.1' > /opt/homebrew/etc/dnsmasq.conf
sudo brew services start dnsmasq
sudo brew services list
But when I try to ping to my local it's not responding.
$ ping test90.local
ping: cannot resolve test90.local: Unknown host

What DNS is ping using to resolve the hostname?
I'm not a mac user, but on BSD and Linux my next step would be to check /etc/resolv.conf to see if 127.0.0.1 was in the list of domains.
Also, .local is reserved for mdns. See https://en.wikipedia.org/wiki/.local

Related

Docker for Windows application not accessible over browser when connected via VPN

I have docker for windows running windows container. Machine is connected to corporate network via Cisco AnyConnect VPN. We have been having this issue for sometime with no solutions. To explain the problem here is an example. Go to docker image here https://hub.docker.com/_/microsoft-dotnet-samples and run the below commands in command prompt / powershell in sequence
docker pull mcr.microsoft.com/dotnet/samples:aspnetapp
docker run -it --rm -p 8000:80 --name aspnetcore_sample mcr.microsoft.com/dotnet/samples:aspnetapp
replace port 8000 with something else if there is an error in lines of hns file being used. Go to browser and do http://localhost:8000 assuming its running on port 8000. It doesn't connect for me. Instead of localhost i also tried below command to find the ipaddress of the container running the image and then replace localhost with that ip address but with same response unable to connect.
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
here is an screenshot of the network adapter docker sets up by default
here is another screenshot of the nat network adapter

Unable to access jupyter notebook on virtualbox guest through browser in windows host

I have virtualbox 6.1 running a ubuntu 20.04 LTS guest on a windows 10 host.
I ran a jupyter notebook on the ubuntu guest. and it gave me this output
http://localhost:8888/?token=749e04f283016d.......
or http://127.0.0.1:8888/?token=749e04f283016d.......
I got to know that I have to setup host-only adapter to access the page on windows 10 browser so I have setup host-only adapter along with NAT adapter for the ubuntu guest.
accessing-your-virtualbox-guest-from-your-host-os
Post that I took the host-only adapter interface IP address using ip a command in ubuntu guest and I am able to ping guest from host as well using that IP. But when I replaced it in the above url, I am still unable to access the link and browser running on windows host says ERR_CONNECTION_REFUSED.
What additional setup should I do to access the jupyter page from windows host.
I figured it out from the following post which tells the same thing about ipython notebook
Install IPython on Ubuntu 12.04 VirtualBox Guest and use it from the browser on the Windows Hostenter link description here
and finding out from this answer the main difference between jupyter and ipython notebooks.
What-is-the-difference-between-Jupyter-and-IPython-Notebook
The key thing to note here is that many applications when started eg. mongodb are accessible only on loopback interface IPs(localhost, 127.0.0.1) only. the reason being to avoid exposing by mistake any application on public IPs which u might have installed for testing, etc. So, in this case all you have to is generate a config file for jupyter server using :
jupyter notebook --generate-config
which will generate config file :
~/.jupyter/jupyter_notebook_config.py
where you have to change the following line:
c.NotebookApp.ip="localhost"
to
c.Notebook.ip="0.0.0.0" #for all IPs
Now run the jupyter notebook again and you will be able to access it on your host and even any interface IPs for any adapter you have setup for your guest OS.
A few things to review when running Jupyter inside a virtual machine.
Make sure you have added the Jupyter's port (i.e., 8888) to your Ubuntu firewall
sudo firewall-cmd --permanent --add-port 8888/tcp
sudo firewall-cmd --permanent --add-port 8888/udp
sudo firewall-cmd --reload
When using VirtualBox you should map ports to the VM.

Netplan Error: Cannot bind to port 2893, Address is already in use

I want to configure static IP address in Ubuntu.
Here you can see my configuration file for static IP addressing:
network:
version: 2
renderer: NetworkManager
ethernets:
wlp1s0:
dhcp4: no
addresses: [192.168.0.103/24]
Gateway: 192.168.0.1
Nameservers:
Addresses: [127.0.0.53]
While testing the configuration through $ sudo netplan try, I get the following response:
bind: Address already in use
netplan: fatal error: cannot bind to port 2983, is another daemon running?, exiting.
Netstat shows the port in use by Netplan.
netstat -pnlt | grep ':2983'
tcp 0 0 0.0.0.0:2983 0.0.0.0:* LISTEN 1524/netplan
So can someone please give me a way to solve this issue??
Got same problem today with one of my servers. The reason was because 2 packages exists for Ubuntu with same binary name: netplan and netplan.io. First is "Calendar Service" and the second is for networking. My server have netplan package installed. I just removed it and now netplan for networking works fine. May be it will helps to you.
Same here ...
installed debian server
apt-get update
apt-get upgrade
reboot and it broke networking so I had to go on site and W%%#$ing fix it .. DIAF 'netplan'
apt-get remove --purge netplan* -y
apt-get install netplan.io -y

docker nginx container not receiving request from outside, connection refused

I have a running nginx container: # docker run --name mynginx1 -P -d nginx;
And got its PORT info by docker ps: 0.0.0.0:32769->80/tcp, 0.0.0.0:32768->443/tcp
Then I could get response from within the container(id: c30991a04b2f):
docker exec -i -t c3099 bash
curl http://localhost => which return the default index.html page content, it works
However, when I make the curl http://localhost:32769 outside of the container, I got this:
curl: (7) failed to connect to localhost port 32769: Connection refused
I am running on a mac with docker version 1.9.0; nginx latest
Does anyone know what cause this? Any help? thank you
If you are On OSX, you are probably using a VirtualBox VM for your docker environment.
Make sure you have forwarded your port 32769 to your actual host (the mac), in order for that port to be visible from localhost.
This is valid for the old boot2docker, or the new docker machine.
VBoxManage controlvm "boot2docker-vm" --natpf1 "tcp-port32769 ,tcp,,32769,,32769"
VBoxManage controlvm "boot2docker-vm" --natpf1 "udp-port32769 ,udp,,32769,,$32769
(controlvm if the VM is running, modifyvm is the VM is stopped)
(replace "boot2docker-vm" b ythe name of your vm: see docker-machine ls)
I would recommend to not use -P, but a static port mapping -p xxx:80 -p yyy:443.
That way, you can do that port forwarding once, using fixed values.
Of course, you can access the VM directly through docker-machine ip vmname
curl http://$(docker-machine ip vmname):32769
Solved.. I misunderstood how docker port mapping works.
Since I'm using mac, the host for nginx container is a VM, 0.0.0.0:32769->80/tcp maps the port 80 of the container to the port 32769 of the VM.
solution:
docker-machine ip vm-name => 192.168.99.xx
curl http://192.168.99.xx:32769
Not exactly answers for your question but spend some time trying to figure out similar thing in context of "why is my docker container not connecting to elastic search localhost:9200" and this was the first S.O. question that pops up, so I hope it helps some other googling person
if you are linking containers together (e.g. docker run --rm --name web2 --link db:db training/webapp env)
... then Dockers adds enviroment variables:
DB_NAME=/web2/db
DB_PORT=tcp://172.17.0.5:5432
DB_PORT_5432_TCP=tcp://172.17.0.5:5432
DB_PORT_5432_TCP_PROTO=tcp
DB_PORT_5432_TCP_PORT=5432
DB_PORT_5432_TCP_ADDR=172.17.0.5
... and also updates your /etc/hosts
# /etc/hosts
#...
172.17.0.9 db
so you can technically connect to ping db
https://docs.docker.com/v1.8/userguide/dockerlinks/
so for elastic search is
# /etc/hosts
# ...
172.17.0.28 elasticsearch f9db83d0dfb5 ecs-awseb-qa-3Pobblecom-env-f7yq6jhmpm-10-elasticsearch-fcbfe5e2b685d0984a00
so wget elasticseach:9200 will work

Could not resolve hostname, ping works

I have installed RasPi Raspbian, and now I can't do ssh or git clone, only local host names are being resolved it seems. And yet ping works:
pi ~ $ ssh test.com
ssh: Could not resolve hostname test.com: Name or service not known
pi ~ $ git clone gitosis#test.com:test.git
Cloning into 'test'...
ssh: Could not resolve hostname test.com: Name or service not known
fatal: The remote end hung up unexpectedly
pi ~ $ ping test.com
PING test.com (174.36.85.72) 56(84) bytes of data.
I sort of worked around it for github by using http://github.com instead of git://github.com, but this is not normal and I would like to pinpoint the problem.
Googling for similar issues but the solutions offered was either typo correction, or adding domains to hosts file.
This sounds like a DNS issue. Try switching to another DNS server and see if it works.
OpenDNS
208.67.222.222
208.67.220.220
GoogleDNS
8.8.8.8
8.8.4.4
Try reseting te contents of the DNS client resolver cache.
(For windows) Fireup a command prompt and type:
ipconfig /flushdns
If you are a linux or mac user, they have their own way of flushing the dns.
Had the same error, I just needed to specify a folder:
localmachine $ git pull ssh://someusername#127.0.0.1:38765
ssh: Could not resolve hostname : No address associated with hostname
fatal: The remote end hung up unexpectedly
localmachine $ git pull ssh://someusername#127.0.0.1:38765/
someusername#127.0.0.1's password:
That error message is just misleading.
if you've a network-manager installed
check /etc/nsswitch.conf
if you've got a line
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
remove the **[NOTFOUND=return]**
restart /etc/init.d/networking
the [NOTFOUND=return] prevents futher lookups if the first nameservwe doesn't respond correctly
This may be an issue with the proxy. Kindly unset and try.
git config --global --unset http.proxy
git config --global --unset https.proxy

Resources