Hi Brian,

On 11/18/21 01:20, Brian Hutchinson wrote:
 > Yet another update, I was able to get it working .. but feel like it is
 > a hack so comments welcome ... see below:
 >

<snip>

 >
 > I tried and tried to get eth0 to come up before the bond was brought
 > up.  I had everything named in lexical order but didn't appear to
 > matter.  I added a eth0.network file and in it specified
 > |ActivationPolicy=|always-up and other things but could not get eth0 to
 > come up.

What kernel version are you using? Since Linux 5.11 we have the 
following two changes ([1] and [2]) which should automatically bring 
up/down the master (eth0) whenever user ports (lan1, lan2) are brought 
up/down. Please confirm whether or not you are using 5.11 or later.

If you are using an older kernel, and systemd is version 243 or later, 
you can use the BindCarrier= setting (see [1]) in the [Network] section 
of your .network file(s) for lan1 and lan2. Something like this:

        [Match]
        Name=lan*

        [Network]
        BindCarrier=eth0

See also [3].

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9d5ef190e5615a7b63af89f88c4106a5bc127974
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c0a8a9c274936543e436aef691499304ce3127dc
[3] 
https://www.freedesktop.org/software/systemd/man/systemd.network.html#BindCarrier=
[4] https://github.com/systemd/systemd/issues/7478#issuecomment-514562190

If both your kernel and systemd are old, I think you'll have to use 
something like your hack.

One more thing:

 > [Service]
 > ExecStart=/usr/local/bin/eth0-up.sh
 > RemainAfterExit=yes
 >
 > [Install]
 > WantedBy=multi-user.target
 >
 > cat /usr/local/bin/eth0-up.sh
 > #!/bin/bash
 > ip link set eth0 up

You don't need a separate shell script, you can just invoke the ip 
command directly:

[Service]
ExecStart=/usr/bin/ip link set eth0 up
...


Kind regards,

        Alvin

Reply via email to