Re: dhclient adding second address to desktop with static IP



On Fri, 9 Aug 2019 at 06:59, Thomas Haller <thaller redhat com> wrote:

On Thu, 2019-08-08 at 11:41 +0100, Mike Fleetwood wrote:
On Wed, 7 Aug 2019 at 12:29, Thomas Haller <thaller redhat com>
wrote:
On Wed, 2019-08-07 at 12:19 +0100, Mike Fleetwood via
networkmanager-
list wrote:
Hi,

On my CentOS 7 / XFCE desktop, I've setup a static IP address
using
NM.
However dhclient is using DHCP and adding a second IP
address.  How
do
I troubleshoot this and turn it off?

Thanks,
Mike

Hi,

Don't enable DHCP (ipv4.method=auto):

nmcli connection modify "$PROFILE" \
  ipv4.method manual \
  ipv4.addresses $ADDRESSES


best,
Thomas

NM was already set for manual IPv4 addresses, but I reset it anyway
[1].
This didn't remove the second DHCP assigned address from the NIC, so
I
removed it manually [2].  Later in the day dhclient re-added a second
DHCP obtained address again[3].

How do I stop dhclient doing this?

Mike


[1] NM already set for manual IPv4 addresses.
# nmcli connection show enp5s0 | egrep 'ipv4.method|ipv4.addresses'
ipv4.method:                            manual
ipv4.addresses:                         192.168.1.2/24

# nmcli connection modify enp5s0 ipv4.method manual ipv4.addresses
192.168.1.2/24

# nmcli connection show enp5s0 | egrep 'ipv4.method|ipv4.addresses'
ipv4.method:                            manual
ipv4.addresses:                         192.168.1.2/24

Hi,

after modifying the connection profile to set ipv4.method=manual, did
you re-activate the profile?

E.g. `nmcli connection up enp5s0`

(Or did you reboot the machine since? Reboot is of course not
necessary, you can just re-activate the profile, but it would do as
well).


Otherwise, show the full level=TRACE log. See
https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/contrib/fedora/rpm/NetworkManager.conf#n28
for how to enable debug logging, and note the comments about private
data and and journald's ratelimiting.


Thanks,
Thomas

I fixed this earlier this morning.  I stopped the systemd managed
NetworkManager service.  Even with the service stopped dhclient was
still running in the control group managed by systemd.  Manually killed
dhclient [1].
(Rethorical question, how is that even allowed?  Surely the point of
systemd using CGroups is so that it can identify all processes for a
service, which it did, and that when stopping a service it ensures all
processes stop or are killed, but it didn't).

Then I manually removed the unwanted DHCP assigned IP address again and
restarted the NetworkManager servers.  No dhclient running this time
[2].

Mike

[1] Stopped NetworkManager, but dhclient still running.  Killed it.

# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service;
enabled; vendor preset: enabled)
   Active: active (running) since Sun 2019-07-28 14:59:36 BST; 1 weeks
4 days ago
     Docs: man:NetworkManager(8)
 Main PID: 1216 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ├─ 1216 /usr/sbin/NetworkManager --no-daemon
           └─20511 /sbin/dhclient -d -q -sf
/usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp5s0.pid -lf
/var/lib...

# ps -ef | fgrep 1216
root      1216     1  0 Jul28 ?        00:00:32
/usr/sbin/NetworkManager --no-daemon
root     20511  1216  0 Aug02 ?        00:00:00 /sbin/dhclient -d -q
-sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp5s0.pid -lf
/var/lib/NetworkManager/dhclient-9a3f4eb5-765b-47b5-9a07-65ecf1aadf1b-enp5s0.lease
-cf /var/lib/NetworkManager/dhclient-enp5s0.conf enp5s0

# systemctl stop NetworkManager

# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service;
enabled; vendor preset: enabled)
   Active: inactive (dead) since Fri 2019-08-09 06:48:31 BST; 5s ago
     Docs: man:NetworkManager(8)
  Process: 1216 ExecStart=/usr/sbin/NetworkManager --no-daemon
(code=exited, status=0/SUCCESS)
 Main PID: 1216 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/NetworkManager.service
           └─20511 /sbin/dhclient -d -q -sf
/usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp5s0.pid -lf
/var/lib...

# ps -ef | fgrep dhclient
root     20511     1  0 Aug02 ?        00:00:00 /sbin/dhclient -d -q
-sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp5s0.pid -lf
/var/lib/NetworkManager/dhclient-9a3f4eb5-765b-47b5-9a07-65ecf1aadf1b-enp5s0.lease
-cf /var/lib/NetworkManager/dhclient-enp5s0.conf enp5s0

# kill -9 20511


[2] Manually remove unwanted DHCP assigned IP address and restarted
Network Manager.

# ip address list enp5s0
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP group default qlen 1000
    link/ether 48:5b:39:75:42:bc brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.191/24 brd 192.168.1.255 scope global noprefixroute
dynamic enp5s0
       valid_lft 29772sec preferred_lft 29772sec
    inet 192.168.1.2/24 brd 192.168.1.255 scope global secondary
noprefixroute enp5s0
       valid_lft forever preferred_lft forever
    inet6 fe80::39a1:ab53:fa00:828c/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

# ip address del 192.168.1.191/24 dev enp5s0

# ip address list enp5s0
2: enp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP group default qlen 1000
    link/ether 48:5b:39:75:42:bc brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/24 brd 192.168.1.255 scope global noprefixroute enp5s0
       valid_lft forever preferred_lft forever
    inet6 fe80::39a1:ab53:fa00:828c/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

# systemctl start NetworkManager

# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service;
enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-08-09 06:55:06 BST; 42s ago
     Docs: man:NetworkManager(8)
 Main PID: 19312 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           └─19312 /usr/sbin/NetworkManager --no-daemon


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]