[Solved] Rsync synchronization over OpenVPN

  • Hello Everybody,


    I'm in the process of setting up an infrastructure that will allow me to synchronize data from a NAS at home to a NAS located in another building.


    I'm currently facing some issues to synchronize data using Rsync and OpenVPN. Would some of you have idea to help me with the configuration (problem described below) or have an idea to setup my network in another way?


    Notice that I've created the thread in this section instead of the Rsync since it's more related to VPN configuration that Rsync.


    The approach:


    • I want to synchronize data using Rsync.
    • Since it's using Rsync, I must do the synchronization over SSH... but I don't want to expose SSH port neither my NAS over Internet !
    • My idea is to run rsync command over VPN tunnel.



    The setup:


    • SOURCE Env: The network containing the NAS that will send data.
    • BACKUP Env: The network containing the NAS that will receive data.
    • In each network there is a NAS server running on OMV 4.1.26. They can access Internet but they are not reachable from outside.
    • In the BACKUP Env, there is an OpenVPN server running on a Raspberry Pi 2 (setup done using PiVPN)
    • The access to the OpenVPN server from outside goes via a router (192.168.1.1) that forwards the VPN port to the Raspberry Pi.
    • In the SOURCE Env, there is a mobile used for testing purposes and a laptop running on Ubuntu 18.04 that connects to the local NAS using SSH.
    • In the SOURCE Env, all devices have OpenVPN Client installed and working properly.



    The current situation:


    Using the default OpenVPN Client from a mobile, I'm able to connect to my BACKUP Env and to connect in SSH to the remote NAS.
    As well, if I connect to the IP 192.168.1.1 from my web browser, I land to the router configuration page of my BACKUP Env.
    --> this is not something is need for my setup but that's what I use to check my VPN tunnel works properly.


    When I connect from a laptop or from the NAS using the default OpenVPN client, I have this behavior.

    • I see that my public IP is the one from the BACKUP Env, meaning the connection is well done.
    • When I go to 192.168.1.1, I land to my SOURCE Env router configuration page. This behavior is different that when I use my mobile.
    • When I try to connect using SSH or to ping my remote NAS, I got a "host not resolved" issue while again it works perfectly fine using my mobile.


    My questions:


    • Why is it not possible to connect to remote servers using OpenVPN client on Ubuntu/OMV while it's working from mobile app?
    • Why do I land to my local router configuration page from laptop and to my remote router configuration page from mobile? (this is not relevant for the setup but I don't understand what happens)
    • How can I configure OpenVPN to make sure my SOURCE NAS can see my BACKUP NAS and send data to him?
    • Is there any OMV plugin that could solve my problem?


    I have the feeling there is something related to routes but I have no idea how that works :) .


    Many thanks for your help !

  • Hi,
    just a guess:
    Using different IP networks in Source and Backup Env. might make a difference? For example:
    Source Env: 192.168.1.xx
    Backup Env: 192.168.10.xx

    OpenMediaVault 6.x (most recent stable version) -- 64 bit -- OMV-Extras 6.x (most recent stable version) -- Default Kernel

  • Hello topi,


    Thanks for your reply but that was not the solution. As I guessed, I just needed to configure the route properly:


    route add -net 192.168.1.52 netmask 255.255.255.255 gw 10.8.0.1 tun0


    And everything is fine now :-).

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!