LAGG interface with both IPv4 and IPv6

Greetings all. I need to set up a LAGG failover interface that has both an IPv4 and IPv6 address. All the examples I have found so far only detail setting up LAGG failover with IPv4. As this is going on a production machine during a short maintenance window, between 2 AM and 4 AM local time, I need to have as little downtime as possible. Experimenting until I get it correct is not an option. Is there a document somewhere that details using both IPv4 and IPv6 on a single LAGG failover interface? If not, could one of you fine folk give me an example of how to set this up? Thanks!
 
Ever considered doing the experimenting on a couple of VirtualBox guests?
Thanks for the suggestion. Yes I did consider testing in a VM. I started doing that on my FreeBSD workstation, until I recalled our company "desktop LAN" does not have IPv6 on it. Only the customer facing network containing this server has IPv6 available. However, this customer facing network that has IPv6 available does not have any servers with VirtualBox on them. Since I want to test that IPv6 is working once the LAGG interface is created, I presume I need to have IPv6 connectivity to the system on which I do this.

Is it possible I am the first one to ever try this? I would hope not! My hope is there is documentation on how this is done somewhere or someone here has already done this and can provide pointers.
 
Okay, how about I post what I think will work and you guys critique it. Here is what I am considering:

Code:
ifconfig_igb0="up"
ifconfig_igb1="up"
ifconfig_lagg0="laggproto failover laggport igb0 laggport igb1 up"
ifconfig_lagg0_alias0="inet ###.###.###.###"
ifconfig_lagg0_alias1="inet6 ****:***:****:****::***/64"
Will that work as expected and give 'lagg0' both an IPv4 and IPv6 address? This is essentially what I started to do on my workstation before I recalled the lack of IPv6 on the LAN.
 
This should work:
Code:
ifconfig_igb0="up"
ifconfig_igb1="up"
ifconfig_lagg0="laggproto failover laggport igb0 laggport igb1 inet ###.###.###.### netmask XX.XX.XX.XX"
ifconfig_lagg0_ipv6="****:***:****:****::***/64"
 
I whined enough to management to get a lab resource to test on. It should be available "soon" I'm told. :)

SirDice, asteriskRoss, I appreciate the feedback! Thank you.
 
Well, that was fun.

So, here is what I have that works. Yep, it's ugly.

In /etc/rc.conf
Code:
ifconfig_igb0="up"
ifconfig_igb1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport igb0 laggport igb1 inet ###.###.###.###/29 up"
ifconfig_lagg0_ipv6="inet6 ####:###:####:####::###/64"
defaultrouter="###.###.###.###"
ipv6_defaultrouter="####:###:####:####::1"
Essentially everything after laggport igb1 on the ifconfig_lagg0 line appears to be totally ignored, thus the defaultrouter line is ignored as well. No changes I made would ever get me an IPv4 address on lagg0 if I made them in /etc/rc.conf, it would always come up with just the IPv6 address and IPv6 default route ... so ...

I decided to try adding the IPv4 configuration via /etc/rc.local after everything else was up and running. That does work, but like I said, it's ugly. Here is what had to be in /etc/rc.local
Code:
/sbin/ifconfig lagg0 inet ###.###.###.###/29
/sbin/route add default ###.###.###.###
/bin/sleep 1
/sbin/pfctl -F all -f /etc/pf.conf
Bottom line is, it is doable. But I really would like a cleaner way to do this all in /etc/rc.conf. I have about 2 weeks before I have to do this on the production server. If anyone comes up with a working configuration for this all in /etc/rc.local before then, I would honestly like to see it. Heck, I will order a pizza delivered to the address of your choice if you wish! ;)
 
Last edited:
Since I am not seeing any other answers posted, should I file a bug report for this? I don't want to do that if this is not a bug but simply my inability to find the correct solution for putting this all in /etc/rc.conf.
 
