Friday, December 20, 2013

Add network routes in MAC OSX

Here is a snippet that shows how to add routes to a network only available after a VPN connection has been established. Note the two commands used, one refers to the interface (the vpn interface ppp0) while the other refers to the gateway (192.168.50.100).
$ sudo route -n add -net 10.0.0.32  -interface ppp0
add net 10.0.0.32: gateway ppp0
$ telnet 10.0.0.32 3389
Trying 10.0.0.32...
Connected to 10.0.0.32.
Escape character is '^]'
$ sudo route -n delete  10.0.0.32
delete host 10.0.0.32
$ telnet 10.0.0.32 3389
Trying 10.0.0.32...
^C #timeout
$ sudo route -n add -net 10.0.0.32  -gateway 192.168.50.100
add net 10.0.0.32
$ telnet 10.0.0.32 3389
Trying 10.0.0.32...
Connected to 10.0.0.32.
Escape character is '^]'

No comments:

Followers