Re: [arch-general] systemd network configuration

2012-07-27 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/26/2012 09:19 AM, C Anthony Risinger wrote:

(that it worked for him. Does anyone know how to fix Thunderbird's
quoting so that it actually quotes?)

Okay, so this will be a real shocker. I was wrong. It works for me as
well. Unsurprisingly, I have encountered other difficulties, but these
are potentially topics for new threads.

It looks to me like C Anthony's approach is a correct approach for
network setups that don't fit into the standard netcfg/network paradigm.

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

iQIcBAEBAgAGBQJQEvwuAAoJELT202JKF+xpw+sP/3i/wu5Oh0JD8LkdLE/EgNn0
prjCNDg1GuncQxVcr7pYOwpTUw6XkNdyIxmIxgNt0XlbYb+gdjdHlaTxvuT7Trok
AX7pLZh+4++/4y7YB6Al9ZRaGSv0ZdKkJzT/bkg1aJc3tutylaP7CwYdxL9Pjl/L
UYLgMGrTEV47HdKGVYw43lnurx7fM1IOcv8ARevV+xYMGvNtNthteDHdXX+peekb
Rpc7+5wYlBvCb/BUWSN1Ip2Cp1gTg+fjGL1bbQNXx/EJbaqVKB+QmxG1PReLp3o9
kmwkqv52pvoQhhCdZSyiFgtzPmcv4Vnk6OfIH1oNmCPfe6JLdK1lmRXi2TInu+Is
CAcfXI+FbyMRXokPRwLaDieC4oUVghOCQScAYVeVpyz5Er1zlbMd5mgNG4ZIpy24
ZFb9BGurCSym/Xa6BPtq7hDuVg9KeucGqJZimLT8UEYboSvq/z5LrrGzKTTF/SoO
qItlzf/Dd671y5dCXxhXTYyQWa83FEtzZCnuqUlxqVVu5v7Y2tXnIkqeObm9LnR9
4znZPk6IeewbqKAg8/sFsg1O+hEP2B/bbgjteGuqIuHzadohqDQPRBzToQobcrpR
iYVPzpcofP4cXhfsIvMiKMmbkM/cAO3d5HsEfE/5e66u6IEpWVHMXC0KqZCtQjlS
liPhVyl6DZaMvyKdPUbC
=LZt2
-END PGP SIGNATURE-


Re: [arch-general] systemd network configuration

2012-07-26 Thread Guillaume Brunerie
2012/7/26 David Benfell benf...@parts-unknown.org

 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

 […]


It’s /bin/zsh.


Re: [arch-general] systemd network configuration

2012-07-26 Thread Tom Gundersen
On Thu, Jul 26, 2012 at 5:05 AM, David Benfell
benf...@parts-unknown.org wrote:
 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.

The standard thing is to place it in /etc/systemd/system. However,
this will not start it on next boot. For that you should systemctl
enable nonstandard-network.service (which will create a symlink in
multi-user.target.wants). To test it, you can do systemctl start
nonstandard-network.service. To see get some info about what happened
do (as root) systemctl status nonstandard-network.service. Notice
that anything your service prints to standard out or syslog ends up in
the journal, and the last bits of it is shown by systemctl status (for
more do journalctl).

Cheers,

Tom


Re: [arch-general] systemd network configuration

2012-07-26 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/25/2012 10:58 PM, C Anthony Risinger wrote:

 
 i modified it for you here: http://dpaste.com/775539/plain/
 
Thanks! This approach seems to be fruitful, and of the network
daemons, only tor and freshclam are coming up without the network
successfully starting (I wouldn't have changed these service files;
are they okay?) but I'm having trouble.

This yields:

[root@atlanta system]# systemctl daemon-reload

[root@atlanta system]# systemctl start net.static\@eth0.service

 Starting [u] Static Interface [eth0]...

[FAILED] Failed to start [u] Static Interface [eth0].

 See 'systemctl status net.static@eth0.service' for details.

Job failed. See system journal and 'systemctl status' for details.

[root@atlanta system]# systemctl status net.static\@eth0.service

net.static@eth0.service - [u] Static Interface [eth0]

  Loaded: loaded (/etc/systemd/system/net.static@eth0.service;
enabled)
  Active: activating (auto-restart) (Result: exit-code) since
Thu, 26 Jul 2012 07:00:59 -070
0; 47s ago

