NetworkManager - hpaluch/hpaluch.github.io GitHub Wiki

NetworkManager

Here are my random NetworkManager tips.

Hidden DHCP client

In Fedora 43 - NetworkManager uses only so-called internal DHCPv4 client - statically linked on main NetworkManager binary and using non-blocking I/O - practically impossible to debug.

But I found another weirdness (no explanation yet).

When running netstat I can't see NM listening on UDP client socket (shown for traditional DHCP clients):

$ sudo netstat -ltunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      747/sshd: /usr/sbin 
tcp6       0      0 :::22                   :::*                    LISTEN      747/sshd: /usr/sbin 

However ss (sockstat) reveals it:

$ sudo ss -np | grep -e :68 -e :67 -e ^Netid

RTNETLINK answers: Invalid argument # <= harmless

Netid State  Recv-Q Send-Q                                         Local Address:Port   Peer Address:Port \
 Process
udp   ESTAB  0      0                                       192.168.122.221%eth0:68    192.168.122.1:67   \
 users:(("NetworkManager",pid=1779,fd=26))                     

Also lsof works properly:

$ sudo lsof  -iUDP -nP 

COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
NetworkMa 1779 root   26u  IPv4  14458      0t0  UDP 192.168.122.221:68->192.168.122.1:67 

Debugging DHCP client

  • created /etc/NetworkManager/conf.d/90-dhcp.conf with content:
    [logging]
    level=TRACE
    domains=DHCP
    
  • next you have to systemctl restart NetworkManager
  • and see log entries using journalctl -b -u NetworkManager

There are also tips on Internet how to show more details, for example:

  • to get device names: nmcli conn you can then use NAME or UUID field for more commands (or DEVICE for device command below)
  • nmcli -f ALL device show (you can also append device, for example eth0 to see "all fields" for specific devices only
  • only DHCPv4 info: nmcli -f DHCP4 device show