Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Greetings,

I'm using vpnc for a VPN client. I'm also doing some tricky things with route to make sure I can still access my local network, etc. etc. (the particulars here are not very important).

Sometimes I get the routing table so jacked up I get ping: sendto: Network is unreachable for urls that should otherwise resolve.

Currently, if I restart Mac OS X then everything is back to normal. What I'd like to do is reset the routing tables to the "default" (e.g. what it is set to at boot) without a whole system reboot.

I think that step 1 is route flush (to remove all routes). And step 2 needs to reload all of the default routes.

Any thoughts on how to do this? (e.g. what is step 2?)

EDIT Also, I'm noticing another symptom is traceroute also fails on the address in question. For instance:

traceroute the.good.dns.name

traceroute: bind: Can't assign requested address

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted

You need to flush the routes . Use route -n flush several times . Afterwards add your routes with route add.

share|improve this answer
    
I've changed this to the accepted answer. It works! I did route -n flush several times, then I just restarted my networking via the System preferences. It only took me a year to come back and figure this out :) –  Nate Murray May 13 '11 at 16:44
    
This solved a similar problem for me with the Sonicwall's Aventail Connect VPN client which I find particularly prone to "Can't assign requested address" failures, especially when switching wireless networks. Now I have a way to resolve that doesn't avoid a power cycle. Thanks! –  Alan Donnelly Oct 18 '12 at 18:56
add comment

First you need a route for your network interface. If the VPN is disconnected then just take your network interface down and then bring it back up with ifconfig. Then use the route commnand to build in your default gw. So something like:

ifconfig en0 down

ifconfig en0 up

route add <ip address> default

share|improve this answer
    
Yes, but how does Mac OS X know what the default route's ip address is? What I'd really like to see is how Mac OS X does the boot process and do the exact same thing. –  Nate Murray Oct 26 '09 at 22:10
    
...? It gets it from DHCP... –  Jordan Eunson Oct 26 '09 at 22:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.