Main PID: 913 (code=exited, status=2)
  CGroup: name=systemd:/system/net.static@.service/eth0

[root@atlanta system]#

- From what I can see, it's getting an exit code even though the link is
coming up, addresses are being added, and routes created.

I noticed that you had the link up command placed after the address
add command and, assuming that the commands are executed in order from
top to bottom, reversed that order. So I now have:

[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 link set eth0 up
ExecStart=-/usr/sbin/ip addr add 74.207.225.79/32 dev eth0
ExecStart=-/usr/sbin/ip addr add 74.207.227.150/32 dev eth0
ExecStart=-/usr/sbin/ip addr add 173.230.137.73/32 dev eth0
ExecStart=-/usr/sbin/ip addr add 173.230.137.76/32 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::f03c:91ff:fe96:64e2/64
dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7000/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7001/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7002/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7003/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7004/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7005/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7006/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7007/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7008/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7009/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:700a/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:700b/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:700c/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:700d/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:700e/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:700f/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7010/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7011/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7012/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7013/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7014/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7015/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7016/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7017/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7018/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:7019/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:701a/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:701b/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:701c/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:701d/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:701e/64 dev eth0
ExecStart=-/usr/sbin/ip -6 addr add 2600:3c02::02:701f/64 dev eth0
ExecStart=-/usr/sbin/ip route add default via 173.230.137.1
ExecStart=-/usr/sbin/ip -6 route add ::/0 via fe80::1
ExecStop=-/usr/sbin/ip link eth0 down

[Install]
Alias=sys-subsystem-net-devices-eth0.device.wants/net.static@eth0.service

Even with all those dashes in front of every command, it exits with a
code and is plainly unhappy. Which I find mystifying.

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

iQIcBAEBAgAGBQJQEVCCAAoJELT202JKF+xpUPUP/RBMnzHpdhWwjQxL9mmNBMbj

Re: [arch-general] systemd network configuration

2012-07-26 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/25/2012 11:34 PM, Guillaume Brunerie wrote:
 
 It’s /bin/zsh.
 
Oh, this is an artifact from the fact I have so many scripts I copied
over from whatever Debian-variant distribution I was using before. I
have it sym-linked.

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

iQIcBAEBAgAGBQJQEVDvAAoJELT202JKF+xpoO4P/3kWDz7qxZEwGDmdWU+2P6C3
rvH8TyCcgis9axF9OxwJvGX/xWs/jIc9ZdBtUwD7IRmEJzMVd2/xz7szHh8nTO9p
fm3vLXRJjVX/xXAvLYy/PEI51+LHCrMmB3CYK0Th4lvIBjNYOJw5KChY8gr/JaBZ
lPcUU0/FePbxilVGSWLBu8sWjmBDy9/4MRhFMsgj0RMDhXqfd/rwKIQM3bgLwwCR
X1Vzz6UwVaNwC9esXtx3bieaY4mtYlBC9NRrRfe3Mn5ds0/Toof9Fu47if+3VCPZ
3NZEqIYGW3a1dQNwafxXcnlbX5uzvC1Py4vryMrHBq0/uzmztXCrs9xytKqNs6C/
eRg9MtwBHanBSru4YTsQ877FXqoSPRO0e5kxT/XauGoNTOc2ZASDrKu4Kr3tb1be
HVjrJXGYG2nrPDrxQ60oNF0NQo+OwdsAskxlaj532S6OsYZZ+lyaJ2k7sMxr+GOs
wrUOHhCAA33NdeZ1eV8S6jWO6le2/C3lkoWDis+vG63d2q+NkKZtW2AWFPpLLevG
RgZ3jcI55ePFfUGwF6zg/BOquJ/gSTK6Djm0NCX2aJEh4dMETtddmTWf5X616jeN
eVJlnLBg0+cxqCSSLZ6J0fT9NqfIHi0RrgA49Cl7NlGmZ+Z7eRbYHTSqSLp7O27T
2vxk7UGJPt6Q20iCN0iQ
=9dBp
-END PGP SIGNATURE-


Re: [arch-general] systemd network configuration

2012-07-26 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/26/2012 03:36 AM, Tom Gundersen wrote:
 
 The standard thing is to place it in /etc/systemd/system. However, 
 this will not start it on next boot. For that you should
 systemctl enable nonstandard-network.service (which will create a
 symlink in multi-user.target.wants). To test it, you can do
 systemctl start nonstandard-network.service. To see get some info
 about what happened do (as root) systemctl status
 nonstandard-network.service. Notice that anything your service
 prints to standard out or syslog ends up in the journal, and the
 last bits of it is shown by systemctl status (for more do
 journalctl).
 
That's excellent, and I'm creating /var/log/journal/

I had missed the part about how even after creating the service file
in /etc/systemd/system, it still needs to be implemented with the
systemctl enable. If the wiki is clear on this, I missed it.

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

iQIcBAEBAgAGBQJQEVLrAAoJELT202JKF+xpxWkP/AqnPmWhtPUqvwZyE1oOAzg+
zEDX/SWT1qh4VgeBXfqs7COmF+WKLDV7yK25kbEjogCv/ah6qZ4MEk3s6eErLq+S
/9z0++njmZ5TkQOjfwfAG3nx6Qq6UREMB1TRsXm3jwCd14WS9kxrZ3nB04zvQZ5/
BDMfi2AxGT+nbHmdG1lohZ8lim4fgn37BVtgA5RHxZbxjAckBgfHU36HU7/rsCXW
WN+nk3To3/MHLeS7yZfIiTYsI667QT30mRJfAkZm4MEoRkkjlIWyLOyfihXO0YKB
lqazcdsXWWg/P8lWzxlVrO6Dby6zxYEzwaYQ0CUdSji0g4KRqBw/VacUIfASo51D
2iGHI62OFFlxfADm3yir9HqzcG2s5eSxezG7VduDODGyUxbd8lpGKgM3nSH2T4K1
nxyjQtuugFMbGsZuuJ8hgTR5manpY4EgUCf0Rk3MIHdj2ll31TcugyMoCdw1+lcy
SlWt8jCVHc0YQu/hhk4eXtuxWcyqEBerRwSzzNhg/ep2o2yNlRJXazSdie0xoeSl
wN4WDiKm3LRc5p02tY72X9hFeWgCSzHnFybXErX0Qe3F9IYgJ7f3PyxxVBrg8qo5
VZ2/18R4E8zHoga6KAnhUDuRC7ik8lnGThNetgKPrV3h3J8uU/0/dhzkVgv0TfIt
T9lEO9sOtrzWcsZjCDUr
=E3jQ
-END PGP SIGNATURE-


Re: [arch-general] systemd network configuration

2012-07-26 Thread C Anthony Risinger
On Thu, Jul 26, 2012 at 9:13 AM, David Benfell
benf...@parts-unknown.org wrote:

 Even with all those dashes in front of every command, it exits with a
 code and is plainly unhappy. Which I find mystifying.

hmm, i'm not 100% sure either -- my guess is because the `add`
commands are in fact failing (addr already added) and the very last
command also fails.  this is one reason i had the `link up` command at
the end -- it always succeeds.

what's wrong with delaying `link up` until the end?

otherwise you'll want to remove the `Restart` stuff, because it's
unnecessarily rerunning the commands every 30 seconds (the restart
logic only work correctly if the command-chain returns success)

-- 

C Anthony


Re: [arch-general] systemd network configuration

2012-07-26 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/26/2012 07:49 AM, C Anthony Risinger wrote:
 On Thu, Jul 26, 2012 at 9:13 AM, David Benfell 
 benf...@parts-unknown.org wrote:
 
 Even with all those dashes in front of every command, it exits
 with a code and is plainly unhappy. Which I find mystifying.
 
 hmm, i'm not 100% sure either -- my guess is because the `add` 
 commands are in fact failing (addr already added) and the very
 last command also fails.  this is one reason i had the `link up`
 command at the end -- it always succeeds.
 
 what's wrong with delaying `link up` until the end?

My understanding (/assumption/misconception?) was that one had to have
an interface before one could add addresses to it.
 
 otherwise you'll want to remove the `Restart` stuff, because it's 
 unnecessarily rerunning the commands every 30 seconds (the restart 
 logic only work correctly if the command-chain returns success)
 
I will give this another try later. My cell phone isn't getting along
with its SIM card and I'm very shortly off to deal with *that*.

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

iQIcBAEBAgAGBQJQEVq2AAoJELT202JKF+xpdZQP/jId4/dA7Q8B2ByG3YCTtAcI
FPHW4CykLQGTgOTFO9/GGZHIO1mUczEi28T28GTeGFSlyq5rH0RKWqX+4hPqWXb/
ERgJcBYDdXothacBhTNTJIypE3L36CdJdYsQ0e51xhk2gaUo8W1uuvuTzSy/bfJy
M8bBOOsjeIUfU+puWNPy2wcX0CXzQ1U6nqSu/7tekmM4bP+NhX5Kdquv6MEg6YTF
joiIlr1ZpMYYcwgLdFFNfwHHKIriNM3komb/jwm+tgSyaB0riI4DTrqT7xkT3ImM
d0PQ0dOBNCoJYT8+nKdo35YvKoXCSbPkKgxLBO87VhFK5kXEP53wym9hytpy3jFt
PnBpAcp+8rVe/TD59Yq+Vcb+sR7jG0QosYQaaymommoADvAYCDkUJatqUYbo+n+j
0zY6p0F/1qvS/gIK70Rn8HqXhefP1Yn7jnZqnynP1Uhtr71azaIvHAAuqogjUygy
HhUyQ+dOWmxj8sXVYxUZ3Zh1l9UC5vYZOpt1piDIokpPO6IgoMugl+WIs8TEcHQK
dWOehcUwGdDy+fGExHJhzVR5RHcdgypX6GeBJZ6wwAreiskUoOAp4qZz4qSlrEMD
kbg/Pbew+lxPsHUm39HmiaWO1d0lNk2O2XyBqcBwh4dS1gVVEsdXW1R2FT0tQ8jR
gAtM2aosuVxUJxbWJQSw
=KSGN
-END PGP SIGNATURE-


Re: [arch-general] systemd network configuration

2012-07-26 Thread C Anthony Risinger
On Thu, Jul 26, 2012 at 9:56 AM, David Benfell
benf...@parts-unknown.org wrote:

 last command also fails.  this is one reason i had the `link up`
 command at the end -- it always succeeds.

 what's wrong with delaying `link up` until the end?

 My understanding (/assumption/misconception?) was that one had to have
 an interface before one could add addresses to it.

Works For Me (tm :-)

`link up` is just enabling the interface, nothing more.  if you `link
down` a running connection, you will loose netowrk [obviously], but
it's not going to wipe out the assigned addresses:

==
# ip link add bridge0 type bridge
# ip addr add 74.207.225.79/32 dev bridge0
# ip addr add 74.207.227.150/32 dev bridge0
# ip -6 addr add 2600:3c02::02:7000/64 dev bridge0
# ip -6 addr add 2600:3c02::02:7001/64 dev bridge0
# ip addr show dev bridge0
31: bridge0: BROADCAST,MULTICAST mtu 1500 qdisc noop state DOWN
link/ether de:b7:12:57:2d:b9 brd ff:ff:ff:ff:ff:ff
inet 74.207.225.79/32 scope global bridge0
inet 74.207.227.150/32 scope global bridge0
inet6 2600:3c02::2:7001/64 scope global tentative
   valid_lft forever preferred_lft forever
inet6 2600:3c02::2:7000/64 scope global tentative
   valid_lft forever preferred_lft forever
# ip link set bridge0 up
# ip addr show dev bridge0
31: bridge0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc noqueue
state UNKNOWN
link/ether de:b7:12:57:2d:b9 brd ff:ff:ff:ff:ff:ff
inet 74.207.225.79/32 scope global bridge0
inet 74.207.227.150/32 scope global bridge0
inet6 2600:3c02::2:7001/64 scope global tentative
   valid_lft forever preferred_lft forever
inet6 2600:3c02::2:7000/64 scope global tentative
   valid_lft forever preferred_lft forever
inet6 fe80::dcb7:12ff:fe57:2db9/64 scope link tentative
   valid_lft forever preferred_lft forever
# ip link set bridge0 down
# ip addr show dev bridge0
31: bridge0: BROADCAST,MULTICAST mtu 1500 qdisc noqueue state DOWN
link/ether de:b7:12:57:2d:b9 brd ff:ff:ff:ff:ff:ff
inet 74.207.225.79/32 scope global bridge0
inet 74.207.227.150/32 scope global bridge0
# ip link set bridge0 up
# ip addr show dev bridge0
31: bridge0: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc noqueue
state UNKNOWN
link/ether de:b7:12:57:2d:b9 brd ff:ff:ff:ff:ff:ff
inet 74.207.225.79/32 scope global bridge0
inet 74.207.227.150/32 scope global bridge0
inet6 fe80::dcb7:12ff:fe57:2db9/64 scope link tentative
   valid_lft forever preferred_lft forever
# ip link delete bridge0
# ip addr show dev bridge0
Device bridge0 does not exist.
==

... well, aparantly it does wipe out ip6 addys for some reason if you
up+down+up ... but not ipv4? either thats a bug, or i don't know
enough about ipv6.

-- 

C Anthony


Re: [arch-general] systemd network configuration

2012-07-25 Thread C Anthony Risinger
On Tue, Jul 24, 2012 at 7:44 PM, David Benfell
benf...@parts-unknown.org wrote:

 Hi,

 Because it's summer, and I'd really rather not try to figure all this
 out during the school year, I'm trying to figure out systemd *now*,
 rather than waiting until rc.conf goes away.

 I actually had trouble with rc.conf when I first installed Arch on my
 Linode. Some daemons mysteriously wouldn't start and I couldn't figure
 out how to get the networking to come up properly. (And, of course, I
 was in a hurry.) So I wound up hacking rc.local to bring up both the
 network and the daemons. (Yes, I know: ew!)

 This is the shell snippet I'm using to bring up my network now:

 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, Im not seeing how to do something
 similar under systemd. How, ideally, should I be doing this?

 Thanks!

hi David,

i've been prototyping the idea of a complete network management
solution driven purely by unit files (or a generator) ... i don't have
a general solution, but i use the following to handle a common case --
perform DHCP on an interface when it is available, and tear it down
when it's not (disregard the `u.` [user] prefixes, i use them to
guarantee no-conflicts with upstream units):

