Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

OK, this problem has been driving me nuts for days now. I'm typically a linux guy, so while I'm comfortable with the command line stuff. I have no idea where to look on OSX. And typical googling is of no help.

Here's my problem. When I setup the box, it was on one network, which was 10.x.x.x. That was fine. Now, when I bring it home, I bring up the network interface, connect to my home wireless and attempt to ping stuff:

$ ping
PING ( 56 data bytes
Request timeout for icmp_seq 0
--- ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
colossus:~ eteran$ ping
PING ( 56 data bytes
ping: sendto: No route to host
Request timeout for icmp_seq 0
ping: sendto: No route to host
Request timeout for icmp_seq 1

"No route to host", OK, so I check the routing tables...

$ netstat -rn
Routing tables

Destination        Gateway            Flags        Refs      Use   Netif Expire
default         UGSc           11        5     en1    link#5             UCS             1        0     en1       link#5             UHRLWI         12        0     en1
127                UCS             0        0     lo0          UH             19     2051     lo0
169.254            link#5             UCS             0        0     en1
192.168.10         link#5             UCS             4        0     en1       0:1f:90:23:7a:69   UHLWI          12       62     en1   1193       c0:cb:38:6c:3:33   UHLWI           2      164     en1    996          UHS             1      369     lo0      0:1a:a0:e6:ee:90   UHLWI           0       30     en1    903     link#5             UHLWbI          2       25     en1

Destination                             Gateway                         Flags         Netif Expire
::1                                     ::1                             UH              lo0
fe80::%lo0/64                           fe80::1%lo0                     Uc              lo0
fe80::1%lo0                             link#1                          UHL             lo0
fe80::%en1/64                           link#5                          UC              en1
fe80::5ab0:35ff:fe7b:dcf3%en1           58:b0:35:7b:dc:f3               UHL             lo0
ff01::/32                               ::1                             Um              lo0
ff02::/32                               ::1                             UmC             lo0
ff02::/32                               link#5                          UmC             en1

Yup, there's the problem, the default route is set to Which I assume was from the other network. I can manually adjust this with the route command. But next reboot... it's back!

My home network's router is, so of course I want that to be the default route. And I looked, the DHCP request are definitely saying to use that as the default route. But OSX simply refuses to use it. It insists on using this default route the previous connection!

Where is this stored and how can I change it?

share|improve this question

The S flag in the route entry means it's manually added, so you may have to remove it with a command.

Try sudo route delete default.

share|improve this answer
well I didn't add the route manually. I can of course delete it and then add a proper default route. How do I make the change survive a reboot? – Evan Teran Aug 18 '11 at 23:45
If you don't add any new routes, OS X should configure one for you using DHCP I guess. – Aug 18 '11 at 23:49

It's in System Preferences under Network. Set everything to Automatic and this should go back to normal.

Update: A more forceful way.

Click the Locations drop down box and select Edit Locations. Click the + to add a new location. Name it Auto 2 (or whatever). Select this location and apply it.

share|improve this answer
I have definitely tried that :-/ Also, as you can see, there is a route to my network (I can connect o local lan stuff). It's just not the default route. – Evan Teran Aug 18 '11 at 23:37

If you are using both the ethernet and wifi connection at home, since your ethernet must be selected up in the network list, its default is preferred rather than the wifi dhcp. To remove the default from the routing table, you will have to go to the network preferences and go to ip address setting. Here set the "router" field to blank as this is the default gw.

share|improve this answer

The manual approach mentioned above by deleting and adding a new default gateway with the route command solved the problem for me, but it was just a temporary fix since the wrong gateway was set again upon reboot.

To solve this once and for all, I first removed all interfaces under System Preferences/Network, and then added back those who felt necessary. In my case, just 'Ethernet'.

This was on OS X Lion (10.7.5)

share|improve this answer

You must log in to answer this question.

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