OSX 10.6 keep using default route other than what it gets from wireless DHCP

3

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 google.com
PING google.com (74.125.113.104): 56 data bytes
Request timeout for icmp_seq 0
^C
--- google.com ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
colossus:~ eteran$ ping google.com
PING google.com (74.125.113.104): 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

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

Internet6:
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 10.255.255.1. 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 192.168.10.1, 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?

Evan Teran

Posted 2011-08-18T23:31:32.890

Reputation: 111

Answers

1

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.

bahamat

Posted 2011-08-18T23:31:32.890

Reputation: 5 130

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 – 2011-08-18T23:37:44.547

1

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.

billc.cn

Posted 2011-08-18T23:31:32.890

Reputation: 6 821

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 – 2011-08-18T23:45:33.177

If you don't add any new routes, OS X should configure one for you using DHCP I guess. – billc.cn – 2011-08-18T23:49:14.507

0

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)

P-a Bäckström

Posted 2011-08-18T23:31:32.890

Reputation: 101

0

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.

Samir Sogay

Posted 2011-08-18T23:31:32.890

Reputation: 193