".local" suffix on local server (Manjaro) - dns

I recently changed my Linux distribution (Manjaro) and my local domains defined in /etc/hosts and ending in .local no longer work.
# /etc/hosts
# Host addresses
127.0.0.1 localhost
127.0.0.1 hello.local
127.0.0.1 hello.domain.local
127.0.0.1 hello.other
$ ping hello.local
ping: hello.local: Nom ou service inconnu
$ ping hello.other
PING hello.other (127.0.0.1) 56(84) octets de données.
64 octets de localhost (127.0.0.1) : icmp_seq=1 ttl=64 temps=0.012 ms
...
$ ping hello.domain.local
PING hello.domain.local (127.0.0.1) 56(84) octets de données.
64 octets de localhost (127.0.0.1) : icmp_seq=1 ttl=64 temps=0.012 ms
...
This doesn't work only with a sub-domain of the tld .local : hello.local.
If it's a sub-sub domain : hello.domain.local , it works.
Also if the tld is not (.local) but .other : hello.other, it works.
where did I miss something?

Firstly, backup your nsswitch.conf ->
sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.bk
Then, goo to /etc/nsswitch.conf and
replace this line
hosts: mymachines mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns
to
hosts: files mdns4_minimal [NOTFOUND=return] dns

Related

Pinging local domain returns unknown IPv6

I have a weird problem I can't solve due to my lack of knowledge.
I have a local server running Dnsmasq. On my computer (Windows 10) I have Acrylic DNS Proxy which directs all requests ending with .local to the local server. It works great, however one domain respons with an unknown IPv6 address.
> ping testdomain.local
Pinging TESTDOMAIN [IPv6 address] with 32 bytes of data:
Reply from IPv6 address: time<1ms
I can't figure out why testdomain.local is reversed to TESTDOMAIN. All my other local domains respons as expected:
> ping testdomain2.local
Pinging testdomain2.local [local server address] with 32 bytes of data:
Reply from local server address: bytes=32 time<1ms TTL=64

Domain refers to the local machine

Just was walking around till I tried to ping a domain .
But I surprised that it was the domain of the localhost !
I went to see what the wrong was , and how this domain set itself .
However,I didn't find anything that related to it in the localhost OS !
I tried to ping it via online ping service , and the surprise is here , it pings the localhost of the service host !
The domain is :
securitytube.com
Is there any explanation ?
This should be migrated to superuser but the answer to your question is because the owners of that domain have an IP address of 0.0.0.0 set...
$host securitytube.com
securitytube.com has address 0.0.0.0
securitytube.com mail is handled by 0 mail.happyisp.com.
$ping securitytube.com
PING securitytube.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.089 ms
Most linux boxes will presume that's the loop-back address (Hence return 127.0.0.1) Windows boxes appear to not do anything other than error out.
c:\ping 0.0.0.0
Pinging 0.0.0.0 with 32 bytes of data:
PING: transmit failed. General failure.

Why does Node.js/Express not accept connections from localhost?

I encountered this strange behavior today I could not find a cause for. I am using MacOS Sierra.
I have this code (Express):
app.server.listen(config.port, config.address, function () {
logger.info('app is listening on', config.address + ':' + config.port);
});
And it prints
app is listening on 127.0.0.1:5000
How ever, if I try to curl, it fails.
$ curl http://localhost:5000/api/ping
curl: (56) Recv failure: Connection reset by peer
I checked my hosts file:
$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
So I ping localhost to make sure it resolves to 127.0.0.1:
$ ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.061 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.126 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.135 ms
^C
--- localhost ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.061/0.107/0.135/0.033 ms
I try again, but it fails
$ curl http://localhost:5000/api/ping
curl: (56) Recv failure: Connection reset by peer
Now I try to use 127.0.0.1 instead and voila, it works?
$ curl http://127.0.0.1:5000/api/ping
pong
What's wrong?
cURL is trying to connect via IPv6 but your Express server is listening on 127.0.0.1 which is IPv4.
You can force cURL to connect via IPv4 with the -4 option.
curl -4 http://127.0.0.1:5000/api/ping

Laravel 5.2 not working with vagrant homestead php 7

System & Tools:
OS: Ubuntu 14.04 64bit
vagrant_1.8.1_x86_64
virtualbox-5.0_5.0.12-104815~Ubuntu~trusty_amd64
(VM) https://atlas.hashicorp.com/laravel/boxes/homestead-7/versions/0.2.1/providers/virtualbox.box
Im having problem with laravel & vagrant setup. The same setups used to work with laravel 5.1 but now with 5.2 its stopped working.
When I open the URL http://laravel.app it redirect to my localhost page not laravel app.
But if i do http://laravel.app:8000/ it gives Unable to connect firefox can't establish a connection to the server at laravel.app:8000.
Please guide me what i'm doing wrong. i'm new to laravel and vagrant and did managed to run 5.1 few weeks ago but now 5.2 is stcuk with virtualbox php 7
Instructions followed from laravel site:
https://laravel.com/docs/5.2
https://laravel.com/docs/5.2/homestead
~.homestead/Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/www/sites
to: /home/vagrant/Code
sites:
- map: laravel.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
hosts
127.0.0.1 localhost
127.0.1.1 raven
192.168.10.10 laravel.app
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Forwarding ports...
default: 80 (guest) => 8000 (host) (adapter 1)
default: 443 (guest) => 44300 (host) (adapter 1)
default: 3306 (guest) => 33060 (host) (adapter 1)
default: 5432 (guest) => 54320 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
Your /etc/hosts file should point your domain to 127.0.0.1, this is because homestead forwards 127.0.0.1:8000 to port 80 on your vagrant box. In this case 192.168.10.10:80.
So your /etc/hosts should look like this
127.0.0.1 laravel.app
In your browser you should then access http://laravel.app:8000/
Thanks to #Wader for helping me out. With his help I found the problem.
Coming from Windows user experience the case sensitive names got me this time.
The homestead.yaml file had Laravel as site directory while my directory name was in lower case laravel. I capitalised the directory and it worked. Along with the IP change and appending the port as suggested by #Warden
Try placing
box: laravel/homestead-7
at the top of your homestead.yaml file
Then in terminal enter homestead ssh
then type in serve laravel.app /home/vagrant/Code/laravel/public

Host name not being resolved properly in CentOS

I am running CentOS on a virtual machine. My /etc/hosts file is as follows:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.50.17 192-168-50-17.openstacklocal 192-168-50-17
192.168.50.13 slave5
/etc/resolv.conf:
; generated by /sbin/dhclient-script
search openstacklocal
nameserver 192.168.50.3
nameserver 8.8.8.8
nameserver 8.8.4.4
All pings are working properly. However, when I am trying to run the following command -
/usr/lib64/lustre/tests/llmount.sh, this is what I am getting:
Loading modules from /usr/lib64/lustre/tests/..
detected 1 online CPUs by sysfs
libcfs will create CPU partition based on online CPUs
debug=vfstrace rpctrace dlmtrace neterror ha config ioctl super lfsck
subsystem_debug=all -lnet -lnd -pinger
Formatting mgs, mds, osts
Format mds1: /tmp/lustre-mdt1
Format ost1: /tmp/lustre-ost1
mkfs.lustre: Cannot resolve hostname '192-168-50-17#tcp'.
mkfs.lustre: exiting with 1 (Operation not permitted)
I am running it as the root user. Any help on fixing this would be appreciated. Thanks!
Why does your /etc/hosts file have what looks like an IP address with dashes (-) instead of dots (.)? You probably just need to delete these lines from the (or the entire) /etc/hosts file.

Resources