Re: systemd network configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Jul 26, 2012 at 12:18 AM, David Benfell
<benfell@xxxxxxxxxxxxxxxxx> 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


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux