Re: systemd
On Thu, Jul 26, 2012 at 1:22 AM, Ralf Mardorf
<ralf.mardorf@alice-dsl.net> wrote:
>>
>> Believing what I read at Arch-general mailing list, configuring systemd
>> will be in some kind of irrational secret language.
>
> An example:
>
> -------- Forwarded Message --------
> From: [snip]
> Reply-to: General Discussion about Arch Linux
> Subject: Re: [arch-general] systemd network configuration
> Date: Wed, 25 Jul 2012 22:18:52 -0700
>
> [snip]
>
> [Unit]
> Description=[u] Static Interface [%I]
> StopWhenUnneeded=true
> Wants=network.target
> Before=network.target
> BindTo=sys-subsystem-net-devices-%i.device
> After=sys-subsystem-net-devices-%i.device
> After=basic.target
>
> [Service]
> Type=oneshot
> TimeoutSec=0
> Restart=always
> RestartSec=30
> RemainAfterExit=yes
> ExecStart=-/usr/sbin/ip addr add 10.50.250.1/24 dev %I
> ExecStart=/usr/sbin/ip link set %I up
>
> [Install]
> Alias=sys-subsystem-net-devices-lan0.device.wants/u.net.static at
> lan0.service
>
> I see that %I is supposed to stand for eth0; how do I connect this
> with eth0?
I've just looked at the arch-general archive. You missed out on the
description of the unit "My utterly non-standard network setup"...
This is the non-systemd version of his network script:
<begin>
#!/usr/bin/zsh
down=1
while [[ ${down} -ne 0 ]]
do
/usr/sbin/ip link eth0 up
down=${?}
sleep 1
done
/usr/sbin/ip link show
down=1
while [[ ${down} -ne 0 ]]
do
/usr/sbin/dhcpcd eth0
down=${?}
sleep 1
done
for i in 74.207.225.79/32 74.207.227.150/32 173.230.137.73/32
173.230.137.76/32
do
print "${i}"
down=1
while [[ ${down} -ne 0 ]]
do
/usr/sbin/ip addr add "${i}" dev eth0
down=${?}
sleep 1
done
done
print "2600:3c02::f03c:91ff:fe96:64e2/64"
down=1
while [[ ${down} -ne 0 ]]
do
/usr/sbin/ip -6 addr add 2600:3c02::f03c:91ff:fe96:64e2/64 dev eth0
down=${?}
sleep 1
done
for j in $(seq 0 1)
do
for i in $(seq 0 9) a b c d e f
do
print "2600:3c02::02:70${j}${i}/6"
down=1
while [[ ${down} -ne 0 ]]
do
/usr/sbin/ip -6 addr add "2600:3c02::02:70${j}${i}/64" dev eth0
down=${?}
sleep 1
done
done
done
/usr/sbin/ip address show
#for i in 74.207.225.1 74.207.227.1 173.230.137.1
#do
#/usr/sbin/ip route add "${i}/24" via "${i}"
#done
/usr/sbin/ip route add default via 173.230.137.1
/usr/sbin/ip -6 route add ::/0 via fe80::1
/usr/sbin/ip route show
</end>
Most users of a distribution don't have to write init scripts or systemd units.
The "%i" is used because you can have a "<name>@.service" unit and
create a symlink to it with "<name>@ethX.service" and "%i" will be
replaced by "ethX". I don't see the point in this particular case -
unless the goal's to allow you to re-assign those ip settings to a
different nic simply by renaming one file.
Reply to:
- References:
- systemd
- From: "Ralf Mardorf" <ralf.mardorf@alice-dsl.net>
- Re: systemd
- From: Andrei POPESCU <andreimpopescu@gmail.com>
- Re: systemd
- From: Roger Leigh <rleigh@codelibre.net>
- Re: systemd
- From: Ralf Mardorf <ralf.mardorf@alice-dsl.net>
- Re: systemd
- From: Ralf Mardorf <ralf.mardorf@alice-dsl.net>