5

What is the correct way of making nmcli commands persistent?

For example: nmcli device modify eth0 ipv4.method auto works but if I reboot the machine this is lost.

I know about interactive nmcli> save but I do not want to use interactive mode and I was not able to find the param neded to save these.

What is the unattended version to perform this manual operations?

nmcli c e eth0
set  ipv4.method auto
set  ipv6.method auto
set  802-3-ethernet.mtu 9000
save persistent
quit

2 Answers 2

3

Sorin,

if you are rebooting and finding the network connection not coming up - it could be the case that you need to set auto-connect to true.

nmcli con mod <connection-name> connection.autoconnect true

Network Manager on Centos 9 Stream places entries in /etc/NetworkManager/system-connections and not /etc/sysconfig/network-scripts, so if you're got a recent version of Linux, don't take network-scripts being empty as an indication that Network Manager hasn't persisted your configuration - it may be that the configuration is persistent but simply not auto-connecting at boot or at any time.

Good luck.

1
  • This worked for me
    – Dave
    Commented Jan 12, 2023 at 18:11
1

I think this should be the äquivalent non-interactive version:

nmcli c m eth0 ipv4.method auto ipv6.method auto 802-3-ethernet.mtu 9000

"save yes" is the default, so you can omit it here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .