[systemd-devel] starting/stopping network interfaces with systemd
Cliff Brake
cliff.brake at gmail.com
Sat Oct 8 08:09:26 PDT 2011
On Fri, Oct 7, 2011 at 7:01 PM, Mirco Tischler <mt-ml at gmx.de> wrote:
> 2011/10/7 Cliff Brake <cliff.brake at gmail.com>:
> The problem is, as soon as ifup exits systemd thinks the service is dead and
> calls the ExecStop line, which of cause brings down the interface
> again instantly.
> The solution should be to add RemainAfterExit=yes to your service file.
Thanks, that enables me to now run systemctrl start/stop.
>> Beyond this, it would be nice to somehow trigger on when a USB NIC is
>> installed and automatically run ifup. Any pointers would be
>> appreciated.
> An udev rule which starts a template unit file is probably the right
> thing to do.
> Something like this may do the job:
>
> SUBSYSTEM=="net", KERNEL!="lo", ENV{SYSTEMD_WANTS}="network@$name.service"
>
> and a service file like this:
>
> cat networl at .service:
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=/sbin/ifup %i
> ExecStop=/sbin/ifdown %i
> StandardOutput=syslog+console
I'm still not successfull in getting ifup to run on boot (after the
NIC is detected) or on NIC insertion.
At a high level, how does the communication between udev and systemd work?
More information about the systemd-devel
mailing list