5

On my Ubuntu 12.4 these work fine:

$ hostname
my-machine-XX

ping `hostname`
ping my-machine-xx (192.168.0.69) icmp_req=1 ttk=64 time=0.043 ms

But host and nslookup return the wrong IP address:

$ host my-machine-xx
my-machine-xx has address 198.105.244.23
my-machine-xx has address 198.105.254.23
Host my-machine-xx not found: 3(NXDOMAIN)


$ nslookup my-machine-xx
Server:     127.0.0.1
Address:    127.0.0.1#53

Non-authoritative answer:
Name:   my-machine-xx
Address: 198.105.244.23
Name:   my-machine-xx
Address: 198.105.254.23

I'd appreciate help on how to fix it. Thanks.

8
  • I'm not an expert, but I think the answer would be in finding out where each bit of information comes from. hostname may simply read the file /etc/hostname, but host or nslookup probably does a DNS lookup, which might be from an external source rather than your lan. I suspect your /etc/hosts file also has a big effect on the results. May 25, 2014 at 20:27
  • In case I didn't make it clear: my IP address is 192.168.0.69 and my hostname is correctl defined in /etc/hosts and hostname. Also the addresses reported by nslookup and host are nowhere to be found in /etc/hosts.
    – Ya.
    May 25, 2014 at 21:35
  • Also, the reason I want to fix this - I believe this is what's preventing me from getting Oracle running on my box. Though unsupported, I was able to get everything linked up and configured and started the instance with no errors. However I can't connect even from my own box, with tnsping reporting the same retarded IP addresses as nslookup or host.
    – Ya.
    May 25, 2014 at 21:45
  • Or maybe I didn't make myself clear. Some of these addresses and names can be "correctly" defined, but to the wrong setting. I can correctly set my hostname to google.com, but that doesn't make me Google, unfortunately. It depends on where you are looking from, whether inside your lan or outside. You have 2 IP addresses, not just one, so both can be correct, right? If you check your 192.x.x.x address from anywhere other than inside your lan, it won't work. Everyone can have that same address. May 25, 2014 at 21:47
  • If you are trying to access Oracle from your lan, forget about your external address, unless it's a static address, and your router doesn't block it coming in. I use dynamic DNS to access my server from outside, which is set to match my external IP. But that needs to be set up and maintained. May 25, 2014 at 21:51

3 Answers 3

2

If you whois those IP's 198.105.240.0 - 198.105.255.255 is owned by Search Guide Inc. My ISP (Charter, US) uses a service of theirs to try and send me to a search page when a dns lookup results in a not found.

If I up a new machine using DHCP it'll get dns servers from my modem/router... by default the ISP's dns... which causes this to happen.

Using a DNS provider other than your ISP, Google is a good bet (8.8.8.8, 8.8.4.4), will get around this. At one time I found a page on Charter that allowed me to disable that 'feature', but I do not recall where that was.

1

I have the same problem with an HP-UX system, NFS is not working, SAM does not want to launch and a few a other services are running slow or refuse to run. Although I don't know the solution yet, I bet if you go to any other computer (Linux, Windows, UNIX) that use the same DNS server and try to resolve any host name and end it with a dot (.) you'll get the same IP address (198.105.244.23).

dig anyhostname. dig nonsensehostname. host whatever. nslookup badhost.

In my case the IP addresses I get are slightly different than yours, but in the same subnet (198.105.244.24 and 198.105.254.24).

What can be deduced from this is that the problem is with the DNS server and not the local host. In my case DNS is served by an older Linksys router running DD-WRT build 14929, firmware "DD-WRT v24-sp2 (08/12/10) micro".

I will start using a different DNS server, perhaps one to the public Google DNS servers (8.8.8.8 and 8.8.4.4) and see how it goes.

Hope that helps you resolve your problem.

0

Make sure to look in your router's config for any NAT rules. My LAN use of the host command was giving two local IP addresses as part of the list of responses. (All others were public IPs.)

ip nat inside source static 192.168.1.68 www.xx.yyy.zz

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .