You are not logged in.
I'm running an LXC Arch container as well as dnsmasq and lxc-net on a host. I'm able to manually configure networking from within the container (i.e. with `ip route add 10.0.3.0/24 dev eth0 && ip route add default via 10.0.3.1 && ip addr add 10.0.3.2 dev eth0`), but I want to use DHCP. If I run `systemctl start dhcpcd` in the container, I don't get an IP, and `journalctl` reports:
May 05 17:41:57 test systemd[1]: Starting dhcpcd on all interfaces...
May 05 17:41:57 test dhcpcd[79]: dev: loaded udev
May 05 17:41:57 test dhcpcd[79]: no valid interfaces found
May 05 17:41:57 test dhcpcd[79]: no valid interfaces found
May 05 17:41:57 test dhcpcd[79]: forked to background, child pid 80
May 05 17:41:57 test systemd[1]: Started dhcpcd on all interfaces.
The same thing happens if I run `dhcpcd` manually from the command line.
However, if I stop & disable dhcpcd entirely, then run `dhcpcd --rebind eth0` from the shell, I successfully get an IP with this output:
[root@test /]# dhcpcd --rebind eth0
DUID 00:01:00:01:22:80:a1:31:ee:d8:a2:18:09:9f
eth0: IAID c2:79:28:2f
eth0: soliciting an IPv6 router
eth0: rebinding lease of 10.0.3.252
eth0: NAK: address in use from 10.0.3.1
eth0: message: address in use
eth0: soliciting a DHCP lease
eth0: offered 10.0.3.36 from 10.0.3.1
eth0: probing address 10.0.3.36/24
eth0: leased 10.0.3.36 for 3600 seconds
eth0: adding route to 10.0.3.0/24
eth0: adding default route via 10.0.3.1
forked to background, child pid 107
Why isn't dhcpcd working when I start it as a service, or manually w/o flags, but runs fine with --rebind?
Offline
So at boot, dhcpcd didn't find any interfaces.
This is fine, one might appear later. I see that dhcpcd is also compiled for udev support, so it expects udev to announce the interface and will ignore the kernel.
Maybe udev doesn't work well in a container.
Try adding nodev to dhcpcd.conf to disable udev.
Offline