Mac OS X Lion cannot resolve localhost [closed] - macos

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I have found serval questions about this but no one helps for me, I am searching for
days to get my problem solved but I can't get it done, I hope someone can help
me with this big issue.
I try to ping my localhost, I need this to develop my web apps. I do this by zendServer.
This problem cames up when I upgraded my OS X to Lion.
I use internet over Apple timecapsule but I think this doesn't matter to make it able to use your localhost?
Host file (sudo nano /private/etc/hosts):
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
Dig result:
leny-pc:~ nickyklaasse$ dig localhost
; <<>> DiG 9.7.3-P3 <<>> localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18908
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;localhost. IN A
;; ANSWER SECTION:
localhost. 10800 IN A 127.0.0.1
;; Query time: 20 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Thu Dec 1 13:08:07 2011
;; MSG SIZE rcvd: 43
Host result:
leny-pc:~ nickyklaasse$ host localhost
localhost has address 127.0.0.1
localhost has IPv6 address ::1
Ping result:
leny-pc:~ nickyklaasse$ ping localhost
ping: cannot resolve localhost: Unknown host
I hope some one can help me to an answer.
With kind regards,
Nicky

Comment this 2 lines and try again:
::1 localhost
fe80::1%lo0 localhost
and let me know what happen

Resolved by a clean new installation of Mac Os Lion by DVD

Related

After DNS A record change, dig and nslookup showing different results for a the same domain name on Mac OS X

