# Building a redundant FreeBSD server



## danaeckel (Jan 7, 2014)

Greetings,

As I was cleaning up my work area I have a couple of older 32-bit PC's. I was thinking how nice it would be if I could have some sort of backup system for if my main server were to break. My server is a 64-bit i3 that is the home to a FreeBSD 9.1 install that has several things running on it. This ranges from Samba server to SUPS server, Apache, DHCP, DNS, Dan's Guardian and Squid it is a learning project that got big. Now my questions are,

 How hard would it be to replicate this on a Athlon XP based system?
 Is it possible to load balance them?
 If the main server died, could the backup kick right in?

Thanks!
Dana


----------



## SirDice (Jan 8, 2014)

danaeckel said:
			
		

> How hard would it be to replicate this on a Athlon XP based system.


Not at all. From a usage point of view a 32 and a 64 bit system aren't that different. Install the same version of the OS (besides the architecture of course) and simply install the same ports/packages. Then it's just a matter of synchronising the configurations.



> Is it possible to load balance them?


For most of the services you are running, sure. I'm not so sure about Samba though, that's going to get tricky. 



> If the main server died, could the backup kick right in?


It could if you use carp(4) for example. CARP will switch over to the backup almost instantly.


----------



## danaeckel (Jan 10, 2014)

Hey, thanks for the advice. I will check out CARP.

Dana


----------



## junovitch@ (Jan 10, 2014)

I think that carp(4) would work well in some cases but do consider what services you are using.  It won't help sync files on your Samba share but it would help network devices failover to a second Samba share if one failed.  Here's my basic idea for a few of them:

Samba - Install net/unison or net/unison-nox11.  Run Samba on both servers and use Unison to sync files on a regular basis.  Honestly I would just point clients to the faster box and let the slow box be the backup.  Should you have to change to the slow box, Unison would have it up to date for you.  When you fix the fast box, Unison does two way syncs so the updates will get pushed back from the slow machine to the faster one.

DHCP - Search for DHCP failover as there are some specific configuration so they don't stomp on each other.  Here's a site with an example.  http://www.madboa.com/geek/dhcp-failover/

DNS - Easy enough, make the fast one your master and the slow one your slave.  Make sure your DHCP configuration has multiple name server directives.

Squid - Probably would work well with carp.  Should any fail-over happen, the result to clients wouldn't matter much.  Maybe it would require them to re authenticate if you are using Squid authentication, but if not the only different I suppose would be different stuff in the cache.  It might take longer for web requests right after fail-over.

Apache - The same DNS name pointing to both servers on both would result in basic DNS round robin load balancing.  Clients will use whatever server responds.


----------

