How to delete a route in OS X 10.5

domain-name-systemmac-osxrouting

I somehow configured my Mac to route all requests for a particular IP Name (sample.com) to the loopback address (127.0.0.1). Now I'm trying to remove this, but can't determine where to do it.

  1. There is no entry for it under /etc/hosts.
  2. The routing table shows that it is mapping the IP Name to the IP address of the Mac.

Routing table output below:

Internet:

Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.2.1        UGSc        4        1    en0
127                sample.com         UCS         0        0    lo0
sample.com         sample.com         UH          1     7093    lo0
169.254            link#4             UCS         0        0    en0
192.168.2          link#4             UCS         6        0    en0
192.168.2.1        0:11:22:22:3f:fa   UHLW       20    55565    en0   1070
192.168.2.15       tsema.org          UHS         0        9    lo0
192.168.2.255      link#4             UHLWb       4    84777    en0

Any help would be greatly appreciated!

Update: Note – I can delete the route to the 192.168.2.15 address – just not the loopback. I'm guessing that it needs to be removed someplace else…

Best Answer

So the key seems to have been that this is a host alias.

  1. I found a useful post

  2. I checked the cache for hosts

    sudo dscacheutil -cachedump -entries Host

  3. I found the host alias listed under /Local/Default

  4. I checked the Directory Services:

    sudo dscl localhost -list Local/Default/Host

  5. Sure enough, there it was!

  6. I deleted it:

    sudo dscl localhost -delete Local/Default/Hosts/sample.com

At some point we'll see if it remains gone following a reboot, but for now, the problem has been solved!