1

I'm trying to setup custom A records for domains via /etc/hosts on my OSX 10.13.2 MBP.

It usually works just fine, first time that it works only for 1 of the 2 domains:

  • 1.2.3.4 dev.com (works; points to 1.2.3.4)
  • 1.2.3.4 admin.dev.com (doesn't work; points to live IP 5.6.7.8)

I tried flushing DNS cache as well without success using:

sudo dscacheutil -flushcache

Pinging both domains returns 100% packet loss

PING dev.com (1.2.3.4): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5

Also tried different browsers (Opera, Firefox, Safari) as I know Chrome is pretty agressive with DNS caching.

Any idea?

EDIT: IP adresses and domains are pure fiction here.

  • Try using: sudo killall -HUP mDNSResponder – user3439894 Jan 8 '18 at 21:27
  • It depends on whether 1.2.3.4 is a placeholder in your question only. The real addresses 1.2.3.4 (or 1.1.1.1) are defunct/filtered because a lot of people use it as placeholders. ping sld.tld (1.2.3.4) really times out! – klanomath Jan 8 '18 at 23:33
  • @user3439894; seems like killing the process worked it's magic! @klanomath; indeed, it was just for the example :) – pycvalade Jan 9 '18 at 15:24
1

Based on @user3439894 comment to the original question, directly killing mDNSResponder processes fixed the issue for me.

Command used was:

sudo killall -HUP mDNSResponder

From the killall manual page:

killall sends a signal to all processes running any of the specified commands. If no signal name is specified, SIGTERM is sent.

Signals can be specified either by name (e.g. -HUP or -SIGHUP ) or by number (e.g. -1) or by option -s.

You must log in to answer this question.

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