FreeNAS to FreeNAS over WAN using rsync module mode

Status
Not open for further replies.

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
Can someone please put up a how-to for syncing data from one FreeNAS server to another FreeNAS server over a WAN? I have read the guide here (http://doc.freenas.org/index.php/Rsync_Tasks) but it's not working. I have a FreeNAS box (192.168.200.254) at home configured with a [PUSH] rsync task in "rsync module" mode (not rsync over SSH). The module name defined in this task matches a "rsync module" I set up on the receiving end. The task on the PUSH side is set to root for the user and in the remote host field I have a public IP address (the WAN IP of the receiving FreeNAS server's network).

On the "server" or receiving side (FreeNAS IP 10.1.10.6) I do NOT have a rsync task configured at all, just a rsync module configured with root as the user and set to read/write. In the "HOSTS ALLOW" text box I added my PUSH server's public IP address as well as the local network that my PULL server is on.

Question, do both servers need to be on the same network or can they be whatever IP address I configure them to be. If on separate networks, what port numbers (on both ends) do I need to forward to the FreeNAS on my router?

Any and AS MUCH information/steps for this are greatly appreciated. I cannot find any information online for this specific topic.

Also, because of the hassle I encountered with this, I attempted to try rsync over SSH but the very first step explained in that link above about how to "Configuring Rsync over SSH Mode Between Two FreeNAS™ Systems" failed on me. I mounted the file system, then when I put in ssh-keygen -t ecdsa, it returned "unknown key type ecdsa". :(
 

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
close

Thanks protosd. After reviewing your blog, I didn't see anything about FreeNAS <-> FreeNAS, and nothing about going over a WAN. I'm starting to think this isn't possible otherwise I would have found something online about it in the last week that I've been searching. In one of your examples in the beginning of the blog, you have a module for what looks like every share on the FreeNAS. Do I need to have a module on both FreeNAS boxes or just the receiving end? Do I need a CRON job in conjunction with a (or to run the) rsync task as well as having a rsync module on one or both of the FreeNAS boxes?

I just want to copy a small folder (initially, as a test) from my FreeNAS box at home to another FreeNAS box at work. Both root passwords are the same.

Thanks again for the blog; that was a real eye-opener! :)

Anyone else have any ideas on how to FreeNAS ---> FreeNAS over a WAN?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
the rsync task actually is a cron job. I'm pretty sure it's possible, nothing special about WAN for rsync that makes it not possible.
Did you forward your ports like protosd suggested? Can you successfully see rsync module running over WAN (you can test with nmap).
 

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
sigh

Sooo, I DO set up a module on the "push" side?... the FreeNAS side that currently ONLY has a rsync task configured (which turns out to be a CRON job itself). I only set up port forwarding (873 from WAN to 10.1.10.6) on the receiving end (the FreeNAS side that has the module set up to receive the rsync task on the PUSH side). From the internet, I can successfully telnet on port 873 to the receiving FreeNAS end.

Thanks for the nmap suggestion Joshua, but until I know the correct way to set up the FreeNAS boxes I don't see the point in getting lost in another open source tool, just yet. Once I know, or someone can confirm the proper way to set them up then I'll use the tool to see if they're communicating as, currently, I wouldn't know what to look for in nmap.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
the freenas box where you setup the task (cron job in reality) doesn't need the module running, or port forwarding. the side that does not have the task configured and is pulled from or pushed to needs the port forwarded, and rsync module running.

nmap IPofRSYNC -p 873

hope that helps a bit
 

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
Sorry Joshua, that does not help at all. Not to sound like an a$$ or anything. nmap IPofRSYNC -p 873?? In that little snippet are you implying I use nmap; (download and install at.... home? office?) and in nmap there is a place to put in an IP (of the RSYNC.... client? server?) and where I insert this IPofRSYNC I will have an option to use the -p switch and also enter a port number 873?
 

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
Joshua, I downloaded nmap on my home computer and ran that command. It reported "Host is up", 0.017s latency, 873, tcp open rsync. Basically it told me what the command prompt already verified, using the command "telnet <IPofRSYNC> 873"...
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Joshua, I downloaded nmap on my home computer and ran that command. It reported "Host is up", 0.017s latency, 873, tcp open rsync. Basically it told me what the command prompt already verified, using the command "telnet <IPofRSYNC> 873"...

Yup, just checking rsync was listening, lol. nmap goes further by verifying it's rsync listening (it does some very deep packet sniffing). Well you know the error is not the connection to listening side, now to find other possible failure points.

Sorry I use rsync over ssh, so I can't help too much other than the networking part...
 

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
Yeah I've given up on the module mode and started with rsync over ssh. I just wish I understood freebsd/linux/unix better; it would make this process go a lot faster. I am now following the process of setting up rsync over SSH from the same page (http://doc.freenas.org/index.php/Rs...ule_Mode_Between_Two_FreeNAS.E2.84.A2_Systems), and on my PUSH side I'm running into a problem while trying to copy the host key of PULL using this command:

ssh-keyscan -t rsa PUBLIC_IP_OF_PULL >> /root/.ssh/known_hosts

I chose to use RSA instead so my command says:

ssh-keyscan -t rsa PUBLIC_IP_OF_PULL >> /root/.ssh/known_hosts

...but that command reports "no such file or directory". I opened shell on the "PULL" FreeNAS and can browse to that exact file/directory so I know it exists. Thinking maybe I needed a VPN connection set up between the two, I tried that and changed my PUBLIC_IP_OF_PULL in that command to it's private IP

(i.e. ssh-keyscan -t rsa 10.1.10.6 >> /root/.ssh/known_hosts)

...but still no luck :(

any ideas Joshua?
p.s. thanks for sticking around (in this thread I mean)
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
hmm, if you have an linux box use "ssh-copy-id"
This takes alot of the fiddling work out of setuping up ssh private public pairs.

Check this link, may help a bit
http://forums.freenas.org/showthread.php?5885-FreeNAS-8-password-less-ssh-settup

only thing you want to change is to move over the ssh private key to the initiators side after setup the public key up. If you still have trouble maybe I can gchat sometime and see if we can get it worked out.

Unix can be very frustrating at time, but it's one of those things that just makes sense fundamentally. There are tools to do nearly everything, and every part is built very elegantly so that parts build on each other. It can take alot of time to feel proficient at it, but I can say after my 3 years of tinkering on the command line I would never want to touch a Windows System cause I don't know what is going on in the background at a fundamental level. I love the control and power a unix system gives me.
 

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
Hey Joshua,

Thanks for the info. I don't have any linux boxes; although I do have a Ubuntu VM I've installed on my Windows 7 machine using VirtualBox, but when I "go" in there I feel like I was teleported to the middle of Mongolia and nothing is familiar. I understand this is part of my problem while trying to set up these two FreeNAS boxes, but the whole idea of them being so "easy and useful" is the GUI. I think it's a given that Unix can be frustrating. I had Unix classes in college but of course, the professor had an extremely harsh South African accent and no one in the class could even understand him. All I remember was him saying "ellll esss minus ellll" (ls -l)...

:\

Quick question. What version of FreeNAS are you using? I'm tinkering with the 8.2.0-BETA3-x86 (at the PULL side @ work) and at home I have the latest -- 8.2.0-BETA4-x86 (PUSH side @ home).
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I am running 8.2 Beta3 right now. gonna upgrade tomorrow. I'm actually in the middle of a large file transfer to setup my new 10 drive RAIDZ2 array.

The ubuntu vm should work perfectly, you just gotta get the private key your using onto it (or create one in there and move it).Once you know how to move private keys around and get password-less login, the rest of the rsync process is cake.
 

danborchert

Dabbler
Joined
Mar 30, 2012
Messages
10
*SOLVED* FreeNAS to FreeNAS over WAN using rsync module mode

Finally got it working in rsync Module Mode. I now have my home FreeNAS box PUSHING data over the WAN to another FreeNAS box that is configured with a module to PULL, and then that data on PULL is being sync'd to rsync.net.

Both sides of my configuration are running FreeNAS-8.0.4-RELEASE-p3-x86 (11703).
Both root passwords on each box are the same.

[PUSH side (FreeNAS box at home)]:
No port forward modification necessary on firewall.
After base install, configure basic network settings (IP, gateway, and Nameserver)
Enable CIFS in "services" - gave it a NetBIOS name and put it in WORKGROUP. Used defaults for the rest.
1. Create volume
owner (user): root
owner (group): whell
permissions set with read, write, and execute for Owner, Group, and Other.
Type of ACL: Unix
Set permission recursively: UNCHECKED
2. Create share
Name: Volume1
Comment:
Path: /mnt/Volume1
Export Read Only: UNCHECKED
Browsable to Network Clients: CHECKED
Inherit Owner: UNCHECKED
Inherit Permissions: CHECKED
Export Recycle Bin: UNCHECKED
Show Hidden Files: UNCHECKED
Allow Guest Access: CHECKED
Only Allow Guest Access: UNCHECKED
Hosts Allow: <empty>
Hosts Deny: <empty>
Aux Params: <empty>
3. Create Rsync Task
Path: /mnt/Volume1/
Remote Host: <public IP of where the FreeNAS PULL server is set up>
Rsync mode: Rsync Module
Remote Module Name: Free2Free
Remote Path: /mnt/Volume1
Direction: Push
Short Description: Home2Work
Schedule: default (runs every hour)
User: root
.... the rest in rsync task dialog box is default
Enabled: CHECKED


[PULL side (FreeNAS box at work)]:
Create port forward on router for port 873 from WAN to LAN IP of FreeNAS box.
After base install, configure basic network settings (IP, gateway, and Nameserver)
Enable Rsync in "services" - use default settings in service properties.
Enable CIFS in "services" - gave it a NetBIOS name and for the workgroup I made it the same name as my work domain (so if my work domain was MYDOMAIN.local, I just put in MYDOMAIN) I used defaults for the rest of the CIFS dialog box.
1. Create volume
owner (user): root
owner (group): MYDOMAIN\Domain Users
permissions set with read, write, and execute for Owner, Group, and Other.
Type of ACL: Unix
Set permission recursively: UNCHECKED
2. Create share
Name: Volume1
Comment:
Path: /mnt/Volume1
Export Read Only: UNCHECKED
Browsable to Network Clients: CHECKED
Inherit Owner: UNCHECKED
Inherit Permissions: CHECKED
Export Recycle Bin: UNCHECKED
Show Hidden Files: UNCHECKED
Allow Guest Access: CHECKED
Only Allow Guest Access: UNCHECKED
Hosts Allow: <empty>
Hosts Deny: <empty>
Aux Params: <empty>
3. Create Rsync Module
Module name: Free2Free
Path: /mnt/Volume1
Access Mode: Read and Write
Max connections: 0
User: root
Group: wheel
Hosts allow: <empty>
Hosts deny: <empty>
Aux params: <empty>

--------------------

Finally, to get my data from PULL to my rsync.net online account:
*you will need an rsync.net account for this to work*
*the following is from this page (http://www.rsync.net/resources/howto/freenas_integration.html) but they fail to start the how-to by telling you to mount the file system in read/write mode first (see step 3 below)*

1. Enable SSH on PULL FreeNAS box
2. Putty to your FreeNAS and log in as root
3. Once logged in, type: mount -uw /
press ENTER
4. Type: ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""
press ENTER
5. Type: scp /root/.ssh/id_rsa.pub 123@tv-s001.rsync.net:.ssh/authorized_keys
where 123@tv-s001 is your rsync server
6. Create a CRON job (System --> Cron Jobs --> Add Cron Job)
User: root
Command: /usr/local/bin/rsync -avH --progress /mnt/Volume1 123@tv-s001.rsync.net:
Schedule: however you want...
Enabled: CHECKED

That's it. Now changes I make at home on my file server (\\freenas\volume1) are replicated to my work FreeNAS, and then ultimately up to my rsync.net account.

*HOPE THIS HELPS EVERYONE*
 

Lee_F

Cadet
Joined
Sep 10, 2013
Messages
1
*SOLVED* FreeNAS to FreeNAS over WAN using rsync module mode

Finally got it working in rsync Module Mode. I now have my home FreeNAS box PUSHING data over the WAN to another FreeNAS box that is configured with a module to PULL, and then that data on PULL is being sync'd to rsync.net.

Both sides of my configuration are running FreeNAS-8.0.4-RELEASE-p3-x86 (11703).
Both root passwords on each box are the same.

[PUSH side (FreeNAS box at home)]:
No port forward modification necessary on firewall.
After base install, configure basic network settings (IP, gateway, and Nameserver)
Enable CIFS in "services" - gave it a NetBIOS name and put it in WORKGROUP. Used defaults for the rest.
1. Create volume
owner (user): root
owner (group): whell
permissions set with read, write, and execute for Owner, Group, and Other.
Type of ACL: Unix
Set permission recursively: UNCHECKED
2. Create share
Name: Volume1
Comment:
Path: /mnt/Volume1
Export Read Only: UNCHECKED
Browsable to Network Clients: CHECKED
Inherit Owner: UNCHECKED
Inherit Permissions: CHECKED
Export Recycle Bin: UNCHECKED
Show Hidden Files: UNCHECKED
Allow Guest Access: CHECKED
Only Allow Guest Access: UNCHECKED
Hosts Allow: <empty>
Hosts Deny: <empty>
Aux Params: <empty>
3. Create Rsync Task
Path: /mnt/Volume1/
Remote Host: <public IP of where the FreeNAS PULL server is set up>
Rsync mode: Rsync Module
Remote Module Name: Free2Free
Remote Path: /mnt/Volume1
Direction: Push
Short Description: Home2Work
Schedule: default (runs every hour)
User: root
.... the rest in rsync task dialog box is default
Enabled: CHECKED


[PULL side (FreeNAS box at work)]:
Create port forward on router for port 873 from WAN to LAN IP of FreeNAS box.
After base install, configure basic network settings (IP, gateway, and Nameserver)
Enable Rsync in "services" - use default settings in service properties.
Enable CIFS in "services" - gave it a NetBIOS name and for the workgroup I made it the same name as my work domain (so if my work domain was MYDOMAIN.local, I just put in MYDOMAIN) I used defaults for the rest of the CIFS dialog box.
1. Create volume
owner (user): root
owner (group): MYDOMAIN\Domain Users
permissions set with read, write, and execute for Owner, Group, and Other.
Type of ACL: Unix
Set permission recursively: UNCHECKED
2. Create share
Name: Volume1
Comment:
Path: /mnt/Volume1
Export Read Only: UNCHECKED
Browsable to Network Clients: CHECKED
Inherit Owner: UNCHECKED
Inherit Permissions: CHECKED
Export Recycle Bin: UNCHECKED
Show Hidden Files: UNCHECKED
Allow Guest Access: CHECKED
Only Allow Guest Access: UNCHECKED
Hosts Allow: <empty>
Hosts Deny: <empty>
Aux Params: <empty>
3. Create Rsync Module
Module name: Free2Free
Path: /mnt/Volume1
Access Mode: Read and Write
Max connections: 0
User: root
Group: wheel
Hosts allow: <empty>
Hosts deny: <empty>
Aux params: <empty>

--------------------

Finally, to get my data from PULL to my rsync.net online account:
*you will need an rsync.net account for this to work*
*the following is from this page (http://www.rsync.net/resources/howto/freenas_integration.html) but they fail to start the how-to by telling you to mount the file system in read/write mode first (see step 3 below)*

1. Enable SSH on PULL FreeNAS box
2. Putty to your FreeNAS and log in as root
3. Once logged in, type: mount -uw /
press ENTER
4. Type: ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""
press ENTER
5. Type: scp /root/.ssh/id_rsa.pub 123@tv-s001.rsync.net:.ssh/authorized_keys
where 123@tv-s001 is your rsync server
6. Create a CRON job (System --> Cron Jobs --> Add Cron Job)
User: root
Command: /usr/local/bin/rsync -avH --progress /mnt/Volume1 123@tv-s001.rsync.net:
Schedule: however you want...
Enabled: CHECKED

That's it. Now changes I make at home on my file server (\\freenas\volume1) are replicated to my work FreeNAS, and then ultimately up to my rsync.net account.

*HOPE THIS HELPS EVERYONE*


Dan, It sounds like the synchronization works and you went through a good chunk of work. Congratulations! I am in a similar situation, but would also like to be able to synchornize changes from both servers. In other words, when either server gets data added to it (3 servers in total), I need the other 2 servers to synchronize. Data could be added at any of the 3 servers at any point in time. Is there a solution for that? Thx!
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
Please don't necro threads that are more than a year old. Please start your own thread if you have a problem or question.
 
Status
Not open for further replies.
Top