Ticket #105 (closed enhancement: fixed)
Opened 2 years ago
Last modified 2 years ago
make bonding functionality prefer using sysfs over ifenslave
Reported by: | Wolfram Schlich <wschlich@gentoo.org> | Owned by: | roy |
---|---|---|---|
Priority: | trivial | Milestone: | |
Component: | rc | Version: | |
Keywords: | Cc: |
Description
See /usr/src/linux/Documentation/networking/bonding.txt,
"3.4 Configuring Bonding Manually via Sysfs"
Affected OpenRC files: /lib/rc/net/bonding.sh
Details: When using a monolithic kernel (bonding not as a module),
one needs to use sysfs for configuring the mode and other things
anyway (if one does not want to supply bonding.foo=bar on the
kernel command line).
Attachments
Change History
Changed 2 years ago by roy
- attachment bonding-sysfs.sh added
comment:507 Changed 2 years ago by roy
Created an attachment (id=55)
Use sysfs if available
This should work .... but I get this error
echo +re0 >/sys/class/net/foo1/bonding/slaves
-su: echo: write error: Operation not permitted
So I've not comitted the patch.
After I use ifenslave, I can use the echo trick to add and remove interfaces at will, so it's doing something extra that isn't documented. Any insight?
comment:508 Changed 2 years ago by Wolfram Schlich <wschlich@gentoo.org>
Don't you need to create the bond first?!
--8<--
Creating and Destroying Bonds
To add a new bond foo:
# echo +foo > /sys/class/net/bonding_masters
To remove an existing bond bar:
# echo -bar > /sys/class/net/bonding_masters
To show all existing bonds:
# cat /sys/class/net/bonding_masters
--8<--
Looks like you need to do it like this:
--8<--
echo +bond0 > /sys/class/net/bonding_masters
ip link set bond0 up
echo +eth0 > /sys/class/net/bond0/bonding/slaves
echo +eth1 > /sys/class/net/bond0/bonding/slaves
--8<--
comment:509 Changed 2 years ago by roy
uberpc ~ # echo +foo2 > /sys/class/net/bonding_masters
uberpc ~ # ip link set foo2 up
uberpc ~ # echo +re1 >/sys/class/net/foo2/bonding/slaves
-su: echo: write error: Operation not permitted
comment:510 Changed 2 years ago by Wolfram Schlich <wschlich@gentoo.org>
Ah! I was able to add an interface to [...]/slaves that was _not yet up_ :)
That's it...
comment:511 Changed 2 years ago by roy
- Status changed from new to resolved
- Resolution set to fixed
(In reply to comment #4)
Ah! I was able to add an interface to [...]/slaves that was _not yet up_ :)
That's it...
Odd, I seem to recall having to down the interface ... anyway, fixed - thanks.
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commitdiff;h=c7066a5c935259d2f13575fd9f795dcfd9f8e214
comment:512 Changed 2 years ago by Wolfram Schlich <wschlich@gentoo.org>
- Status changed from resolved to reopened
- Resolution fixed deleted
<wschlich> what about the other sysfs attributes for bonding?
<wschlich> would be nice if they were configurable via openrc as well :)
<wschlich> see "2. Bonding Driver Options" of /usr/src/linux/Documentation/networking/bonding.txt
<UberLord?> re-open that bug then :)
Thanks :o)
comment:513 Changed 2 years ago by roy
- Status changed from reopened to resolved
- Resolution set to fixed
Use sysfs if available