Re: Reload from Config File



On Sat, 2014-01-04 at 14:01 -0400, Jorge Fábregas wrote:
Hello again,

I created a connection with this:

nmcli con add con-name my-new-em1 ifname em1 type ethernet ip4
192.168.69.101/24 gw4 192.168.69.1

Then I opened the Network Manager GUI and changed to that connection.  I
double checked with "ifconfig em1" and indeed I had 192168.69.101 as my ip.

I then went ahead and manually modified
/etc/sysconfig/network-scripts/ifcfg-my-new-em1 and changed the ip to
192.168.69.107.  Then I tried "systemctl restart NetworkManager" but
ifconfig still shows the old ip.  Shouldn't a restart of NetworkManager
pick-up the changes on the ifcfg file?  Or is there a proper way to
reload the configuration with nmcli?  I tried "nmcli c reload" but
didn't work.  Is manually modifying the ifcfg-* files discouraged?

Manually modifying ifcfg files is definitely supported, though by
default you'll need to use "nmcli con reload" to tell NetworkManager
that you've made a change directly.  (Alternatively, NM can
automatically notice changes if you set "monitor-connection-files=yes"
in the [main] section of NetworkManager.conf).

NetworkManager 0.9 and later try to be better team players in the
system, and will read the existing configuration from a network
interface on startup and use that as a "runtime" connection.  Which is
why your restart didn't apply that changed configuration, because NM
picked up the interface's existing configuration.

To apply changes that you've made, either through the GUI tools or
through direct editing of config files, or through nmcli, you want to do
a "reconnect" cycle:

nmcli dev disconnect em1
nmcli con up my-new-em1

(we have some future plans to allow changes to be made via nmcli and/or
GUI tools at runtime, without bouncing the connection, but those aren't
implemented yet).

Dan



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