Rkt: ipam/DHCP should use container's "hostname"

Created on 2 Aug 2018  路  4Comments  路  Source: rkt/rkt

_rkt_ is awesome as it makes it possible to use existing LAN's DHCP server to assign containers' IP addresses with the following sample config (--net=macvlan_dhcp):

/etc/rkt/net.d/11-macvlan_dhcp.conf

~~
{
"Documentation": "https://github.com/containernetworking/plugins/tree/master/plugins/main/macvlan",
"name": "macvlan_dhcp",
"type": "macvlan",
"master": "br0",
"mode": "bridge",
"ipam": {
"type": "dhcp"
}
}
~
~

However there is a problem: container's _hostname_ is not passed to external DHCP making it impossible to find/access container on network by its name.
This behaviour severely impairs usefulness of DHCP.

Most helpful comment

We were discussing in the CNI meeting about passing the CNI_CONTAINERID as the DHCP client id (option 61). If you like, you could file an issue here: https://github.com/containernetworking/plugins

All 4 comments

It's not precisely issue with rkt, but more probably with https://github.com/containernetworking/plugins which contains implementation of dhcp ipam plugin used by macvlan_dhcp.

To be more precise - dhcp client defined in https://github.com/containernetworking/plugins/blob/master/plugins/ipam/dhcp/lease.go#L347 does not have any info about client hostname, and that's because dhcp client library which it uses does not have a mechanism for that when it's constructing its request in https://github.com/d2g/dhcp4client/blob/master/client.go#L278

https://github.com/d2g/dhcp4client/issues/22
I hope someone could liaison with _dhcp4client_ and _CNI_ and maybe even contribute patches with implementation...

We were discussing in the CNI meeting about passing the CNI_CONTAINERID as the DHCP client id (option 61). If you like, you could file an issue here: https://github.com/containernetworking/plugins

Is CNI_CONTAINERID == _hostname_? Only host name can and should be used as client id...

Was this page helpful?
0 / 5 - 0 ratings