[arch-general] systemd network configuration

David Benfell benfell at parts-unknown.org
Wed Jul 25 23:05:06 EDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

On 07/25/2012 01:52 PM, David Benfell wrote:
>>> On Wed, Jul 25, 2012 at 11:57:02AM +0200, Tom Gundersen wrote:
>>> 
>>>> 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
>>> 
> 
> Thanks! I will be testing this (and a few other things) just as
> soon as I work my courage up to try a reboot. I know you're
> supposed to test one thing at a time. This situation doesn't really
> allow that. :-/
> 
I can't get it to run. This is the current version of my network script:

#!/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

I have no evidence that it actually runs. If nothing else, I would
expect a pause, while it works its way through all those "sleep 1"
statements even if everything succeeds on the first try. And my
understanding is that none of my network daemons should try to start
until the network is up (but they do, and many fail). Here is the
service file:

[Unit]
Description=My utterly non-standard network setup
Before=network.target
Wants=network.target

[Service]
Type=oneshot
ExecStart=/etc/rc.local-network

[Install]
WantedBy=multi-user.target

I have tried placing it in both /etc/systemd/system and
/etc/systemd/multi-user.target.wants (the latter being where a bunch
of other service files wound up). But every time, when I boot the
system and log into the console and try "ip link show", it tells me
that eth0 is down.

- -- 
David Benfell
benfell at parts-unknown.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQELPiAAoJELT202JKF+xpQgUP/2hsWNO9nfyqZvtaqjsi58h8
rjUkuRAlz994w5PEJXPp9VzokDocvUM79IBz7pmLsXRFltx48wruqWzuTB86k3kR
ZUHNyqewfsV4RHh/ZWNtjzTfUhHDxEjKc+BT0PgMAjet+XkBiNgDdO3UAJpp/vcA
v1be+bfeNaQ/5IUGANpAa/bz+xHUyH5fL1DzO2hjguljvr/c/P/kLx0Wpcd2SVbP
ehMgnpnUqWf0aSus0tD+kKHWE4muDPt1Axe9XNxRnsgunSum251Kw7T+gbskoWAu
rdDzyVWWldJpyl0FvvZ9cKR4T+z5YbUWdBBaP0fEenZIY20mecRt40F1AdHGwVAg
ikZThJhofok2h8fCL3iCEkFDYoBwtTZARZgeQc55oprdnCcMQdLUHEvltBm2bApG
PnyDVg987HKt5Qu7EtLsU4rCx5JgsjDtTAJfQvogEfr8pPCFJqeo4PdGKvdAOCrC
3SkmoyHZYh9B2WRmUiSvyMCzUwpUF0ambqOk1vDbb/M+2iebqs33e19KRf7ZaYAr
Yq/OYLkUMiUx21oTu/HuxZSR/zVGJCFitvP9sxFCe9W0V7arIgvizooT0xyM2yhz
iIIrMVxkv+0rzRjkP5NWXmm1Qj1lOF0EgZX2+VZqrmCMoXc58CTKsmENKtG8x4nO
x9tPPgPMLOU7tvpk8/L3
=kLfg
-----END PGP SIGNATURE-----


More information about the arch-general mailing list