# Static-routes, openvpn, and squid

## Captain_Loser

I'm having a little trouble getting a static route to work.

I have an openvpn connection and my goal is to route only specific domains through the VPN while the remainder of my network traffic goes out my normal internet connection. I already run a squid proxy and am able to use the tcp_outgoing_address to make requests for the domains that I want to send through the VPN come from a single IP address. My question is, how do I build a static route to send a single IP address only through my VPN.

Right now, when I connect to my VPN all my traffic is diverted through the VPN. I can disable this functionality by using the nopull option in openvpn, but then no traffic goes through the VPN.

Better explanation of my end goal: I want all traffic originating from the IP 10.0.0.222 for example, to go through my VPN while the remainder of my internet traffic goes through my normal gateway and does NOT use the VPN. How do I setup a static route to achieve this, and how do I prevent the openVPN gateway from becoming the default route on the system?

Thanks

----------

## szatox

Perhaps something like this could do the trick?

route add -host 10.0.0.222 dev vpn0

----------

## Anon-E-moose

There's probably some hints for what you want to do here http://openvpn.net/index.php/open-source/documentation/howto.html

I've set up my openvpn to only start the tun interface, but not set up a default route.

I only use it for deluge and point to the tun interface.

Actually I've got two setups depending on how I call it, one does set up a default route, for everything and the other is as described above.

I set up a route up and down script and have the openvpn config file point to it for specific routing.

----------