After changing the DNS A record of a hostname, dig and nslookup are showing different results. While dig is showing the correct IP, nslookup is still showing the old IP. I am on macos 11.2.3
The nslookup output for my domain {{domainname}} is (note that I replaced the resulting ip address with xxx.old.ip.xxx.
$ nslookup {{domainname}}
Server: 192.168.178.1
Address: 192.168.178.1#53
Non-authoritative answer:
Name: {{domainname}}
Address: xxx.old.ip.xxx
and the dig output (note that I replaced the resulting IP with yyy.new.ip.yyy to indicate that it is a different IP than in the case of nslookup
$ dig {{domainname}}
; <<>> DiG 9.10.6 <<>> {{domainname}}
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45116
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;{{domainname}}. IN A
;; ANSWER SECTION:
{{domainname}}. 1157 IN A yyy.new.ip.yyy
;; Query time: 70 msec
;; SERVER: 192.168.178.1#53(192.168.178.1)
;; WHEN: Fri Mar 12 18:29:03 CET 2021
;; MSG SIZE rcvd: 63
What is going wrong with nslookup? Is it DNS caching? What can I do to force nslookup (and other tools) to refresh the DNS cache if that was the issue.
Update: After about 20 minutes nslookup and dig are showing the same IP and ssh is connecting using the {{domainname}}.
Neither response is from an Authoritative Name Server, therefore the DNS Answer came from a resolver's cache. Before changing a DNS Resource Record, make a note of the TTL value. That is the number of seconds to wait before resolvers drop the cached value. For the dig command, the TTL left on the cached value is 1157 seconds before the next refresh.

Dig command repated SERVER value [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm exploring the various options of dig command. I have disabled all output except the stats section:
$ options="+noanswer +nocmd +nocomments +stats"
$ dig example.com $options
;example.com. IN A
;; Query time: 41 msec
;; SERVER: 75.75.75.75#53(75.75.75.75)
;; WHEN: Wed Apr 01 11:59:25 MDT 2020
;; MSG SIZE rcvd: 56
$ dig stackoverflow.com $options
;stackoverflow.com. IN A
;; Query time: 49 msec
;; SERVER: 75.75.75.75#53(75.75.75.75)
;; WHEN: Wed Apr 01 11:59:43 MDT 2020
;; MSG SIZE rcvd: 110
Why these two different domains return the same SERVER? Every domain that I have tried return the same SERVER value.
;; SERVER: 75.75.75.75#53(75.75.75.75)
Is the DNS Name-server used during the dig command.
You can confirm this by checking which name-server your computer uses;
$ dig +noanswer +nocmd +nocomments +stats example.com
...
;; SERVER: 172.18.0.254#53(172.18.0.254)
...
$ cat /etc/resolv.conf | tail -n 1
nameserver 172.18.0.254
I'm using a local custom DNS server, therefore the local ip ;)

Dnsmasq not working domain .local

i bought a macpro and im quite new, im configuring my development environment, and when i installed dnsmasq i cant access the "anyname.local" page, it says site cant be reached, i have everything running, apache, dnsmasq, but nothing works, i followed this tutorial above.
Link Tut
I print some information maybe someone can have any idea whats wrong.
dig foo.local
; <<>> DiG 9.8.3-P1 <<>> foo.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 3951
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;foo.local. IN A
;; AUTHORITY SECTION:
. 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2018030101 1800 900 604800 86400
;; Query time: 18 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Fri Mar 2 00:03:23 2018
;; MSG SIZE rcvd: 102
The .local suffix should be avoided on MacOS because it is used by MacOS Bonjour service.
You can look at Apple explanation page where they recommend to use other suffixes like: .private, .intranet, .internal, or .lan.
I personally use .localhost, .test or .example.
As a side note, it's also not to recommended to use .dev because Chrome 63 started requiring a SSL certificate for this suffix.
Hope this helps!

Linking DNS to a consul node

I'm trying to set up a consul agent using an example in "Using Docker" (chapter 11). The example suggests running this to set up one of the consul nodes:
docker run -d --name consul -h consul-1 \
-p 8300:8300 -p 8301:8301 -p 8301:8301/udp \
-p 8302:8302/udp -p 8400:8400 -p 8500:8500 \
-p 172.17.42.1:53:8600/udp \
gliderlabs/consul agent -data-dir /data -server \
-client 0.0.0.0 \
-advertise $HOSTA -bootstrap-expect 2
I assume the line with -p 172.17.42.1:53:8600/upp is linking the container's DNS service with the consul node using an IP address that worked for the author. What IP address should I use here?
Looks like 172.17.42.1 was the default bridge address for docker 1.8 to use when a container is connecting to the host. This changed in 1.9 and seems to be 172.17.0.1 for me -- although I don't know if this is a guaranteed.
You seem to be running an example setup, so better if you expose it to your localhost 127.0.0.1 instead. That's a DNS service, as long as you give a dig command using the correct port for DNS, it will just work. For example following will do for port 8600:
dig #127.0.0.1 -p 8600 stackoverflow.service.consul
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.62.rc1.55.amzn1 <<>> #127.0.0.1 -p 53 tracker.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57167
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;stackoverflow.service.consul. IN A
;; ANSWER SECTION:
stackoverflow.service.consul. 0 IN A 10.X.X.X
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jul 7 11:29:01 2017
;; MSG SIZE rcvd: 56
If you want it to work on the default DNS port so that the queries can directly be handled. You can use something like dnsmaq or any of the methods listed at the following link for DNS forwarding:
https://www.consul.io/docs/guides/forwarding.html

DHCP Setting in Mac OS X [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Are there any command line interfaces to the DHCP settings in Mac OS X? I have found that inside System Profiler, the Network tab provides a lot of useful information, but I have not found any documentation about any command line equivalents.
You may use
networksetup -listallnetworkservices
networksetup -getinfo <networkservice>
networksetup -setdhcp <networkservice> [clientid]
networkservice is something like Ethernet (all availabe listed by the first command)
You can also use:
ipconfig getpacket `interface`
where interface would be en0, en1 etc.
ie:
ipconfig getpacket en1
op = BOOTREPLY
htype = 1
flags = 0
hlen = 6
hops = 0
xid = 215448168
secs = 3
ciaddr = 0.0.0.0
yiaddr = 192.168.15.121
siaddr = 0.0.0.0
giaddr = 0.0.0.0
chaddr = 0:19:e3:6:70:95
sname =
file =
options:
Options count is 8
dhcp_message_type (uint8): ACK 0x5
server_identifier (ip): 192.168.15.1
lease_time (uint32): 0xa8c0
subnet_mask (ip): 255.255.255.0
router (ip_mult): {192.168.15.1}
domain_name_server (ip_mult): {192.168.15.249, 192.168.15.240}
domain_name (string): domain.com
end (none):
You can also do:
ipconfig getoption en0 optionname
ie: ipconfig getoption en1 router
192.168.15.1
You should look at:
ifconfig(8)
netstat(1)
netintro(4)
The most important of these (netintro isn't actually a utility but rather introductory information on unix networking) is ifconfig which is the command line tool used to configure the various network interfaces you may have installed on your machine (like your ethernet card and your airport card) as well as any virtual interfaces (like your loopback address and things like parallels).

Resources