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.

I've got OpenVPN client running on 192.168.0.3. What I'd like to do is route all the traffic from the second computer with 192.168.0.100 via OpenVPN client that's running on the first computer. My router ip is 192.168.0.1

Network topology:

Computer with OpenVPN client: 192.168.0.3
Computer that has to be rerouted: 192.168.0.100
Router: 192.168.0.1

I want it to work in the following way:

192.168.0.100 computer => 192.168.0.3 computer => OpenVPN => 192.168.0.1

How can I achieve that by only modifying windows' routing table? I've tried the following, which didn't work (it just dropped my internet connection):

route delete 0.0.0.0 mask 255.255.255.255 192.168.0.1
route add 0.0.0.0 mask 255.255.255.255 192.168.0.100

Thanks!

share|improve this question
    
Don't forget to include details like the OS and version of each machine involved. –  Christopher Cashell Mar 26 '12 at 23:04
    
You're correct, I'm on Windows. –  Ilya Suzdalnitski Mar 27 '12 at 1:12
add comment

migrated from stackoverflow.com Mar 26 '12 at 17:12

This question came from our site for professional and enthusiast programmers.

2 Answers

This is a quick one. Add to your .ovpn client file:

redirect-gateway def1

Also make sure you have IP-Forwarding activated on the server and depending on your Windows Version you might have to set route-method too. Normally this uses the NAPI, but sometimes wants to be set to:

   route-methode exe
   route-delay 2

Try without this first.

EDIT: Aaaah, you want to redirect another computer via the OpenVPN Client. For this to work you need Internet Connection Sharing Services on Windows. Check out http://support.microsoft.com/kb/306126.

share|improve this answer
add comment

You need to make 192.168.0.100 use 192.168.0.3 as its default route instead of 192.168.0.1 (or configure 192.168.0.1 to route packets from 192.168.0.100 to 192.168.0.3). Then you need 192.168.0.3 to route packets for other hosts (I don't know how one does this in Windows). Lastly, you need to tell the OpenVPN server that the 192.168.0.0/24 subnet is routable through 192.168.0.3 so that response packets get back. You need a route directive in the server's configuration file, as well as an iroute directive in the CCD configuration file for 192.168.0.3 (see this page for more details). (You could also get 192.168.0.3 to NAT packets for 192.168.0.100 to avoid this last step.)

share|improve this answer
    
I'm a total newbie in this, can you please give me exact commands to route the traffic? Will entering this command on the computer without OpenVPN work: "route add 0.0.0.0 mask 255.255.255.255 192.168.0.3 metric 1"? How do I route packets for other hosts on Windows? Can you give me example config for OpenVPN? –  Ilya Suzdalnitski Mar 27 '12 at 1:36
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.