.. _integration: ``dhcpcanon`` integration with network managers ================================================ Integration with Gnome ``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-.pid -lf /var/lib/NetworkManager/dhclient--.lease -cf /var/lib/NetworkManager/dhclient-.conf 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``. .. parsed-literal:: FIXME: Configuring ``NetworkManager`` to use ``internal`` did not work (why?). Is it using systemd DHCP client code? (``libsystemd-network `_ is included in ``NetworkManager`` source code, which is in ``systemd`` `code `_). It does not work either with ``dhcpcd``: NetworkManager[12712]: [1493146345.7994] dhcp-init: DHCP client 'dhcpcd' not available Environment variables that ``dhclient`` returns ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When ``dhclient`` call the script, by default ``/sbin/dhcpcanon-script``, or when called by ``NetworkManager``, ``nm-dhcp-helper``, it pass environment variables. .. parsed-literal:: 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. Environment variables that ``nm-dhcp-helper`` gets ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TBD ?? ``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. .. parsed-literal:: 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``. nm notes --------- 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" Or the files: /etc/NetworkManager/system-connections/Wired\ connection There is currently no way that when a new device is create it defaults to a configuration. Integration with ``wicd`` --------------------------- TBD `wicd `_ `wicd documentation `_