# cat 
/etc/systemd/system/sys-subsystem-net-devices-wan0.device.wants/u.net.dhcp@wan0.service
=
# network interfaces bindings

[Unit]
Description=[u] DHCP 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=simple
TimeoutSec=0
Restart=always
RestartSec=30
ExecStart=/usr/sbin/dhcpcd -C resolv.conf --nobackground --timeout 30 %I

[Install]
Alias=sys-subsystem-net-devices-wan0.device.wants/u.net.dhcp@wan0.service
=

... notice the use of `BindTo` and how it's triggered by the presence
of the actual device.  this is a `simple` service because it has an
actual process associated with it ... i also use a similar `oneshot`
unit for static devices that is closer to what you need:

# cat 
/etc/systemd/system/sys-subsystem-net-devices-lan0.device.wants/u.net.static@lan0.service
=
# network interfaces bindings

[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@lan0.service
=

... take particular notice of multiple `ExecStart` directives --
`oneshot` type units allow for several commands to be executed
sequentially, and the unit fails if any command fails (use
`ExecStart=-[...]` to ignore the return code of one command, note the
dash). you could use this last unit as a base, then add all of your
commands to it, one after the other.  note how i ignore the result of
the `ip addr add` because the address might already exists (couldn't
find a cleaner way to handle this).

that said, i'm not sure systemd is really intended to handle these
things directly, but in simple cases it seems to work pretty good --
i've used the DHCP unit file on 3 physical servers and 5 virtual
machines for about 18 months now, without issue.

HTH,

-- 

C Anthony


Re: [arch-general] systemd network configuration

2012-07-25 Thread Tom Gundersen
On Jul 25, 2012 2:45 AM, David Benfell benf...@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, Im 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.


Re: [arch-general] systemd network configuration

2012-07-25 Thread Baho Utot
On Wednesday, July 25, 2012 11:57:02 AM Tom Gundersen wrote:
 On Jul 25, 2012 2:45 AM, David Benfell benf...@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, Im 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.
^^^
This was worth a good laugh this morning




Re: [arch-general] systemd network configuration

2012-07-25 Thread Ralf Mardorf
On Wed, 2012-07-25 at 06:42 -0400, Baho Utot wrote:
 On Wednesday, July 25, 2012 11:57:02 AM Tom Gundersen wrote:or you could
  tell systemd to ruin your script.
 ^^^
 This was worth a good laugh this morning

Typing ungloved is better. Or using an alphabetically keyboard instead
of qwerty.




Re: [arch-general] systemd network configuration

2012-07-25 Thread Jameson
On Wed, Jul 25, 2012 at 6:59 AM, Ralf Mardorf
ralf.mard...@alice-dsl.net wrote:
 On Wed, 2012-07-25 at 06:42 -0400, Baho Utot wrote:
 On Wednesday, July 25, 2012 11:57:02 AM Tom Gundersen wrote:or you could
  tell systemd to ruin your script.
 ^^^
 This was worth a good laugh this morning


This just in:  New complaints arise about Arch moving some
configuration options to become more compatible with systemd as
reports surface of systemd ruining scripts.

=-Jameson


Re: [arch-general] systemd network configuration

2012-07-25 Thread Fons Adriaensen
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

Can't help it, I find this syntax ugly (CamelCase), illiterate
(assigning values to prepositions and verbs), and confusing.
In 'A.service', what does 'Before= B' mean ? Does A come 
before B or the inverse ?

Ciao,

-- 
FA

A world of exhaustive, reliable metadata would be an utopia.
It's also a pipe-dream, founded on self-delusion, nerd hubris
and hysterically inflated market opportunities. (Cory Doctorow)



Re: [arch-general] systemd network configuration

2012-07-25 Thread C Anthony Risinger
On Wed, Jul 25, 2012 at 9:03 AM, Fons Adriaensen f...@linuxaudio.org 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

 Can't help it, I find this syntax ugly (CamelCase), illiterate
 (assigning values to prepositions and verbs), and confusing.
 In 'A.service', what does 'Before= B' mean ? Does A come
 before B or the inverse ?

i normally prefer underscores in code ... but i'm pretty sure that
would look terrible?

the verb/preposition-like keywords usually describe other units -- eg.
other services/targets/ACTIVITIES -- so i don't think it's
incomprehensible.

all keywords are from A's perspective:
 - A `Wants` to start B when it starts (if available)
 - A must finish `Before` B can start (if started simultaneously)
 - A is `WantedBy` by C (if installing A permanently)
 - etc.

... basically it reads as you'd expect.

-- 

C Anthony


Re: [arch-general] systemd network configuration

2012-07-25 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 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. :-/

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

iQIcBAEBAgAGBQJQEFxvAAoJELT202JKF+xpPMYP+gOryJH4w5hIJ48kZbXDEm+6
ZuOTiJSXSTJrA8hJaAcNayrhd04uyXH2fJrpTcdDF789Bfd+xvp3rkjxN1srQsTo
/3CT2lzPDdbI+ueMRK106hy7DcumGEtQla3J3ze92ntbfQmsfRh/0z/0Akdrfrzh
Jbh5+4QeVsgumvxC/PH4dtBVzISYKPtbHV7kATSlPFAVffyjtfGhg5+NAn799s62
pbshRHwh/tnZ/JRU5grpwevCxMXfQcw2o7brNR6+plQiJNVTm6+LuKYycC6928kQ
0BYOqPnUQweis1vclWIbAQvrkN/h9noRvbRGv2tIejApxvV8EzugS0vKc3Ck3FcR
ujVclEe7maKRi92mI70MwctpmWJXfc6EHtybArkTUXXh1U8rL88Tpqf2kmZHJX9Z
XBb/5uXneCV9ocCSyFok7ZdNEjWU2uxOIppOFXZsphCbV82/L/mvg45tmMhUml5C
szHKWatHuT5pIaG+xZ0URyb7iBI3XX1+iu2e+I9WpdeUsv0AHaaA9kgONeoQmFF/
TH+6FAUu5/oLtG7kSm2k+LP2C2fH0lXVzg7FQHYtu+a5sQ8OOs9LaV+XCjy3+N47
pLRIKACRy1YzqNCeT5/jFkMnvZVeDgqHUhb3LbUqhERkxntY0hCbDBwQ6+QrfSEd
MMvad/y9QgwJTLhhRh3A
=bZzG
-END PGP SIGNATURE-


Re: [arch-general] systemd network configuration

2012-07-25 Thread Kevin Chadwick
 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. :-/

Can you not find the space to create images or dumps, so that you can
try again if need be. Or do you have a massive root partition.

As root you could.

Backup / likely with (check if root is /dev/sda in /etc/fstab and you
may need /var, /usr too)


/bin/dd if=/dev/sda bs=32k | /bin/gzip  /home/dave/sda-backup.gz





If you have problems boot the cd mount your home and restore / with


/bin/cat /home/dave/sda-backup.gz | /bin/gunzip | /bin/dd bs=32k
of=/dev/sda


Or use clonezilla

-- 


 Why not do something good every day and install BOINC.



Re: [arch-general] systemd network configuration

2012-07-25 Thread Kevin Chadwick
 check if root is /dev/sda in /etc/fstab and you
 may need /var, /usr too)
 
 
 /bin/dd if=/dev/sda bs=32k | /bin/gzip  /home/dave/sda-backup.gz

