How do I delete a route in OS X 10.5

27,484

Solution 1

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!

Solution 2

You may also try to flush the routing tables!

# cf. http://ola-bini.blogspot.com/2008/05/faulty-routes-on-macos-x.html
sudo route flush

To delete a specific route use:

sudo route delete <ipnum> 127.0.0.1

To get the default route use:

route -n get default
netstat -rnf inet  # ... and compare it with the Routing tables

As a last resort replace the contents of your current /etc/hosts file with its original contents below and reboot your computer.

# original /etc/hosts on Mac OS X 10.6
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0 localhost
Share:
27,484

Related videos on Youtube

user40853
Author by

user40853

Updated on September 17, 2022

Comments

  • user40853
    user40853 almost 2 years

    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...

  • user40853
    user40853 about 14 years
    That errs: route: writing to routing socket: No such process delete host sample.com: not in table
  • user40853
    user40853 about 14 years
    Right! And although it's a bit cloudy, I'm pretty sure that it was during the OSX 10.4 days that I was forced to use NetInfo to get the entry in there. Cthulhoid, indeed :)