[systemd-devel] starting/stopping network interfaces with systemd
Cliff Brake
cliff.brake at gmail.com
Fri Oct 7 14:24:07 PDT 2011
Hi,
I'm trying to customize systemd to start/stop network interfaces in an
embedded system (OpenEmbedded/Angstrom). Angstrom has some support
for systemd and its working fairly well so far. Are there any
examples I can start with? Basically, when a network device is
installed (USB), I'd like to run "ifup eth0", etc.
this is what I have so far:
[Unit]
Description=Start networking services
After=syslog.target
[Service]
ExecStart=/sbin/ifup eth0
Type=oneshot
ExecStop=/sbin/ifdown eth0
StandardOutput=syslog+console
[Install]
WantedBy=multi-user.target
but its not working:
systemctl start network.service
asix 1-2:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
ifup[756]: udhcpc (v1.18.5) started
ifup[756]: Sending discover...
ifup[756]: Sending select for 192.168.1.100...
ifup[756]: Lease of 192.168.1.100 obtained, lease time 3600
ifup[756]: adding dns 192.168.1.1
This all looks good, but then when I do ifconfig, the network devices
is not configured:
root at cm-x270:/lib/systemd/system# ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:268 (268.0 B) TX bytes:268 (268.0 B)
running ifup eth0 manually works fine.
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.
Thanks,
Cliff
--
=================
http://bec-systems.com
More information about the systemd-devel
mailing list