Thursday, July 3, 2014

Changing ONBOOT value in RHEL/CentOS with networkmanager enabled.

Sometimes the RHEL world has odd things. For example:

If you want to configure a network interface using NetworkManager (without X!!!) you can do it with system-config-network script. From here, you can change the network configuration and DNS/hostname of the box.

What is the problem then?

The network interfaces could be enabled or disabled in boot time. You can see that in the configuration file (etc/sysconfig/network-scripts/ifcfg-<interfacename>) It is something like:
ONBOOT=yes  or ONBOOT=No
But we are talking about using NetwortManager (in that file NM_CONTROLLED=yes) so you cannot edit and change that value directly.

What is the way then?

You go to the famous  system-config-network script and you will discover there is not option to change the ONBOOT value.

WTF!

Well, the way to change this value is very crazy.

You will need export the NetworkManager configuration from terminal:
system-config-network-cmd > export.cfg
Modify the correct line of your network interface. For example:
DeviceList.Ethernet.eth0.OnBoot=False 
to:
DeviceList.Ethernet.eth0.OnBoot=True
Save the file and import it with:
system-config-network-cmd -i < export.cfg
TADAAA!!!

Crazy, i know.


No comments:

Post a Comment