So I need to setup a openvpn connection for my work to get access to services etc. I used to work with a OpenSuse Virtual Machine to get things done, but now i set up a vagrant environment (https://github.com/tcdev0/openSUSE-13.1-vagrant-ansible) which provisions a virtual machine (OpenSUSE 13.1) and connects via openvpn to work, which must be done over cli.
I noticed a difference in using the Networkmanager applet for openvpn and manually starting the openvpn connection with
openvpn client.conf
or
systemctl start [email protected]
Using the applet everything works fine, i can access alles services like checking out repositories from our gitlab server over ssh, but starting the openvpn connection manually i cant do that.
I checked the routes which are added while connecting to vpn
/sbin/route
Connection over Networkmanager applet
default 10.128.10.13 0.0.0.0 UG 0 0 0 tun0
10.0.0.0 10.128.10.13 255.0.0.0 UG 0 0 0 tun0
10.128.10.1 10.128.10.13 255.255.255.255 UGH 0 0 0 tun0
10.128.10.13 * 255.255.255.255 UH 0 0 0 tun0
172.16.63.0 * 255.255.255.0 U 1 0 0 eno16777736
server 172.16.63.2 255.255.255.255 UGH 0 0 0 eno16777736
Manual Connection
default 10.128.10.13 128.0.0.0 UG 0 0 0 tun0
default 172.16.63.2 0.0.0.0 UG 0 0 0 eno16777736
10.0.0.0 10.128.10.13 255.0.0.0 UG 0 0 0 tun0
10.128.10.1 10.128.10.13 255.255.255.255 UGH 0 0 0 tun0
10.128.10.13 * 255.255.255.255 UH 0 0 0 tun0
128.0.0.0 10.128.10.13 128.0.0.0 UG 0 0 0 tun0
172.16.63.0 * 255.255.255.0 U 1 0 0 eno16777736
server 172.16.63.2 255.255.255.255 UGH 0 0 0 eno16777736
I should say that i did not configure any routes in the applet, all is set to auto.
So the routes differ from each other but why, what does the networkmanager do or what do i have to configure in my client.conf to get the same result?
Thanks
UPDATE
Thanks for your reply. One thing i noticed while VPN is up:
ifconfig ...
eno167777 Link encap:Ethernet Hardware Adresse 00:0C:29:91:B4:1E
inet Adresse: 172.16.63.131 Bcast:172.16.63.255 Maske:255.255.255.0
For the Network manager connection:
If I do
nslookup gitlab
it shows me the correct address
Name: gitlab
Address: 10.32.1.1
But for the manual connection:
nslookup gitlab
i got
Server: 172.16.63.2
Address: 172.16.63.2#53
Non-authoritative answer:
...
It seems he is asking the wrong dns server or am i wrong?
So obviously there is a problem with the
/etc/resolve.conf
Connecting manual via openvpn does not update this file, while the Networkmanager does.
I dont know if there is a better possibility to automatically update the file, but i came up with the following solution.
adding these lines to the client.conf from (https://github.com/gronke/OpenVPN-linux-push)
script-security 2
up /etc/openvpn/up.sh
down /etc/openvpn/down.sh
and it works ;)