Using dnsmasq installed inside the Kubenetics k8 cluster. We will be using it to do a dhcp and PXE boot of hosts. (https://wiki.archlinux.org/title/dnsmasq)
Wanted to check if my DHCP server is up and running. Unable to verify DHCP and client vm handshake. Steps performed:
/tmp # cat /etc/dnsmasq.conf
port=0
log-dhcp
pxe-service=x86PC,"Network Boot",pxelinux
enable-tftp
tftp-root=/var/lib/tftpboot
interface=eth2
dhcp-range=192.27.47.6,192.27.47.14,12h
dhcp-boot=/var/lib/tftpboot/pxelinux.0
enable-tftp
tftp-root=/var/lib/tftpboot
user=root
From inside the k8 POD, able to see a new interface attached
eth2 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.27.47.5 Bcast:192.27.47.15 Mask:255.255.255.240
inet6 addr: xxxx::xxxx:xxx:xxx/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:202 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:61946 (60.4 KiB) TX bytes:2378 (2.3 KiB)
Attached the same interface(eth2) adapter on node
To verify if DHCP is working at POD level, launched new other PODS with same NAD to check with the DHCP is able to assign any IP to that POD. I am only seeing new eth2 interface for new PODs too. But new IPs are not getting assigned from the DHCP range. NAD looks like
cat <<EOF | kubectl create -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-conf-116
namespace: dhcp
spec:
config: '{
"cniVersion": "0.3.0",
"type": "macvlan",
"master": "eth2",
"mode": "bridge",
"ipam": {
"type": "static",
"addresses": [
{
"address": "192.27.47.5/28"
}
]
}
}'
EOF
Docker file used for k8 pod has entry:
ENTRYPOINT ["dnsmasq", "--no-daemon"]
CMD ["--dhcp-range=192.27.47.6,192.27.47.14"]
I see the tcpdump logs from my host machine where eth2 interface is attached, this dump does not have any info on IP being sent from DHCP server to requested MAC Address.
06:48:44.661823 IP 0.0.0.0.65 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:11:b8:12:a7:02, length 300 06:48:44.661823 IP 0.0.0.0.65 > 255.255.255.255.67: BOOTP/DHCP, Request from 00:11:b8:12:a7:02, length 300
What am I missing here ? Not sure how to verify if the DHCP server is running inside the POD and the request which came to Node is able to reach to POD running DHCP server.