VPN connection sometimes drop for unknown reasons

Hi,
We have setup our workflow for our builds, but we have some issues with the VPN.

We followed the documentation written here
Sometime it all goes well and that’s awesome, but sometime the VPN connection doesn’t work.

Here is the logs we have when it fails:

  • temp_dir=/tmp/vpn-config
  • mkdir /tmp/vpn-config
  • cat
  • sleep 3
  • sudo openfortivpn -c /tmp/vpn-config/m6w-ghe.conf --pppd-no-peerdns
    INFO: Connected to gateway.
    INFO: Authenticated.
    INFO: Remote gateway has allocated a VPN.
    ++ ps aux
    ++ grep ‘sudo openfortivpn’
    ++ grep root
    ++ awk ‘{print $2}’
  • sudo kill 1988
    INFO: Cancelling threads…
  • sleep 2
    INFO: Terminated pppd.
    INFO: Closed connection to gateway.
    ERROR: connect: Network is unreachable
    INFO: Could not log out.
  • sleep 5
  • sudo openfortivpn -c /tmp/vpn-config/m6w-ghe.conf --pppd-no-peerdns
    INFO: Connected to gateway.
    INFO: Authenticated.
    INFO: Remote gateway has allocated a VPN.
    INFO: Cancelling threads…
    INFO: Terminated pppd.
    INFO: Closed connection to gateway.
    INFO: Logged out.
  • case “$OSTYPE” in
  • echo ‘Disabling IPv6 and forcing DNS settings’

For comparison, here is the log when it all goes fine:

  • temp_dir=/tmp/vpn-config
  • mkdir /tmp/vpn-config
  • cat
  • sleep 3
  • sudo openfortivpn -c /tmp/vpn-config/m6w-ghe.conf --pppd-no-peerdns
    INFO: Connected to gateway.
    INFO: Authenticated.
    INFO: Remote gateway has allocated a VPN.
    ++ ps aux
    ++ grep ‘sudo openfortivpn’
    ++ grep root
    ++ awk ‘{print $2}’
  • sudo kill 1985
    INFO: Cancelling threads…
  • sleep 2
    INFO: Terminated pppd.
    INFO: Closed connection to gateway.
    ERROR: connect: Network is unreachable
    INFO: Could not log out.
  • sleep 5
  • sudo openfortivpn -c /tmp/vpn-config/m6w-ghe.conf --pppd-no-peerdns
    INFO: Connected to gateway.
    INFO: Authenticated.
    INFO: Remote gateway has allocated a VPN.
    INFO: Got addresses: [10.93.19.1], ns [0.0.0.0, 0.0.0.0]
    INFO: Interface ppp0 is UP.
    INFO: Setting new routes…
    add net 141.138.91.186: gateway 10.100.0.1
    add net 141.138.91.177: gateway 10.93.19.1
    INFO: Adding VPN nameservers…
    INFO: Tunnel is up and running.
  • case “$OSTYPE” in
  • echo ‘Disabling IPv6 and forcing DNS settings’

We currently have no idea as to why sometimes it works and sometimes not, any advice on how to debug would be useful.
I have to look at how to remote access the VM yet, but if anyone as an idea, I’m all ears :slight_smile:

Based on this I’d say it’s most likely some kind of timing issue - I’d try to increase the sleep values a bit, that alone might help.

If it would not, or if you’d have any questions just let us know! :wink:

Thanks for the insight, I did up all the sleeps to 10 hoping it’ll improve the working rate :), I’ll keep you informed :slight_smile:

1 Like

Thanks, please do keep us updated! :wink:

It seems it did the trick, thanks a lot :slight_smile:

1 Like

Happy to hear @jvossen! Happy Building! :slight_smile:

This topic was automatically closed after 13 days. New replies are no longer allowed.