[systemd-devel] systemd.network and IPv6 addrlabel

Richard Maw richard.maw at codethink.co.uk
Tue Apr 14 07:24:07 PDT 2015


On Mon, Apr 13, 2015 at 04:03:34PM +0200, Christian Brunotte wrote:
> Hello
> 
> I'm playing around with systemd's network configuration and try to convert the
> following Debian configuration.
> 
>  iface eth1 inet6 auto
>      # Static IP and random dynamic IPs for external targets
>      autoconf 1
>      use_tempaddr 2
>      privext 1
>      # My static IP
>      up ip addr add 2001:1111:0:222:33::/64 dev eth1
>      # Label 1 is predefined as ::/0
>      # Label 666 is for my static IP and networks I want to use it with
>      up ip addrlabel add prefix 2001:1111:0:222:33::/128 label 666    
>      up ip addrlabel add prefix 2001:1111::/32           label 666
> 
> Can I do this with systemd.network? Is there some kind of hoook to
> start shell scripts like the up/pre-up/down/post-down hooks in the
> Debian configuration?

The subject of hooks has come up before, the result being that Lennart is
against the idea of hooks because they involve elements lower in the stack
calling up to elements higher in the stack, and that the appropriate thing to
do is for some service to monitor the state lower in the stack for the
condition before running the commands.

You might be able to replicate the behaviour by adding something like the
following; I haven't tested it myself, but systemd-networkd-wait-online
--interface=eth1 sounds promising.

    [Unit]
    Description=Post-up configuration for eth1
    After=network.target
    # If you want to block network-online.target until configuration has finished
    # then add Before=network-online.target
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/lib/systemd/systemd-networkd-wait-online --interface eth1
    ExecStart=/usr/bin/ip addr add 2001:1111:0:222:33::/64 dev eth1
    ExecStart=/usr/bin/ip addrlabel add prefix 2001:1111:0:222:33::/128 label 666
    ExecStart=/usr/bin/ip addrlabel add prefix 2001:1111::/32           label 666
    # Do `down` configuration with an ExecStop=

I don't understand enough of your configuration to suggest whether there might
be a way to do it natively with networkd.


More information about the systemd-devel mailing list