Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  15] [ 0]  / answers: 1 / hits: 54916  / 2 Years ago, thu, may 5, 2022, 1:38:29

I'm trying for several days now to solve my problem. I have been using openvpn for windows for quite a while and after replacing windows with ubuntu 13.10, I was happy to see that openvpn is available for ubuntu as well.



I copied my settings from windows and in /var/log/syslog I see that my connection is successfully created. However, no matter what I do, I'm unable to set routes.
In windows, this was simply done by script that worked as follows (ip addresses slightly differ since I have to keep them private):



c:windowssystem32
oute.exe delete 55.78.16.20
c:windowssystem32
oute.exe delete 55.78.16.0
del tmp.cmd
c:windowssystem32
oute.exe print | grep.exe -m1 "^ *0.0.0.0" | sed.exe s/x20x20*/ /g | cut.exe -f4 | sed "s/.*/c:windowssystem32route.exe add 55.78.16.20 mask 255.255.255.255 &/" > tmp.cmd
c:windowssystem32
oute.exe print | grep "^ *172.16.0.1" | sed s/x20x20*/ /g | cut -f4 | sed "s/.*/c:windowssystem32route.exe add 55.78.16.0 mask 255.255.255.0 &/" >> tmp.cmd
tmp.cmd


After connection was set and above script was executed, connections to my servers went through VPN, while all other went normally.



Since this script uses grep, sed and cut, I figured I can easily "translate" it to linux. And I did it, except for the fact that I'm a bit unsure how to use route command to set my connection properly.



P.S. I also tried setting VPN using network manager, but the same question appears: how to add routes?



Thx in advance


More From » networking

 Answers
7

On OpenVPN you can accomplish this in three ways:




  1. Server pushes the route to ALL the clients. You do this by putting the route command in the server.conf file, on the server

  2. Server pushes the route to a single client. You do this by putting the route command in a client-specific file in what's known as the client-config folder on the server

  3. Client sets up the route. You do this by putting the route into your client config (ovpn on windows) file



In all three cases it looks like this:



route [routeaddress] [netmask]


i.e.



route 172.92.3.0 255.255.0.0


Consult this page for details.



http://openvpn.net/index.php/open-source/documentation/howto.html


[#27491] Saturday, May 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
impisaso

Total Points: 423
Total Questions: 106
Total Answers: 104

Location: Virgin Islands (U.S.)
Member since Tue, Feb 2, 2021
3 Years ago
;