[systemd-devel] Persistent address on "Lost carrier"

Mantas Mikul─Śnas grawity at gmail.com
Thu Jun 15 09:37:50 UTC 2017


On Thu, Jun 15, 2017 at 11:21 AM, Lennart Poettering <lennart at poettering.net
> wrote:

> On Tue, 13.06.17 21:44, Amish (anon.amish at gmail.com) wrote:
>
> > Hello,
> >
> > I have the following in /etc/systemd/network/25-eth0.network
> >
> > [Match]
> > MACAddress=00:11:22:33:44:55
> >
> > [Network]
> > Address=192.168.1.32/24
> > Gateway=192.168.1.1
> >
> > Now I have few "dynamic" routes where destination IP keeps changing.
> >
> > Example:
> > /usr/bin/ip route add to 1.2.3.4 via 192.168.1.2 (Different gateway)
> >
> > Many more routes are added by one script which keeps adding / deleting
> > routes based on certain algorithms.
> >
> > Since destination IP keeps changing, I can not put it in [Route] section.
> >
> > Now my problem is, if for any reason the interface loses carrier (cable
> > fault / switch / router reboot), the IP associated with it is removed and
> > hence all the routes added by script gets lost.
> >
> > My question is how to stop this?
> >
> > How do I tell systemd to not to delete IP address on "Lost carrier"?
> >
> > I tried with:
> >
> > BindCarrier=lo
> > OR
> > BindCarrier=eth0
> > OR
> > BindCarrier=lo eth0
> >
> > But none worked.
> >
> > Any idea / suggestions? Something similar to - CriticalConnection for
> DHCP?
> >
> > Or may be we can have Persistent=true in "[Network]" OR "[Address]"
> section?
>
> This is really not how networkd is supposed to be used. Either it
> manages an interface in its entirety or not at all. It's not designed
> to manage an interface only "half-way", i.e. manage addresses but not
> the routes.
>

Hmm, that wasn't the actual question though, was it? The point was just to
make networkd ignore carrier status (i.e. often there's no need to remove
addresses just because the interface is down for a moment), not to stop
managing halfway.

-- 
Mantas Mikul─Śnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170615/eace0cf0/attachment.html>


More information about the systemd-devel mailing list