You are not logged in.

#1 2014-05-15 14:28:41

tachy
Member
From: Denmark
Registered: 2008-07-24
Posts: 24

[SOLVED]Unknown hostnames resolve to my external IP

I have searched far and wide, but simply cannot figure out why this is happening.

If I try to look up a gibberish hostname with nslookup, dig or host, I get the expected "Host not found" (NXDOMAIN) kind of result.

However, if I try to connect to anything non-existing, I am unexpectingly hitting my own external IP address.... o_O
Examples:

[root@www.helges.dk ~]# wget http://asdfgaesadflkj/
--2014-05-15 14:12:08--  http://asdfgaesadflkj/
Resolving asdfgaesadflkj (asdfgaesadflkj)... 149.255.108.249
Connecting to asdfgaesadflkj (asdfgaesadflkj)|149.255.108.249|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2014-05-15 14:12:08 ERROR 403: Forbidden.
[root@www.helges.dk ~]# ping asdfgewq
PING helges.dk (149.255.108.249) 56(84) bytes of data.
64 bytes from 249.108.255.149.in-addr.arpa (149.255.108.249): icmp_seq=1 ttl=64 time=0.027 ms

Why does this happen??!
I checked /etc/nsswitch.conf, and it is exactly the same as on my laptop, which is working fine.
I tried changing nameservers in /etc/resolv.conf, even though DNS behaves as expected, and I knew it shouldn't have any effect.
The ping utility even reverse-resolves the IP correctly.

I must've made a mistake somewhere, but I really can't figure out what or where, and I have pretty much documented everything I changed on the server.
Anything that could guide me in the right direction would be greatly appreciated! :-)

My network is staticly configured using netctl.

/etc/netctl/helges.dk [FIXED]

Description='A basic static ethernet connection'
Interface=ens3
Connection=ethernet
IP=static
Address=('149.255.108.249/23' '149.255.108.250/23')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='149.255.108.1'
DNS=('149.255.110.42' '149.255.100.68')
##### THE FIX #####
DNSSearch='.'

/etc/nsswitch.conf

# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

publickey: files

hosts: files dns myhostname
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files

# End /etc/nsswitch.conf

/etc/hosts

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost www.helges.dk
::1             localhost.localdomain   localhost www.helges.dk

# End of file

/etc/resolv.conf [FIXED]

# Generated by resolvconf
nameserver 149.255.110.42
nameserver 149.255.100.68
##### THE FIX #####
search .

/etc/host.conf

#
# /etc/host.conf
#

order hosts,bind
multi on

# End of file

Last edited by tachy (2014-05-16 18:52:17)

Offline

#2 2014-05-15 14:51:53

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED]Unknown hostnames resolve to my external IP

What's in /etc/resolv.conf?

Offline

#3 2014-05-15 15:08:35

tachy
Member
From: Denmark
Registered: 2008-07-24
Posts: 24

Re: [SOLVED]Unknown hostnames resolve to my external IP

lucke wrote:

What's in /etc/resolv.conf?

Thanks for replying.
I have updated my first post with the contents.

Offline

#4 2014-05-15 16:56:02

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: [SOLVED]Unknown hostnames resolve to my external IP

What does `drill asdfgewq` output?

Offline

#5 2014-05-16 14:50:15

tachy
Member
From: Denmark
Registered: 2008-07-24
Posts: 24

Re: [SOLVED]Unknown hostnames resolve to my external IP

Spider.007 wrote:

What does `drill asdfgewq` output?

[root@www.helges.dk ~]# drill asdfgewq
;; ->>HEADER<<- opcode: QUERY, rcode: NXDOMAIN, id: 41412
;; flags: qr rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 
;; QUESTION SECTION:
;; asdfgewq.	IN	A

;; ANSWER SECTION:

;; AUTHORITY SECTION:
.	3600	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2014051600 1800 900 604800 86400

;; ADDITIONAL SECTION:

;; Query time: 29 msec
;; SERVER: 149.255.100.68
;; WHEN: Fri May 16 14:49:51 2014
;; MSG SIZE  rcvd: 101

Offline

#6 2014-05-16 18:25:07

tachy
Member
From: Denmark
Registered: 2008-07-24
Posts: 24

Re: [SOLVED]Unknown hostnames resolve to my external IP

Oh! I think I might be on to something now...

[root@www.helges.dk ~]# getent hosts asdasd
149.255.108.249 helges.dk asdasd.helges.dk

So, it appends helges.dk to the hostname, which resolves via DNS CNAME *.helges.dk
I wonder why it does that - I didn't set any "search" domain in resolv.conf...

**UPDATE**
I found the problem, but I am unsure whether this fix is the correct way to do things.
This is now my /etc/resolv.conf

# Generated by resolvconf
nameserver 149.255.110.42
nameserver 149.255.100.68
search .

The "search ." prevents searching the local domain (helges.dk) when resolving hostnames.
My resolv.conf gets overwritten by netctl, so I put DNSSearch='.' in my netctl profile.

Last edited by tachy (2014-05-16 18:49:50)

Offline

Board footer

Powered by FluxBB