LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   NetworkManager-openvpn issue (https://www.linuxquestions.org/questions/slackware-14/networkmanager-openvpn-issue-4175559873/)

BratPit 11-25-2015 11:12 AM

NetworkManager-openvpn issue
 
Hi

I link to internet mostly through openvpn service .
I used for that NetworkManager, but recently NM allows connect only once after switching ON system or reboot.
If I disconnect VPN using NM-applet next time switching ON VPN does not work .
Using CLi pure openvpn client works flawlesly OFF and ON.
I suppose something happens from routing, and bringing UP tun0 interface but I do not know the cause.
This is snippet after first succesfull connection:

PHP Code:

16:31:19 --> root in po]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    
Use Iface
default         192.168.178.1   0.0.0.0         UG    100    0        0 eth0
10.108.21.0     
*               255.255.255.0   U     0      0        0 tun0
10.108.21.0     
*               255.255.255.0   U     50     0        0 tun0
loopback        
*               255.0.0.0       U     0      0        0 lo
zurich
.tigerbac 192.168.178.1   255.255.255.255 UGH   100    0        0 eth0
192.168.178.0   
*               255.255.255.0   U     100    0        0 eth0
[16:31:33 --> root in po]$ ip route
default via 192.168.178.1 dev eth0  proto static  metric 100 
10.108.21.0
/24 dev tun0  proto kernel  scope link  src 10.108.21.19 
10.108.21.0
/24 dev tun0  proto kernel  scope link  src 10.108.21.19  metric 50 
127.0.0.0
/8 dev lo  scope link 
178.255.153.76 via 192.168.178.1 dev eth0  proto 
static  metric 100 
192.168.178.0
/24 dev eth0  proto kernel  scope link  src 192.168.178.7  metric 100 
[16:31:49 --> root in po]$ ifconfig
eth0
flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.178.7  netmask 255.255.255.0  broadcast 192.168.178.255
        ether 74
:d4:35:a1:82:23  txqueuelen 1000  (Ethernet)
        
RX packets 107  bytes 19611 (19.1 KiB)
        
RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 159  bytes 10542 
(10.2 KiB)
        
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 26  base 0x6000  


lo
flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 0  
(Local Loopback)
        
RX packets 129  bytes 7167 (6.9 KiB)
        
RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 129  bytes 7167 
(6.9 KiB)
        
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tun0
flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 10.108.21.19  netmask 255.255.255.0  destination 10.108.21.19
        unspec 00
-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100  (UNSPEC)
        
RX packets 0  bytes 0 (0.0 B)
        
RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 
(0.0 B)
        
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 

When I switch off VPN using NM go down tun0 interface and routes goes back to default but there is log error from NM that tell something goes wrong.

Quote:

<error> [1448465548.948607] [platform/nm-linux-platform.c:2883] do_change_link(): platform-linux: do-change-link: failure changing link 5: No such device (31)
If I try reconnect after that logs says that there is something like connection ????? but interface tun0 is down and routing went to eth0 like it should be.

Quote:

25/11/2015 16:57:14 brat NetworkManager[789] <info> VPN plugin requested secrets; state connect (4)
25/11/2015 16:57:14 brat nm-openvpn[2630] UDPv4 link local: [undef]
25/11/2015 16:57:14 brat nm-openvpn[2630] UDPv4 link remote: [AF_INET]178.255.153.76:1194
25/11/2015 16:57:15 brat nm-openvpn[2630] [tigervpn.com] Peer Connection Initiated with [AF_INET]178.255.153.76:1194
25/11/2015 16:57:18 brat nm-openvpn[2630] AUTH: Received control message: AUTH_FAILED,You are already logged in - access denied
25/11/2015 16:57:18 brat nm-openvpn[2630] SIGUSR1[soft,auth-failure] received, process restarting
after several attempts in the end either links VPN or not. If links logs says OK.....

PHP Code:

