- Does the dhcp client on Linux write any logs?
- If not, can logs be enabled and how?
- If it writes logs, where can they be found?
- How does a typical log of a dhcp client look like when obtaining IP and nameservers from a DHCP server?
- Where can I find the source code of the DHCP client?
In case there are relevant differences between Linuxes: I am interested in Debian 8.1 (default minimal installation amd64).
Answer
ISC's DHCP client is usually called dhclient
in most Linux distributions. From man dhclient
:
The client normally prints no output during its startup sequence. It can be made to emit verbose messages displaying the startup sequence events until it has acquired an address by supplying the -v command line argument. In either case, the client logs messages using the syslog(3) facility.
There are two possible ways to read your system log. On most systems that use systemd, you have to use journalctl
, whereas cat /var/log/syslog
is valid for systems that still employ a traditional init system.
Therefore, if your system is using systemd's logging facility, you can use journalctl | grep -Ei 'dhcp'
to get DHCP client logs. Otherwise, enter cat /var/log/syslog | grep -Ei 'dhcp'
.
Here is what my DHCP client log typically looks like:
Jul 20 14:17:39 trueclient1 NetworkManager[2622]: (wlan1): canceled DHCP transaction, DHCP client pid 3325
Jul 20 14:17:42 trueclient1 NetworkManager[2622]: Activation (wlan1) Beginning DHCPv4 transaction (timeout in 45 seconds)
Jul 20 14:17:42 trueclient1 dhclient: Internet Systems Consortium DHCP Client 4.2.2
Jul 20 14:17:42 trueclient1 dhclient: For info, please visit https://www.isc.org/software/dhcp/
Jul 20 14:17:42 trueclient1 NetworkManager[2622]: (wlan1): DHCPv4 state changed nbi -> preinit
Jul 20 14:17:42 trueclient1 dhclient: DHCPREQUEST on wlan1 to 255.255.255.255 port 67
Jul 20 14:17:42 trueclient1 dhclient: DHCPACK from 10.8.8.1
Jul 20 14:17:42 trueclient1 NetworkManager[2622]: (wlan1): DHCPv4 state changed preinit -> reboot
No comments:
Post a Comment