Use the ifconfig_<interface>_aliases setting to set the "inet ###.###.###.###/29" part, like this:

Code:
ifconfig_lagg0="laggproto failover laggport igb0 laggport igb1"
ifconfig_lagg0_aliases="inet ###.###.###.###/29"
 
kpa, FTW! Where do I send your pizza? Send me a PM with what you want on it.

Added: The name and phone of your preferred local pizza place would help too. :)
 
There are certain ifconfig commands that will reset an interface, and anything called on the same line after that is ignored. Things like laggproto, or CARP stuff, or MTU, and the like. In which case, you have to split the command up into multiple ifconfig calls.

The way to do that in rc.conf is via the ifconfig_*_aliasX entries as mentioned above. Each alias line becomes a separate ifconfig command called during the startup process. Do all the setup in separate lines, then put the IP into the last alias line. Works like a charm.
 
I seem to recall trying ifconfig_lagg0_alias0 at one point and it seemed to not work. Of course it is possible I entered it incorrectly or am misremembering.

I am thinking the handbook page should be updated to include a section on this. Do I submit a bug report for that or what?
 
There's a difference with ifconfig_lagg0_aliasX and ifconfig_lagg0_aliases. With the first one you have to keep track of the X numbers, the latter is preferred now because you can just put in a list of addresses separated with white space and not bother about getting the numbers right.

From rc.conf(5):

Code:
For each ifconfig_<interface>_alias<n>    entry with an address
         family    keyword, its contents are passed to ifconfig(8).  Exe-
         cution    stops at the first unsuccessful    access,    so if some-
         thing like this is present:

         ifconfig_ed0_alias0="inet 127.0.0.251 netmask 0xffffffff"
         ifconfig_ed0_alias1="inet 127.0.0.252 netmask 0xffffffff"
         ifconfig_ed0_alias2="inet 127.0.0.253 netmask 0xffffffff"
         ifconfig_ed0_alias4="inet 127.0.0.254 netmask 0xffffffff"

         Then note that    alias4 would not be added since    the search
         would stop with the missing ``alias3''    entry.    Because    of
         this difficult    to manage behavior, there is
         ifconfig_<interface>_aliases variable,    which has the same
         functionality as ifconfig_<interface>_alias<n>    and can    have
         all of    entries    in a variable like the following:

         ifconfig_ed0_aliases="\
             inet 127.0.0.251 netmask 0xffffffff \
             inet 127.0.0.252 netmask 0xffffffff \
             inet 127.0.0.253 netmask 0xffffffff \
             inet 127.0.0.254 netmask 0xffffffff"

         It also supports CIDR notation.
 
Again that shows only IPv4 addresses for the config. What if I needed to have several IPv4 and IPv6 addresses that are not contiguous? Does that cover both, or is IPv6 still "special" and requires its own stanza for multiple IPv6 addresses? I did read the rc.conf(5) manpage section on network_interfaces but only saw a brief mention of IPv6 addresses there. The ipv6_network_interfaces section of rc.conf(5) contains nothing helpful.

Ah, found this:
Code:
...
Aliases should be set by ifconfig_<interface>_alias<n> with
  ``inet6'' keyword.  For example:

  ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64"
  ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64".
...
That is back to the ifconfig_*_alias# format though.
 
Cheers,

What if you need to specify both IPv4 and IPv6?

The following code does not work:
Code:
ifconfig_vmx0="up"
ifconfig_vmx1="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport vmx0 laggport vmx1"

ifconfig_lagg0_aliases="\
        inet 10.2.1.18/24 \
        inet6 2801:19:a800:201::18/64"

ipv6_defaultrouter="2801:19:a800:201::1"
defaultrouter="10.2.1.1"


ifconfig lagg0

Code:
[...]
inet 10.2.1.18 netmask 0xffffff00 broadcast 10.2.1.255
[...]
The card does not show IPv6

What is the right way?

Thank you!
 
Back
Top