Re: Centos Stream 9: NetworkManager/conf.d/ override mtu received from dhcp



Hi,


On Wed, 2022-03-30 at 22:56 +0000, Stephen Horton via networkmanager-
list wrote:
Hello, I'm new to the list; I am working on moving an application to
Centos Stream 9 running inside an openstack cloud virtual guest.  I
have created:
/etc/NetworkManager/conf.d/90-dns-none.conf:
[main]
dns=none
to prevent Network Manager from overwriting the /etc/resolv.conf with
incorrect DNS server entries from our DHCP service. This is working.

I also need to tell Network Manager to override the MTU provided by
the DHCP service (which is telling my interfaces to use mtu=9000).  I
have created:
/etc/NetworkManager/conf.d/91-mtu-none.conf:
[connection]
match-device=interface-name:eth0
ethernet.mtu=0

this sets global defaults in NetworkManager.conf. This is documented in
`man NetworkManager.conf`. While you can do this, it seems preferable
to not change the default, but change the actual setting in the
respective profile.

  nmcli connection modify "$PROFILE" ethernet.mtu 1500


OK, granted, setting "ethernet.mtu=0" is documented to have a very
specific additional behavior, that is:

  If configured explicitly to 0, the MTU is not reconfigured during 
  device activation unless it is required due to IPv6 constraints.

Hm, the text reads as this should work. Maybe there is a bug in
handling `ethernet.mtu=0` in `NetworkManager.conf`.



then: systemctl reload NetworkManager

This reloads configuration from NetworkManager.conf. That has no effect
on devices that are currently activated. To change the configuration of
a device, activate a profile with `nmcli connection up $PROFILE`. If
the device is already activated, then re-activate the profile with
`nmcli connection up $PROFILE`.

You can also use `nmcli device reapply $IFNAME` or `nmcli device modify
$IFNAME`, which does something slightly different but is a way to
change runtime configuration too. If you care about the difference,
read `man nmcli`. Otherwise, just do a full re-activation with `nmcli
conneciton up $PROFILE`.

I can then:  nmcli device modify eth0 ethernet.mtu 1500  and it
changes the mtu to 1500 (shown in: ip address show).  However, when I
reboot, it changes back to mtu 9000.

`nmcli device modify` modifies the current runtime configuration. Read
`man nmcli` about what it does.

Usually, adjust the profile with `nmcli connection modify` and activate
the desired profile with `nmcli connection up`.


ifcfg-eth0 file still contains MTU=9000

A profile on disk gets modified by `nmcli connection modify $PROFILE`
(and a few other special cases, like when a system-wide password is
provided during activation).



Can someone provide some guidance on how this should work please?



Maybe https://www.redhat.com/sysadmin/becoming-friends-networkmanager
is a useful introduction?



best,
Thomas



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