[arch-general] systemd network configuration

Tom Gundersen teg at jklm.no
Wed Jul 25 05:57:02 EDT 2012


On Jul 25, 2012 2:45 AM, "David Benfell" <benfell at parts-unknown.org> wrote:
> rc.d start network #successfully gets some address and a route
> for i in 74.207.225.79/32 74.207.227.150/32 173.230.137.73/32
> 173.230.137.76/32
> do
>         ip addr add "${i}" dev eth0
> done
> ip -6 addr add 2600:3c02::f03c:91ff:fe96:64e2/64 dev eth0
> for j in $(seq 0 1)
> do
>         for i in $(seq 0 9) a b c d e f
>         do
>                 ip -6 addr add "2600:3c02::02:70${j}${i}/64" dev eth0
>         done
> done
>
> Basically, with the IPv4 address, my intent is to make sure I've got
> all four of those addresses up. But I wasn't getting a route unless I
> used the network start script.
>
> In my copy of the Arch wiki, I"m not seeing how to do something
> similar under systemd. How, ideally, should I be doing this?

Systemd does not come with a network daemon. Either you could use one of
the regular ones (I use network manager on all my machines), or you could
tell systemd to ruin your script.

Let's assume you saved that snippet in /usr/local/bin/davids-network.sh

Then create a service file in /etc/systemd/system/davids-network.service

[unit]
description= David's Network Setup
Wants= network.target
Before= network.target

[service]
Type = oneshot
ExecStart=/usr/local/bin/davids-network.sh

[instal]
WantedBy= multi-user.target

Hth,

Tom

PS
Please double check the syntax carefully, I'm on my phone.


More information about the arch-general mailing list