dhcpcanon
integration with network managers¶Network Manager
¶Gnome Network Manager has several components.
In Debian the service NetworkManager
by default
calls dhclient
which in turn calls nm-dhcp-helper
.
Depending on the configuration, dhclient is called with the parameters:
/sbin/dhclient -d -q
-sf /usr/lib/NetworkManager/nm-dhcp-helper
-pf /var/run/dhclient-<interface>.pid
-lf /var/lib/NetworkManager/dhclient-<?>-<interface>.lease
-cf /var/lib/NetworkManager/dhclient-<interface>.conf
<interface>
Dclient calls nm-dhcp-helper
via the -sf
parameter,
which seems to communicate back with NetworkManager
via D-Bus.
NetworkManager
can be configured to use dhcpcd
or internal
, as DHCP clients instead of dhclient
.
FIXME: ConfiguringNetworkManager
to useinternal
did not work (why?). Is it using systemd DHCP client code? (libsystemd-network <https://github.com/NetworkManager/NetworkManager/tree/master/src/systemd/src/libsystemd-network`>`_ is included in ``NetworkManager
source code, which is insystemd
code). It does not work either withdhcpcd
: NetworkManager[12712]: <warn> [1493146345.7994] dhcp-init: DHCP client 'dhcpcd' not available
dhclient
returns¶When dhclient
call the script, by default /sbin/dhcpcanon-script
,
or when called by NetworkManager
, nm-dhcp-helper
, it pass environment
variables.
FIXME: Are these variables documented somewhere?.
In man dhclient-script
there is the list of values that the variable reason
can take:
The following reasons
are currently defined: MEDIUM, PREINIT, BOUND, RENEW, REBIND, REBOOT,
EXPIRE, FAIL, STOP, RELEASE, NBI and TIMEOUT.
But there are more variables.
By setting RUN=yes
in /etc/dhcp/debug
, these variables are found
in /tmp/dhclient-script.debug
:
reason='PREINIT'
interface=
--------------------------
reason='REBOOT'
interface=
new_ip_address=
new_network_number=
new_subnet_mask=
new_broadcast_address=
new_routers=
new_domain_name=
new_domain_name_servers=
Looking at the code dhclient v4.3.5 there seem to be more variables.
dhcpcanon
required modifications¶If dhcpcanon
accepts the same arguments as dhclient
and calls
the script nm-dhcp-helper
with the same environment
variables as dhclient
, it should be integrated.
FIXME: however for some reason this generates D-Bus errors.
dhcpcanon
could also implement the D-Bus input/output that
NetworkManager
needs.
There’s a NetworkManager D-Bus API specification.
There’s also a Python API, python-networkmanager,
so dhcpcanon
could communicate directly with NetworkManager
instead
communicating with nm-dhcp-helper
.
Debugging:
[logging] level=DEBUG
It is not possible to set dhcp-send-hostname
(Bug 768076 - No way to set dhcp-send-hostname globally)
globally.
To modify dhcp-send-hostname
per interface:
nmcli connection modify “Wired connection” ipv4.dhcp-send-hostname no nmcli connection show “Wired connection”
There is currently no way that when a new device is create it defaults to a configuration.