LAGG specify interfaces in different order?

tackyone

Dabbler
Joined
Jun 8, 2020
Messages
19
Hi,

Been using FreeNAS a little while now - and I need to setup a 'lagg' interface. I can do this - but because of the way the UI works - when selecting interfaces to add to lagg0 - I can only select them in numeric order, e.g. 'ix0, ix5'

I need to specify these in the 'other order' - i.e. 'ix5, ix0'* - but the UI won't let me do this? - If this isn't supported in the UI - is there any way it can be done without UI support?

I thought the text box with 'ix5, ix0' might be editable once they were "picked" - but sadly it isn't :(

Thanks,

-Tacks

* The first interface specified is the 'Master' for the lagg - I need ix5 to be the master, not ix0.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
You should be able to use the console menu to select the LAGG members in the order desired.
 

tackyone

Dabbler
Joined
Jun 8, 2020
Messages
19
You should be able to use the console menu to select the LAGG members in the order desired.

Indeed - it does, thanks! - I'd kind of forgotten the console part of FreeNAS was there - having spent so much time in the GUI / Web side of it.

Cheers,

-Tacks
 

tackyone

Dabbler
Joined
Jun 8, 2020
Messages
19
You should be able to use the console menu to select the LAGG members in the order desired.

Hi,

Looks like I may have spoken too early. Although the console will let you select the interfaces in non-numeric order (i.e. ix5 then ix0) - it appears that once the lagg is created, when the system actually does the equivalent of 'ifconfig lagg0 ...' - it's re-ordering the interfaces into numeric order again.

Whether I use the Web UI or the console (where I select ix5 first, then ix0 second) - my lagg interface still ends up as:

Code:
    laggproto failover lagghash l2,l3,l4
    laggport: ix0 flags=5<MASTER,ACTIVE>
    laggport: ix5 flags=0<>


So ix0 is still being picked as the master (as I suspect it was declared 'first' on the ifconfig line as such) - and I need ix5 to be declared first (i.e. to be the preferred master) :(

-Tacks
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
I suspect this will need some SQL-fu with the FreeNAS database to find the interface definition, and to switch the order of the laggports there.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
This is an ugly hack, but try removing the LAGG interface in the GUI, and then building it by hand in a post-init task with the laggports in the order you need.
 

tackyone

Dabbler
Joined
Jun 8, 2020
Messages
19
This is an ugly hack, but try removing the LAGG interface in the GUI, and then building it by hand in a post-init task with the laggports in the order you need.

Hmmm, I've found the definition in the database - and it does have an order field, and it is selected with an 'order' clause based on that field - but the interface is still coming up as if it was created with ix0 then ix5, not ix5 then ix0.

I've found all of this is 'driven' by '/etc/ix.rc.d/ix-netif' - but I can't see if there's either somewhere it logs the resultant 'ifconfig' before / when it runs it - or if there's any way of getting it logged somewhere.

I'll keep digging - thanks...
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
If it's logged anywhere, it'll be in /var/log/middlewared.log.
 

MikeyG

Patron
Joined
Dec 8, 2017
Messages
442

tackyone

Dabbler
Joined
Jun 8, 2020
Messages
19
This looks like it might be a FreeBSD issue now - having pulled apart enough of the config processing - I can see FreeNAS is apparently running:

Code:
ifconfig lagg0 inet 10.12.30.210/24  laggproto failover laggport ix0 laggport ix5


Is run by FreeNAS - which results in:

Code:
lagg0: flags= ...
    laggport: ix0 flags=5<MASTER,ACTIVE>
    laggport: ix5 flags=0<>


But by flipping the order in the database (or by using the FreeNAS console to set this) I can also see that if it runs:

Code:
ifconfig lagg0 inet 10.12.30.210/24  laggproto failover laggport ix5 laggport ix0


I still end up with:

Code:
lagg0: flags=
    laggport: ix0 flags=5<MASTER,ACTIVE>
    laggport: ix5 flags=0<>


Which is just the same :(

If I find anything interesting I'll post a reply - but obviously some more research is in order. I'm sure we've used lagg partners before, where a higher interface number was 'master' with a lower as backup.

-Tacks
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
What happens if you set metric options in ix0 and ix5, so that ix5 has a lower metric than ix0? The metric defaults to 0; setting metric 99 on ix0 may accomplish what you want.
 

tackyone

Dabbler
Joined
Jun 8, 2020
Messages
19
What happens if you set metric options in ix0 and ix5, so that ix5 has a lower metric than ix0? The metric defaults to 0; setting metric 99 on ix0 may accomplish what you want.

Sadly metrics are for routing / layer3 only - i.e. they have no affect on lagg interfaces.

I have tracked this further down - it looks like FreeNAS is not calling out to ifconfig to build the lagg interface (and I suspect any network interfaces) - if manually build the lagg from a shell using ifconfig - it does what you expect (first declared interface is master).

If FreeNAS builds the lagg - it always orders it lowest interface number first - without involving ifconfig (even if you use the console utility to create a lagg with interfaces in a different order). I think this is more than likely tied to the changes someone else linked to re. HA on TrueNAS - and FreeNAS losing the ability to specify a master interface for lagg.

I guess I'll keep an eye on that thread / ticket and see if anything comes of it. For the moment I'll either script it's construction manually - or worst case leave the port of the NIC we don't want to use 'Disabled' (as enabling it can be done remotely).

It's been an interesting 'tour' of FreeNAS under the hood.

-Tacks
 
Top