# nic failover / bonding



## blah (Jul 20, 2009)

I need to do the FreeBSD 6.1 equivalent of linux's failover nic bonding.  From searching around it looks like the only possibility prior to LAGG is to use ng_one2many.  I haven't found any specific examples of this, because I do not need load balancing and cannot allow packet duplication.  Basically, this is to allow one physical server with two nics to survive switch or nic failure.  Each nic is connected to a different switch, both on the same vlan.  

So, assuming this is even possible, I found a guide with a similar example that I was trying:  http://groups.google.com/group/freebsd/browse_thread/thread/0bc6f0c2d53015f9

excerpt:

```
######### SNIP ##########
#load necessary modules
kldload ng_ether
kldload ng_one2many

# create virtual interface
ngctl mkpeer . eiface hook ether
ngctl mkpeer ngeth0: one2many upper one

# connect real interfaces to ngeth0
ngctl connect vr0: ngeth0:upper lower many0
ngctl connect de0: ngeth0:upper lower many1

# setting real interfaces up
ifconfig vr0 up -arp
ifconfig de0 up -arp 
...SNIP
```
My real interfaces are bge0 and bge1.  When I follow this guide, when I get to "ngctl connect bge0: ngeth0:upper lower many0", I get the "ngctl: send msg: No such file or directory" error.  I cannot figure out why.  

-kldstat shows netgraph.ko, ng_one2many.ko, ng_ether.ko, ng_eiface.ko are all loaded. 
-syntax of the command looks correct to me: "ngctl connect bge0: ngeth0:upper lower many0"
-when I run ngctl list, I see bge0, bge1, ngeth0, an unamed eiface and the default ng1922 socket
-I've tried it with the real interfaces up with dhcp, and downed.  Same result.

Any idea what I am doing wrong here?  Is this even on the right track to accomplishing my goal?

Thanks.


----------



## danger@ (Jul 20, 2009)

Take a look at lagg(4) and carp(4).


----------



## phoenix (Jul 20, 2009)

lagg didn't appear until FreeBSD 6.3.

However, that would be the best solution, which would require a fairly simple upgrade to FreeBSD 6.3 (or 6.4).


----------



## blah (Jul 21, 2009)

I looked into carp already, but from what I understand it allows you to make two routers appear as one but does not seem to offer anything for general purpose server redundancy.  Maybe I am misunderstanding it?

Also, I would be happy to try lagg if it can be run on 6.1.  The server I need to work on is a production server, so any upgrade has to have a rollback option.  Or, I'd need to build another server as a drop in replacement.  I don't know if two minor revs upgrade is reversable, but these might be options.


Is it even possible to do this with netgraph?   Anybody know what this file not found error with ngctl means here?


----------



## DutchDaemon (Jul 21, 2009)

blah said:
			
		

> I looked into carp already, but from what I understand it allows you to make two routers appear as one but does not seem to offer anything for general purpose server redundancy.  Maybe I am misunderstanding it?



Quite 

It makes two (or more) machines available under one _shared_ IP address, but there will be two (or more) machines behind that IP address (each on their own _real_ IP address). In other words: if one of these machines fails, there will always be one (or more) machines behind that IP address. And these machines share/exchange state information in the background, so running sessions will not be lost. 

That's why it's called *C*ommon *A*ddress *R*edundancy *P*ool. Common Address = shared IP address, Redundancy = the servers behind that IP address -- they're Pooled


----------



## blah (Jul 21, 2009)

Ah, sort of like clustering.  I can see how that could be very useful but I was hoping for something that doesn't require another machine.  I realize I'm being inflexible here but I'm really looking for a solution that requires the least interruption on this high-profile production server.

I'm certainly willing to do what it takes to get this redundant but from what I've read it *should* be possible with netgraph I just can't find the specific info to set it up.  The examples I've found result in a totally generic file not found error.


----------



## DutchDaemon (Jul 21, 2009)

If you're running a stock/vanilla 6.1-RELEASE, doing a binary update to 6.3-RELEASE shouldn't be too hard, and freebsd-update has rollback functionality. That would open up lagg to you, which is the best tool for this job.


----------



## blah2 (Aug 26, 2009)

Okay I finally got some time to do this.  I feel like a moron, but, where the heck do I get the freebsd-update binary?  If you google it you get to http://www.daemonology.net/freebsd-update/, which... doesn't seem to have any mention of code or binaries anywhere!  It says that it is included in FreeBSD 6.2, but no links to any code.  As I am running only FreeBSD 6.1 I do not have it.  Is this available anywhere or am I stuck installing FreeBsd 6.2 on a VM just to grab the binary, or compiling from source? x(


----------



## blah2 (Aug 26, 2009)

Nevermind, found a 6.1-6.2 guide at http://www.daemonology.net/blog/2006-11-26-freebsd-6.1-to-6.2-binary-upgrade.html

I'll post results on lagg after the upgrade...


----------