25/11/2015 17:45:48    brat    NetworkManager[789]    <info>  VPN connection 'CH - Zurich @tigervpn.com' (IP Config Getreply received.
25/11/2015 17:45:48    brat    NetworkManager[789]    <info>  VPN connection 'CH - Zurich @tigervpn.com' (IP4 Config Getreply received.
25/11/2015 17:45:48    brat    NetworkManager[789]    <info>  VPN Gateway178.255.153.76
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>  Tunnel Devicetun0
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>  IPv4 configuration:
25/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Internal Gateway10.108.21.1
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Internal Address10.108.21.16
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Internal Prefix24
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Internal Point-to-Point Address0.0.0.0
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Maximum Segment Size (MSS): 0
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Forbid Default Routeno
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Internal DNS178.255.153.77
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    Internal DNS8.8.8.8
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>    DNS Domain'(none)'
25/11/2015 17:45:48    brat    NetworkManager[789]    <info>  No IPv6 configuration
25
/11/2015 17:45:48    brat    NetworkManager[789]    <info>  VPN plugin state changedstarted (4


.......but there is another error about routing
PHP Code:

25/11/2015 17:45:48    brat    NetworkManager[789]    <error> [1448469948.775758] [platform/nm-linux-platform.c:2883do_change_link(): platform-linux: do-change-linkfailure changing link 6No such device (31)
25/11/2015 17:45:48    brat    NetworkManager[789]    <warn>  platform-linux: do-add-ip4-addressfailure adding ip4-address '6: 10.108.21.16/24'No such device (31)
25/11/2015 17:45:48    brat    NetworkManager[789]    <warn>  platform-linux: do-add-ip4-routefailure adding ip4-route '6: 0.0.0.0/0 50'Unspecific failure (1)
25/11/2015 17:45:48    brat    NetworkManager[789]    <warn>  default-routefailed to add default route 0.0.0.0/0 via 10.108.21.1 dev 6 metric 50 mss 0 src vpn with effective metric 50 

and there is no tun0 in routing table but nm-applet shows connection.Route command shows that tunnel is assembled from eth0 and there is no tun0 interface.
PHP Code:

[16:36:28 --> root in po]$ ip route
default via 192.168.178.1 dev eth0  proto static  metric 100 
127.0.0.0
/8 dev lo  scope link 
178.255.153.76 via 192.168.178.1 dev eth0  proto 
static  metric 100 
192.168.178.0
/24 dev eth0  proto kernel  scope link  src 192.168.178.7  metric 100 
[16:36:33 --> root in po]$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    
Use Iface
default         192.168.178.1   0.0.0.0         UG    100    0        0 eth0
loopback        
*               255.0.0.0       U     0      0        0 lo
zurich
.tigerbac 192.168.178.1   255.255.255.255 UGH   100    0        0 eth0
192.168.178.0   
*               255.255.255.0   U     100    0        0 eth0 

I do not know what to say. I revert back NM to that from slackware 14.1 that works but in current do not work previous like a newest.
Something goes wrong with NM but cli openvpn works like expected without issue.

pchristy 11-26-2015 04:01 AM

All working fine and as expected here on 64-current: /var/log/packages/NetworkManager-1.0.8-x86_64-1 /var/log/packages/NetworkManager-openvpn-0.9.8.4-x86_64-1_SBo

Which versions are you running?

(looks like my openvpn is a bit out-of-date, but hey! It works!)

--
Pete

BratPit 11-26-2015 09:15 AM

Not for me. Work only once per sesion for the first time .Next work only after reboot.

Wersion 0.9.10.2 is even more verbose on second , third .... attempt.

Quote:

26/11/2015 16:06:10 brat NetworkManager[793] <error> [1448550370.709459] [platform/nm-linux-platform.c:2278] link_change(): Netlink error changing link 5: <DOWN> mtu 0 (1) driver 'unknown' udi '/sys/devices/virtual/net/tun0': No such device
26/11/2015 16:06:10 brat NetworkManager[793] <error> [1448550370.709523] [platform/nm-linux-platform.c:1782] delete_object(): Netlink error deleting 10.197.21.6/24 lft forever pref forever lifetime 134-0[4294967295,4294967295] dev tun0 src kernel: No such device (-31)
26/11/2015 16:06:10 brat NetworkManager[793] <error> [1448550370.711073] [platform/nm-linux-platform.c:1722] add_object(): Netlink error adding 0.0.0.0/0 via 10.197.21.1 dev tun0 metric 1024 mss 0 src user: Unspecific failure
26/11/2015 16:06:10 brat NetworkManager[793] <error> [1448550370.711157] [platform/nm-linux-platform.c:1722] add_object(): Netlink error adding 10.197.21.1/32 via 0.0.0.0 dev tun0 metric 1024 mss 0 src user: No such device
26/11/2015 16:06:10 brat NetworkManager[793] <error> [1448550370.711175] [platform/nm-linux-platform.c:1722] add_object(): Netlink error adding 0.0.0.0/0 via 10.197.21.1 dev tun0 metric 1024 mss 0 src user: Unspecific failure
26/11/2015 16:06:10 brat NetworkManager[793] <error> [1448550370.711185] [nm-policy.c:693] update_ip4_routing(): Failed to set default route.

pchristy 11-26-2015 09:47 AM

Is the tun module loading?
Code:

lsmod | grep tun
tun                    18941  0

If you are running the standard kernel, you may need to be root to do lsmod.

That final "0" should become "2" when you open an openvpn link.

--
Pete

BratPit 11-26-2015 11:10 AM

Quote:

Originally Posted by pchristy (Post 5455663)
Is the tun module loading?
Code:

lsmod | grep tun
tun                    18941  0

If you are running the standard kernel, you may need to be root to do lsmod.

That final "0" should become "2" when you open an openvpn link.

--
Pete

Is OK.I repeat.

1. if I conect via openvpn cli

Quote:

openvpn --config xxxx.ovpn
connections and reconnections are OK.
2.if I connect via NM-openvpn applet only works for the first attempt after boot or reboot.
second,third... attempts after connection OFF produces this errors. Interface tun0 is not raised like it was for the first time and 1 more route path is added to eth0 interface. NM-applet visually shows that there is tunnel but shows wrong.

I send bug info to NM maintainers too, but maybe it's the misconfigured server .I am only a client.

pchristy 11-26-2015 11:45 AM

OK, but I'm wondering if the cli is correctly loading the module while the gui isn't. In which case it could be some kind of configuration error on your machine. All I can say is that it works fine here - I can open and close the vpn as many times as I like without issues - which is why I wonder about configuration issues.

--
Pete

BratPit 11-26-2015 12:08 PM

That's the question.

If it was misconfiguration for my side /client/ it would not be connection at all, but it is for the first time.
Maybe server side but it's my VPN provider matter.

Even with this bad connection is created tun0 virtual interface in /sys/devices/virtual/net/ directory but it is not raised and routing does not create the proper path to it because it can not.


Finally downgrade NM-openvpn to 0.9.8.4 from 1.0.8 and 0.9.10.2 and it seems work properly as in you but not every time :-(
It's better .
It must be something wrong in those later versions, or may be in slack after this big updates.

Thanks

pchristy 11-27-2015 02:47 AM

Well if the tun0 device exists, then the only other thing I can think of is a permissions issue. Have you checked the permissions of tun0 both when its working and when it isn't?

One other thing I notice is in your 3rd code snippet in your original post. It says that authorisation failed because you are already logged in. Could it be that when you log out, it is not dropping the connection properly?

Finally, I would try disabling ipv6 on your vpn connection, if it is enabled. I have had ipv6 cause me all sorts of grief in the past, although it seems to be much better these days. Could ipv6 be keeping your login open and stopping you from logging in again?

I'm reaching the limits of my experience here, but since no-one else has chipped in..........

--
Pete

BratPit 11-28-2015 02:55 PM

pchristy

Permissions are and were OK.
Authorisation was OK. I wanted to turn on and off too quickly. Server has some latency so I got failure on your own wish :-)
IPV6 - I do not use from the beginning in the configuration I have disabled.

It turned out that recompile kernel solved the problem.

I do not use the original karnel from Slackware.
Compile alone since the beginning of 2.4. Recently I used 3.18.18 I patched to the latest version 3.18.24 and OK for now. Sure there was some regression or one little thing: CONFIG_NETLINK_DIAG option. I had compiled it as a module. Now I have built a permanent in a monolith.
Which helped? Does not matter . Works now.

Thanks any way.

pchristy 11-29-2015 03:15 AM

Like you, I'm not using the stock kernel - I'm currently running 4.3.0. I prefer to have a kernel "tuned" for my system, removing all the unnecessary stuff. This isn't a criticism of the stock kernel in any way. That has to be able to run on a wide variety of hardware, much of which won't exist on any individual machine.

But back to the main point: Which version of network-openvpn ended up working for you? I ask, because having noticed that my version was still back at 0.9.8.4, I tried upgrading to both 1.0.8 and 1.0.6, and both failed to connect with a "timeout" error! Re-installing 0.9.8.4 restored normal operation!

I'm puzzled!

--
Pete

BratPit 11-29-2015 06:19 AM

1.0.8 works too.

from 1.0.6 you have to create nm-openvpn user.

Quote:

groupadd -r nm-openvpn
useradd -r -g nm-openvpn -d / -s /sbin/nologin -c "Default user for running openvpn spawned by NetworkManager" nm-openvpn

Hope it helps.

pchristy 11-29-2015 12:21 PM

Ah! I'll give that a try! Thanks!

Where did you find that little gem of Information?

P.S. Tried it and it works! :-D

--
Pete

BratPit 11-29-2015 01:25 PM

I read it from the official patch for 1.0.6 version :-)

NM implementation directive "user" and "group" from openvpn configuration file .

I'm glad it works for you.


All times are GMT -5. The time now is 08:10 AM.