<p>I'm facing the below mentioned issue while using DHCP IPAM plugin + Macvlan + Multus for the additional interface creation inside my pod and assigning IP from DHCP server.</p>
<p>I actually went through the related issues around this problem and tried all the solutions/different configurations mentioned there. But none of them were working so far. The documentation for CNI plugin w.r.t DHCP usage also not quite clear.</p>
<p><strong>Related Issues:</strong></p>
<ol>
<li><a href="https://github.com/k8snetworkplumbingwg/multus-cni/issues/291" rel="nofollow noreferrer">https://github.com/k8snetworkplumbingwg/multus-cni/issues/291</a></li>
<li><a href="https://github.com/containernetworking/plugins/issues/587" rel="nofollow noreferrer">https://github.com/containernetworking/plugins/issues/587</a></li>
<li><a href="https://github.com/containernetworking/plugins/issues/371" rel="nofollow noreferrer">https://github.com/containernetworking/plugins/issues/371</a></li>
<li><a href="https://github.com/containernetworking/plugins/issues/440" rel="nofollow noreferrer">https://github.com/containernetworking/plugins/issues/440</a></li>
<li><a href="https://github.com/containernetworking/cni/issues/398" rel="nofollow noreferrer">https://github.com/containernetworking/cni/issues/398</a></li>
<li><a href="https://github.com/containernetworking/cni/issues/225" rel="nofollow noreferrer">https://github.com/containernetworking/cni/issues/225</a></li>
<li><a href="https://github.com/containernetworking/plugins/issues/371" rel="nofollow noreferrer">https://github.com/containernetworking/plugins/issues/371</a></li>
</ol>
<p><strong>Solutions Suggested:</strong></p>
<ol>
<li><a href="https://github.com/containernetworking/plugins/pull/577" rel="nofollow noreferrer">https://github.com/containernetworking/plugins/pull/577</a></li>
</ol>
<p><strong>DHCP Daemon Logs:</strong></p>
<pre><code>[root@test-node cni_plugins]# ./dhcp daemon -broadcast=true
2022/06/09 12:00:03 ac7d57597540992a1af43455da24b3210561ce12b164820ee18f583a304a/test_net_attach1/net1: acquiring lease
2022/06/09 12:00:03 Link &quot;net1&quot; down. Attempting to set up
2022/06/09 12:00:03 network is down
2022/06/09 12:00:03 retrying in 2.881018 seconds
2022/06/09 12:00:16 no DHCP packet received within 10s
2022/06/09 12:00:16 retrying in 2.329120 seconds
2022/06/09 12:00:29 no DHCP packet received within 10s
2022/06/09 12:00:29 retrying in 1.875428 seconds

</code></pre>
<p><strong>NetworkAttachmentDefinition:</strong></p>
<pre><code>apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: &quot;test1&quot;
  annotations:
    k8s.v1.cni.cncf.io/resourceName: intel.com/test_net_attach1
spec:
  config:
    '{
    &quot;name&quot;: &quot;test_net_attach1&quot;,
    &quot;type&quot;: &quot;macvlan&quot;,
    &quot;master&quot;: &quot;ens2f0&quot;,
    &quot;ipam&quot;: {
        &quot;type&quot;: &quot;dhcp&quot;
    }
    }'
</code></pre>
<p><strong>Test Pod YAML:</strong></p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: dhcp-test1
  annotations:
    k8s.v1.cni.cncf.io/networks: test1
spec:
  nodeSelector:
    deploy: vm1
  containers:
    - name: c1
      image: centos:latest
      command: [&quot;/bin/sh&quot;,&quot;-c&quot;]
      args: [&quot;sleep infinity&quot;]

</code></pre>
<p><strong>DHCP SERVER Logs:</strong></p>
<pre><code>Internet Systems Consortium DHCP Server 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /data/dhcpd.conf
Database file: /data/dhcpd.leases
PID file: /var/run/dhcpd.pid
Wrote 0 leases to leases file.
Listening on LPF/ens2f0/b4:96:91:a5:8c:82/192.168.231.0/24
Sending on   LPF/ens2f0/b4:96:91:a5:8c:82/192.168.231.0/24
Sending on   Socket/fallback/fallback-net
Server starting service.
DHCPDISCOVER from 4a:63:ad:6d:9a:44 via ens2f0
DHCPOFFER on 192.168.231.120 to 4a:63:ad:6d:9a:44 via ens2f0
DHCPDISCOVER from 4a:63:ad:6d:9a:44 via ens2f0
DHCPOFFER on 192.168.231.120 to 4a:63:ad:6d:9a:44 via ens2f0
</code></pre>
<p><strong>Observations:</strong></p>
<ol>
<li>DHCP request and response are seen by tcpdump on the interface but the dhcp daemon says none was received.</li>
<li>Looks like the DHCP daemon is not picking up the offer.</li>
</ol>
<p><strong>ENVIRONMENT:</strong>
CNI: cni-plugins-linux-amd64-v1.1.1.tgz</p>
<p>Could someone please share the working configurations for the below mentioned items</p>
<ol>
<li>Network attachment definition</li>
<li>Sample Pod YAML</li>
<li>How to run DHCP Daemon?</li>
</ol>
<p>for the better documentation and for the new comers who is facing issues around this? Please let me know if you needed anything or if I'm missing anything?</p>

ddran
<p>I started the daemon on the server node with:</p>
<pre><code>cd /opt/cni/bin
sudo ./dhcp daemon
</code></pre>
<p>In a couple of seconds my pod received its IP address from my DHCP server.</p>
