-
Notifications
You must be signed in to change notification settings - Fork 126
Description
Hello,
As I use macvlan plugin in netavark with podman along the dhcp driver, I would like to be able to specify certain dhcp options when creating containers.
The reasoning behind is that I can have different "conditions" based on "what" is requesting an IP address from my network. Examples (that I use) are:
- shorter lease time
- specific range of ip address within my network
While developing/testing, its very easy to spam your network DHCP with requests, exhausting available IP addresses or causing different issues (for example when your DHCP server registers the hostname into your DNS). Most DHCP servers allows to have specific conditions and usually that is selected by vendor-class-identifier. For example, to have different lease options in case of a DHCP request during PXE boot .
Of course, having the option to send just vendor-class-identifier would be enough for me, but a more generic implementation would be to allow to send arbitrary DHCP options like in the CNI implementation, as I'm using in my K3S setup:
"ipam": {
"type": "dhcp",
"daemonSocketPath": "/run/cni/dhcp.sock",
"request": [
],
"provide": [
{
"option": "host-name",
"fromArg": "K8S_POD_NAME"
},
{
"option": "vendor-class-identifier",
"value": "containers"
}
]
}
If anyone is curious, this can be implemented on dnsmasq (which kinda runs on any openwrt router) - what I currently use - as follows:
dhcp-match=set:k3s,option:vendor-class,containers
dhcp-range=tag:k3s,172.20.0.33,172.20.0.159,255.255.255.0,1h
dhcp-option=k3s,option:mtu,9000
Creating an issue since the feature itself is different but similar thing was mentioned in a different (open) issue:
Is there a specific reason that you have to set dhcp-vendor-class-identifier? We can consider adding this as feature if you need it.