Re: Systemd setting up two Microchip switch ports as individual network interfaces and then bonding them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok systemd experts.  I finally got my DSA driver bonding feature working like I want it ... now I'd just like to know the best way for systemd to set everything up.  This is on a custom board based off an i.MX8M Mini EVK.  I built the latest Yocto Dunfell release for the OS.

I know systemd has api support for some of this stuff but I haven't convinced myself I know how to take the manual steps above and put them in a systemd framework "the right way" based on the few web links I've seen about systemd doing this kind of thing.

I manually configure/test the system this way (I made a script that I have systemd service call as a first step hack.  I don't have systemd-netword enabled):

root@imx8mmevk:/etc/systemd/system# cat enable-redundancy-bond.service  
[Unit]
Description=Create redundancy bond

[Service]
ExecStart=/usr/local/bin/enable-redundant-bond.sh

[Install]
WantedBy=multi-user.target

root@imx8mmevk:/usr/local/bin# cat enable-redundant-bond.sh  
#!/bin/bash

# Create a redundant bond between ksz9567 DSA lan1 and lan2 interfaces (lan1 is on left - toward light tubes, lan2 is on right - toward BNC connectors

# Load bonding kernel module
modprobe bonding

# Bring up CPU interface (cpu to switch port 7 - the RGMII link)
ip link set eth0 up

# Create a bond
echo +bond0 > /sys/class/net/bonding_masters

# Set mode to active-backup (redundancy failover)
echo active-backup > /sys/class/net/bond0/bonding/mode

# Set time it takes (in ms) for slave to move when a link goes down
echo 1000 > /sys/class/net/bond0/bonding/miimon

# Add slaves to bond

echo +lan1 > /sys/class/net/bond0/bonding/slaves
echo +lan2 > /sys/class/net/bond0/bonding/slaves

# Set IP and netmask of the bond
ip addr add 192.168.0.4/24 dev bond0

# And bring bond up.  Pings and network connectivity should work now
ip link set bond0 up

At this point lan1 and lan2 from my switch act as individual network interfaces and are bonded ... if I unplug one the other takes over and I can see their status by:

root@imx8mmevk:~# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: lan1
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: lan1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 06:48:7f:9e:a8:1c
Slave queue ID: 0

Slave Interface: lan2
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 7a:d2:c1:ed:fe:a7
Slave queue ID: 0
root@imx8mmevk:~#


Thanks in advance for educating me.

Regards,

Brian

On Tue, Oct 13, 2020 at 8:56 AM Brian Hutchinson <b.hutchman@xxxxxxxxx> wrote:
Hi,

I have my device tree exposing two Microchip KSZ9567 switch ports.  I need to use them as individual NIC's.

I've tested the DSA driver as individual nics and they work fine.  I do this with:

ip addr add 192.168.0.4/24 dev lan1
ip addr add 192.168.2.4/24 dev lan2

ip link set eth0 up
ip link set lan1 up
ip link set lan2 up

... but I have no clue how to do this with /etc/systemd/network scripts

The above was just testing/verifying my device tree and DSA driver and a step toward real goal.  Once I get two of the switch ports (the only two the hardware brings out) to act as individual NIC's my next goal is to bond them for redundancy.

I really have no clue how to do that and have struggled to even uncover relevant information.  The closest thing I've found is:

A discussion of DSA issues
https://github.com/systemd/systemd/issues/7478

Bonding but doesn't look like my DSA case.
https://kerlilow.me/blog/setting-up-systemd-networkd-with-bonding/#setting-up-the-bond

I tried the above link and it looked like all I did was create a switch loop as the LED's on my switch went crazy when I connected both of my ethernet ports.

Anyone have experience with systemd and DSA and bonding?

Regards,

Brian
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux