Hosts file not honoring the dev sites mapping in OSX Yosemite - laravel

This issue has been affecting my multi-site development since months and on. My Yosemite OSX hosts file (located at /etc/hosts never honors these sites I put in at the top:
192.168.10.10 blackbird.dev
192.168.10.10 saveeo.dev
What might be wrong? To help the answerers understand the situation, I've done the following:
Flushed the DNS cache
My Homestead.yaml file looks like this below [see A]
Homestead destroyed and ran again (nope, no difference)
Computer restarted and ran again (nope, no difference)
If I go 192.168.10.10, one site opens up, the first one listed in .yaml
If I do saveeo.dev or blackbird.dev, this shows up [see B]
If I ping from my local machine, I get this [see C]
If I ping from within the box (doing homestead ssh) and then I see this. [ see D]
What is happening, help me out. I've used all my knowledge to make this work, but I just don't know what is causing this. I am not able to access my dev sites through the browser like app.dev and app2.dev. Quite frustrating.
Appendix A
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /Users/aligajani/Dropbox/Vinkk_Software
to: /home/vagrant/Vinkk_Software
- map: /Users/aligajani/Dropbox/hackathon
to: /home/vagrant/hackathon
sites:
- map: blackbird.dev
to: /home/vagrant/Vinkk_Software/blackbird/public
- map: saveeo.dev
to: /home/vagrant/hackathon/saveeo/public
databases:
- homestead
- saveeo
variables:
- key: APP_ENV
value: local
Appendix B
This webpage is not available
ERR_CONNECTION_TIMED_OUT
Appendix C
PING saveeo.dev (127.0.53.53): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
PING blackbird.dev (127.0.53.53): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Appendix D
ping saveeo.dev
PING saveeo.dev (127.0.53.53) 56(84) bytes of data.
64 bytes from 127.0.53.53: icmp_seq=1 ttl=64 time=0.027 ms
64 bytes from 127.0.53.53: icmp_seq=2 ttl=64 time=0.055 ms
ping blackbird.dev
PING blackbird.dev (127.0.53.53) 56(84) bytes of data.
64 bytes from 127.0.53.53: icmp_seq=1 ttl=64 time=0.019 ms
64 bytes from 127.0.53.53: icmp_seq=2 ttl=64 time=0.040 ms

My hosts file kept on being ignored after I edited in text edit. I tried several ways to fix the line endings, added IPv6 entries to the existing IPv4 entries with no success. The only solution that worked is using this free GUI plugin to edit hosts file.
https://github.com/specialunderwear/Hosts.prefpane/blob/master/README.mdown

It sounds like an issue with your mac dns resolution and nothing to do with vagrant.
Check out https://apple.stackexchange.com/questions/158117/os-x-10-10-1-etc-hosts-private-etc-hosts-file-is-being-ignored-and-not-resol

Related

Configured site for Homestead not working

Here is Homestead.yaml config :
ip: 192.168.9.10
memory: 2048
cpus: 2
provider: vmware_desktop
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
-
map: 'C:\Users\Khalil\RestfulAPI'
to: /home/vagrant/restfulapi
sites:
-
map: restfulapi.dev
to: /home/vagrant/restfulapi/public
php: "8.0"
databases:
- homestead
features:
-
mariadb: false
-
ohmyzsh: false
-
webdriver: false
name: restfulapi
hostname: restfulapi
I also added it to the hosts file : 192.168.9.10 restfulapi.dev
It works when i use http://restfulapi.local without mapping it directly as a site since i guess *.local is the default?
Running restfulapi.dev takes forever to load then gives a "connection time out", pinging the IP from my host responds with TTL expired in transit 4 times and ends with a
Ping statistics for 192.168.9.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
I can normally run vagrant ssh and ping 192.168.9.10 and get response, and it's also configured as eth1 on the machine when i run ip address show.
Tried provisioning, destroying the VM, setting up everything from scratch.
I attach my Homestead.yaml file for a test project that I am developing using Laravel Framework and PHPStorm.
[Homestead.yaml]
[1]: https://i.stack.imgur.com/VqkHh.png
After making changes to your Homestead.yaml file, execute
vagrant reload --provision
Once the virtual machine has finished booting, ssh into the VM through this command: vagrant ssh
Delete the version of php from your Homestead.yaml and run vagrant up and vagrant provision.

How on Mac OS use .localhost instead on .dev in Chrome by dnsmasq

I installed by this instruction https://passingcuriosity.com/2013/dnsmasq-dev-osx/ .dev support local domain.
When I replaced all configs to localhost instead of dev I can't open my some.localhost domain.
In console I successfully checked some.localhost domain for working:
bash-3.2$ ping -c 1 some.localhost
PING some.localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.036 ms
But in chrome I have a CONNECTION_REFUSED error yet.
Help me please.

Where can be defined a custom IP for a host on Win10 (not in etc\hosts)

I can not figure out why host name davno.pw is on 127.0.0.1 for my local workstation.
The site is up and running on 5.45.126.52 and its okay
But locally I only see that the name points to 127.0.0.1
And nothing about it in the hosts file:
c:\Windows\System32\drivers\etc\hosts
(the only uncommented line is 127.0.0.1 localhost)
and at the same time
> ping davno.pw
--- PING davno.pw [127.0.0.1] 32 bytes of data. ---
Reply from 127.0.0.1: 32 bytes time<1ms TTL=128
It might be some heritage of Open server but I have no idea where the configuration is.

Windows docker container cannot ping host

I am running a windows docker container on a Windows Server 2016 host, running default configuration.
When running the docker container using the command:
docker run -it microsoft/windowsservercore powershell
When I run the command:
ping <hostIPAddress>
It just says that the request times out.
I have checked that I can ping 8.8.8.8 and google.com etc... and even other machines on the same subnet. The only one I cannot ping is the host.
I have added '--dns ' to the 'docker run' command but this only allows me to ping the host machine via hostname and not IP.
Has anyone else seen this problem and have a solution?
I found a workaround (I'm not willing to call it a solution):
Windows Container Network Drivers: create a 'transparent' network:
docker network create -d transparent trans
Attach container to this network
docker run --network=trans ...
Important: Please note, that with this network, your container needs to obtain an IP Adress from the Host Subnet and it is directly exposed to it.
maybe related (this is about access the containers from the host):
According to https://github.com/Microsoft/Virtualization-Documentation/issues/253#issuecomment-217975932 (JMesser81):
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.
Hoping this might help somebody.
On Windows 10 when hosting a Linux container on 0.0.0.0:5057 I was able to ping my server from my Windows host (powershell) using the IP address of the vEthernet (Default Switch) NIC found in Control Panel>All Control Panel Items>Network Connections:
In my case I have a corporate managed McAfee firewall running on my Windows host. I could not add any additional rules on the firewall, but fortunately there was a rule that allowed access from 172.16.0.0/24.
I used "docker network create -d transparent trans" and it worked as described, but I was not happy with an IP from my host network assigned to the container.
I did the following:
docker network create --driver=nat --subnet=172.16.0.0/24 br0
Added --network=br0 to my docker run command
I am facing the same issue.
My workaround is to restart docker service, afterwards it works fine. I'm still looking for a permanent solution.
root#a6c40eb25cbf:/# ping xxx.xx.xx.xxx
PING xxx.xx.xx.xxx (xxx.xx.xx.xxx): 56 data bytes
64 bytes from xxx.xx.xx.xxx: icmp_seq=0 ttl=37 time=3.541 ms
64 bytes from xxx.xx.xx.xxx: icmp_seq=1 ttl=37 time=2.643 ms
64 bytes from xxx.xx.xx.xxx: icmp_seq=2 ttl=37 time=1.857 ms
^C--- xxx.xx.xx.xxx ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
This works for me, I hope it works for you.
Currently, you must have WSL or WSL2 installed and have Virtualization enabled to run Docker on Windows.
The installation of WSL from PowerShell is with the following command.
wsl --install -d Ubuntu
Obviously you need to download and install Docker Desktop on Windows. It will be necessary to enable the WSL integration from the Docker desktop settings after installing it.
After configuring WSL and Docker Desktop, you can create/use your containers. Example:
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
Finally you must identify the IP of WSL, you must open the Linux distribution that you installed in the first step, in our case Ubuntu, this will open your terminal and here we will execute:
ifconfig
and you will identify the ip of eth0. Example: 172.27.123.123
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.27.123.123 netmask 255.255.240.0 broadcast 172.27.127.255
inet6 fe80::215:5dff:fecf:b4 prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:cf:00:b4 txqueuelen 1000 (Ethernet)
RX packets 4389 bytes 299784 (299.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4343 bytes 315643 (315.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Now you can ping from CMD in Windows to this IP.
NOTE: the connection will depend on the port of your container, example: 172.27.123.123:8080.

Can not connect vsftpd remotely?

I have a home network with a raspberryPi and a Windows computer. I want to share files between these two via FTP. So I have downloaded, installed and configured VSFTPD on my raspberryPi. Now I can connect this server locally from rasPi but not from my Windows PC.
Below you can find some more information, command outputs, conf file etc.
****Raspberry Pi****
vsftd.conf
listen=YES
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
user_sub_token=$USER
local_root=/home/$USER/ftp
sudo service --status-all
> sudo service --status-all
[ + ] vsftpd
nmap localhost
> nmap localhost
Starting Nmap 6.00 ( http://nmap.org ) at 2015-12-16 22:55 EET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.029s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 996 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
5002/tcp open rfe
Nmap done: 1 IP address (1 host up) scanned in 4.80 seconds
ftp localhost
> ftp localhost
Connected to localhost.
220 (vsFTPd 2.3.5)
Name (localhost:pi): pi
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
****Windows****
ping 192.168.2.140
> ping 192.168.2.140
Pinging 192.168.2.140 with 32 bytes of data:
Reply from 192.168.2.140: bytes=32 time=1ms TTL=64
Reply from 192.168.2.140: bytes=32 time<1ms TTL=64
Reply from 192.168.2.140: bytes=32 time<1ms TTL=64
Reply from 192.168.2.140: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.2.140:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
ftp 192.168.2.140
> ftp 192.168.2.140
ftp: connect :Connection timed out
Thanks for help.
One possible reason why you can connect locally, but not remotely, is due to which user VSFTPD is accessing the local user account under. Is it ROOT or is it the USER ID you've logged into.
In reviewing your settings, I noted you have:
chroot_local_user=YES
write_enable=YES
local_root=/home/$USER/ftp
I would also add:
allow_writeable_chroot=YES
seccomp_sandbox=NO
And I would execute:
setsebool -P ftp_home_dir on
Should this suggestion fail, I also asked a similar question in Ask Fedora Forums. Link to Question. In this question, I posted several links to articles that discussed setting up VSFTPD. Maybe one of these will give you a hint towards what to look for.
Some of their suggestions are:
allow a global user for VSFTPD full file system access
This is a very dangerous option and breaks many security protocols VSFTPd is trying to help protect you from.
change the read write privileges on /home/$users to a-w
This change is not needed if you add "allow_writeable_chroot=YES", and set the SELinux ftp_home_dir ON.
Hope that this helps.

Resources