dhcpcd-discuss

Re: dhcpcd is running but no ip allocated

Roy Marples

Fri Sep 18 17:57:05 2020

On 18/09/2020 09:58, daggs wrote:
Firstly I would ditch hotplug. dhcpcd has this covered already - infact it has
it covered twice because I can see you are using udev as will and dhcpcd listens
to udev hotplug.
I understand but why it wasn't started in the first time?

Nothing indicates that it wasn't from your log?

There is an error in your hotplug command - the -m option does not take an argument.
control command: dhcpcd -t 0 -m 6 veth
This means zero timeout in master mode with the interfaces 6 and veth.
help suggest otherwise:
# dhcpcd --help | grep "\-m"
                 [-l, --leasetime seconds] [-m, --metric metric]

version is:
dhcpcd 8.1.9
Copyright (c) 2006-2019 Roy Marples
Compiled in features: INET ARP ARPing IPv4LL INET6 DHCPv6 AUTH

what is the expected cmd? dhcpcd -t 0 -m veth

My bad, I read that as capital M. Your command is fine.

You could achieve the same in dhcpcd.conf like so:

interface veth
	metric 6

interface enp0s20f0u7
	metric 8



Secondly, I don't see any tap interfaces in your logs?
here:
# cat /sys/class/net/veth/tun_flags
0x5002

# ifconfig veth
veth: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
         inet 10.0.0.3  netmask 255.255.255.0  broadcast 10.0.0.255
         inet6 fe80::fc54:ff:fea7:796b  prefixlen 64  scopeid 0x20<link>
         inet6 fe80::2ecd:ba9e:b666:96a0  prefixlen 64  scopeid 0x20<link>
         inet6 fdab:9802:eb52::790  prefixlen 128  scopeid 0x0<global>
         inet6 fdab:9802:eb52:0:41d9:d311:10fd:e343  prefixlen 64  scopeid 0x0<global>
         ether fe:54:00:a7:79:6b  txqueuelen 1000  (Ethernet)
         RX packets 2850  bytes 469394 (458.3 KiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 770  bytes 132451 (129.3 KiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


If you're using net.tap0 to create the tap0 interface that's fine, just don't
set any network directives such as dhcp etc.
Just use init.d/dhcpcd as well.

the tap device is created by libvirt, I just changed the name from vnet0 to veth
the script name is /etc/init.d/net.veth

Ah. You might want to consider using udev to rename it.
If dhcpcd is listening to udev then it ensures that udev can rename the device correctly and only then start it.

Any other method involves a race between dhcpcd and something else which might be the real problem here.

You may wish to consider using init.d/network over net.tap0 as it was designed
just to create the interface link rather than manage the whole food chain.

Roy

I'm not sure gentoo supports this feature out of the box.

True.

As libvirt is creating the interface, I think we can solve this by removing net.veth and letting udev handle the rename.

Roy

Follow-Ups:
Re: dhcpcd is running but no ip allocateddaggs
References:
dhcpcd is running but no ip allocateddaggs
Re: dhcpcd is running but no ip allocatedRoy Marples
Re: dhcpcd is running but no ip allocateddaggs
Re: dhcpcd is running but no ip allocatedRoy Marples
Re: dhcpcd is running but no ip allocateddaggs
Archive administrator: postmaster@marples.name