Oops, autopilot check if / is /dev/sda1 /dev/sda is whole disk which
will likely take ages without clonezilla.

-- 


 Why not do something good every day and install BOINC.



Re: [arch-general] systemd network configuration

2012-07-25 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/25/2012 03:47 PM, Kevin Chadwick wrote:

 Can you not find the space to create images or dumps, so that you
 can try again if need be. Or do you have a massive root partition.
 
It's pretty big. And I'm a starving and unemployed (Ph.D.) student so
I lack the funds to fire up a second Linode to test with.

I'm pretty clear that if it fails, I can go back to booting the Linode
kernel and it will hand off to the old init which will bring things up
the old way. What may fail is an aspect of logging, since syslog has
to listen to a different socket.

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

iQIcBAEBAgAGBQJQEHUBAAoJELT202JKF+xpLBMP/2NquXXu8hsT/5tVs83KPt8P
BkiyC+R4aFdmDA/5YbKjt6FLxJ4/JKiG3CLe/aO9Ix0ucWS6wMwjP9544n7F9SwN
GKuqBiNXT2X57mQ95IAskDwdfcdlrPXn1VEdg1WNd31D8mVNNAtNW6OTCV7XJTWP
R3283CxrS3c4r2R+wblCekoJ4ov//jmQQ1o9YZNQbCycSqkxVskjM0OR1AYodDkG
sysxig1lVLvLpXsahR6ztBRhSZGoTemc+5Kr2MHK9gatBvclnuYPkdc3PHtqgNgd
9iAP6uds69LVZ8Y5Mtm5tLtaIkfq832F6KqdTMOzdrYYKuughD5Mj/FIs8+BFn5x
NeqdKEWnpIn7BDt3dsxRiCTyqyp6FUPwePtkA+b/YepueacOOxSpGGAfZ4risnLC
afs6Kgde6L5DiRkqeRLgz3V6kH6I1k4zb9zH0SvlWO+e/sSPMoZCIqlyMgP4BOpj
1SRdjpkDgPBUPaU4agEXbKOeT9n/bciD1eP3sbUNJJV9c3axNRy0tpjjXUFsKbOd
oEmfysNov6MreCqg0yWUco9MyqhzwfNkAzfEjvOHTWauouESoqXT5zoGgA9D9H2a
/+Z+VPAyfcBrn7ULacPJT+y6MREA3git8HronMJAGPrBIqPPdiekgUwCKviBz86H
jlA/fpcUWHwoSN80h/8V
=NQVP
-END PGP SIGNATURE-


