Is there a reason to keep dhcpcd running after an Internet connection is established? - Re: Systemd service life cycle
Ralf Mardorf
silver.bullet at zoho.com
Wed Apr 13 18:13:48 UTC 2016
On Tue, 12 Apr 2016 17:57:09 +0200, Tom H wrote:
> I wrote:
>> When I used PPPoE and the connection was interrupted after 24 hours,
>> it was automatically established again, after it was interrupted.
>> Maybe pppd did this, but perhaps it was systemd. I don't know.
>
>No idea, sorry.
I noticed something very funny. If dhcpcd isn't running, I still have
an Internet connection.
If I run
alice-dhcp --off
(from a script I posted earlier,
https://lists.ubuntu.com/archives/ubuntu-users/2016-April/284991.html,
the relevant details are shown later, by this mail, too) the connection
gets not disconnected. Most likely I guessed that it works, because I
perhaps always first run my PPPoE script by accident
alice --off
actually someday I need to fix my DHCP script.
I wonder what running the dhcpcd is good for, after the connection via
router is established?
[weremouse at moonstudio sbin]$ grep -A2 off\( alice-dhcp
dhcpcd_off() {
echo ; dhcpcd -x $(basename $(ls -d /sys/class/net/enp?s0)) ; echo
}
[weremouse at moonstudio sbin]$ grep -A4 off\( alice
pppoe_off() {
echo; poff -a; ip link set enp3s0 down; printf "Progress: "
while pidof pppd > /dev/null; do printf "."; sleep 3; done;
echo; modprobe -vr pppoe; echo
}
[weremouse at moonstudio sbin]$ echo $(basename $(ls -d /sys/class/net/enp?s0))
enp3s0
[weremouse at moonstudio sbin]$ dhcpcd -x enp3s0
dhcpcd not running
[weremouse at moonstudio sbin]$ ping google.com
PING google.com (216.58.213.46) 56(84) bytes of data.
64 bytes from ber01s15-in-f14.1e100.net (216.58.213.46): icmp_seq=1 ttl=51 time=25.2 ms
^C
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 25.210/25.210/25.210/0.000 ms
[weremouse at moonstudio sbin]$ sudo ip link set enp3s0 down
[weremouse at moonstudio sbin]$ ping google.com
ping: unknown host google.com
[weremouse at moonstudio sbin]$ sudo alice-dhcp
enp3s0: adding address fe80::a2c6:6e4c:66ab:9102
/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
[snip]
forked to background, child pid 890
[weremouse at moonstudio sbin]$ ping google.com
PING google.com (216.58.213.14) 56(84) bytes of data.
64 bytes from ber01s14-in-f14.1e100.net (216.58.213.14): icmp_seq=1 ttl=51 time=25.0 ms
^C
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 25.036/25.036/25.036/0.000 ms
[weremouse at moonstudio sbin]$ sudo alice --off
/usr/bin/poff: No pppd is running. None stopped.
Progress:
[weremouse at moonstudio sbin]$ ping google.com
ping: unknown host google.com
[weremouse at moonstudio sbin]$ sudo dhcpcd -x enp3s0
sending signal TERM to pid 890
waiting for pid 890 to exit
[weremouse at moonstudio sbin]$ sudo alice-dhcp
[snip]
/etc/resolvconf/update.d/libc: Warning: /etc/resolv.conf is not a symbolic link to /run/resolvconf/resolv.conf
forked to background, child pid 993
[weremouse at moonstudio sbin]$ ping google.com
PING google.com (216.58.213.14) 56(84) bytes of data.
64 bytes from ber01s14-in-f14.1e100.net (216.58.213.14): icmp_seq=1 ttl=51 time=25.2 ms
^C
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 25.205/25.205/25.205/0.000 ms
[weremouse at moonstudio sbin]$ pidof dhcpcd
993
At this point I disconnected the rooter from the mains and reconnected
it. When the rooter was ready again, I still waited a few seconds and
then I tried to ping Google. The Internet connection worked.
After that I exited dhcpcd (dhcpcd -x enp3s0), the Internet connection
still worked.
Then I disconnected and reconnected the rooter from the mains again.
The Internet connection still worked and dhcpcd was not auto-started,
IOW not running.
So what is continuing running the daemon good for after the Internet
connection is established?
FWIW "/etc/resolv.conf is not a symbolic link", because I use
systemd-nspawn containers often without the -b/--boot option. It might
work with a link when using the -b/--boot option, but it at least
doesn't without. On Arch Linux I don't get this warning.
Regards,
Ralf
More information about the ubuntu-users
mailing list