Re: [arch-general] systemd network configuration

2012-07-25 Thread David Benfell
-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
benf...@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-


Re: [arch-general] systemd network configuration

2012-07-25 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

Regrettably, due to some overzealous spam filtering in my Thunderbird
configuration and elsewhere, I'm just finding C. Anthony Risinger's
suggestion:

[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?

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

iQIcBAEBAgAGBQJQENM7AAoJELT202JKF+xpJ+cP/0EroWugjfCcJcWKjly7aDP3
hbje9h+o1uuuCz/kzQ4A+vws7B/L1/4vTqq3RIgvwyw70vBK+Q0/qwnpFm0GYrgO
IZrxYogGGTOSLfy5Cg4uOW5HxOeP94h9LAjo8uQ3UcFzp7mXV6BX1M4XVnUuDE4h
SPI/grMrRNvvcm1VTyS1/nAoUs2zaAcgCW23+4HiuiNwU+Rqe38Quy9ywtQleBRK
ntsrRa/8QF20fy8Z0TJG7WkRoxOHCUI4Vgpqrk5P1bsT7Hh4k1sjAzUOfDOU+Tok
0W8DPw+ZAb1XvLmPX0n+Z4Pp8sVTMLjt91HfbPalhcRYQgLFI2Wbe6DEPgHOfHH2
vG7m6qnAiJP8u1EHloy/56vO6s3eXd7o1iwHX2rdDgrZsS6fZrdEpL3GT3tUxVC/
hNrtkGi3WOrfu+tgkriTX4kO0BMHwbeWDYUXQZS13ngERSGXTfUKL7pvNzfCaKbT
VfTaWzXrtLVhnxQyldxwCLGZhgiPSxI6wxDU61Yo6YDGwFfALCKUvfYa2jIWs87K
dXCS1w/aKhSMxUWx9GIscZDXRP5hJL+QPiTXa5vwUAz2qhfsm0HSF7c6+wGRm73X
m891iOP7UkvWX+QLpKt+v3dHPauzMH2meT1xlpifIs3gQwN2GHoi0pKx55RyF6lq
xiJBWmkEuzBYFgN7Mhei
=nT0P
-END PGP SIGNATURE-


Re: [arch-general] systemd network configuration

2012-07-25 Thread C Anthony Risinger
On Thu, Jul 26, 2012 at 12:18 AM, David Benfell
benf...@parts-unknown.org wrote:

 [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 modified it for you here: http://dpaste.com/775539/plain/

==
# network interfaces bindings

[Unit]
Description=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-eth0.device.wants/net.static@eth0.service
==

... then:

# wget -O /etc/systemd/system/net.static@.service
http://dpaste.com/775539/plain/
 modify the ExecStart as appropriate! 
# systemctl daemon-reload
# systemctl enable net.static@eth0.service

[maybe, first time only]
# systemctl start net.static@eth0.service

... and now whatever you put in the ExecStart(s) will execute every
time the device appears.

-- 

C Anthony


[arch-general] systemd network configuration

2012-07-24 Thread David Benfell
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

Because it's summer, and I'd really rather not try to figure all this
out during the school year, I'm trying to figure out systemd *now*,
rather than waiting until rc.conf goes away.

I actually had trouble with rc.conf when I first installed Arch on my
Linode. Some daemons mysteriously wouldn't start and I couldn't figure
out how to get the networking to come up properly. (And, of course, I
was in a hurry.) So I wound up hacking rc.local to bring up both the
network and the daemons. (Yes, I know: ew!)

This is the shell snippet I'm using to bring up my network now:

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, Im not seeing how to do something
similar under systemd. How, ideally, should I be doing this?

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

iQIcBAEBAgAGBQJQD0GKAAoJELT202JKF+xpbMQP/3ADZesFp6+ZAzSItwDdvjJi
vUxCgyAXscCymTuTtjYov/lBxoh5/thu4KL2EbYA/F28r4rP0blBUR4Yrhj1jIDn
tZJcaoDBY5d7mT+hgI+9rIlGlFvnm+P/cCd8MAebkIiTAmLnurgSZe22Y6kV+VKe
nyQFJEWbyGk3O8d9ODtQnpKJ9AJrDY+fsGf/saZP+0KZDjjISHzl9VN81a4WngXP
JFeTLXhopSjWYPsECrrK0PE0Q5O524TL90ZuDvNM5BqVIgmQG9FkCzKaWLm2hCYX
gLLArdpnpAGse/yHyxBjqtHVtcm0lUD647Z8aJCHkObpQcaeAvwXSblaDcOVxo0L
3WX6qRam75kPABmDNRJPPYCqEPFiSDfdpL87m00v+zFRv+WTPr4X1NurOIomAp5x
QVjOlOvnpAbyexXfaWRzYvRpDuSrKbnuxzyDNKmGRPgiRvaWAjansoif4o0ojffh
Fw1sxLIWtggEgy0SGWJ/Ke7Z18IYJ7TF/1ZfRAknBIsdjCb8rFSA7byskjwrxWzT
rEZ9qzrtB/OKZCYsi+tlGhRiyUJ2j+8g5ujqeLvN1W7FQYd8SEmGyg5zCgYnuKBP
Sw/JnsMzvdW16BnqTMLIF5zrQJGzXV81UL101MSjwnXIuWNHAmhChx5I7yObhhYc
7fkFhIf0iSdBES8WX+Dh
=WY4X
-END PGP SIGNATURE-