Page 1 of 1

Disabling the network initialization during boot in centos7.6

Posted: 2019/03/06 17:02:14
by ankubisht
Hi,

I am poring centos6.5 to centos7.6 in my storage project. I am facing one issue related to eth0 and eth1 initialization. I dont want to initialize eth0 adneth1 during boot i.e. the ifcfg-eth0 and ifcfg-eth1 files should not be present in /etc/sysconfig/network-scripts/ folder.
How to avoid the creation of ifcfg-eth0 and ifcfg-eth1 during boot?
or who initializes these config files during boot?

Re: Disabling the network initialization during boot in centos7.6

Posted: 2019/03/06 17:16:27
by TrevorH
Actually the solution is to make sure that they do exist and contain "ONBOOT=no"

Re: Disabling the network initialization during boot in centos7.6

Posted: 2019/03/07 05:52:30
by ankubisht
Thhe "ONBOOT" option is available inside ifcfg-ethX file. But i dont want to create the ifcfg-ethX file itself. The network config file should be created when i select the dhcp/static option for networking. In a first boot i want networking to be disabled. Is there any option for that ?

Re: Disabling the network initialization during boot in centos7.6

Posted: 2019/03/07 06:53:37
by jlehtone
What do you want to achieve with that?

Re: Disabling the network initialization during boot in centos7.6

Posted: 2019/03/07 07:23:33
by TrevorH
I think you need to explain what you're trying to achieve and why. The correct way to stop an interface from being started is by adding ONBOOT=no to its ifcfg file.

Re: Disabling the network initialization during boot in centos7.6

Posted: 2019/03/11 09:21:05
by ankubisht
Thanks @TrevorH. Basically the purpose was to keep the networking disabled for customized linux based OS. Later through UI only we wanted to enable networking with dhcp/static.
I did it through command "systemctl disable network.service" during flashbuild of OS. its working fine now.

Re: Disabling the network initialization during boot in centos7.6

Posted: 2019/03/11 14:45:11
by jlehtone
What made you think that lack of configuration file would be the proper approach?

Yes, everything used to be static. For example, the X11 did depend on monolithic config file. One syntax error and you had the pleasure of no GUI. However, the X11 has become "smart"; its defaults are sufficient for most and thus no config file is necessary.


CentOS 7 has two services that manage networking: network.service and NetworkManager.service. The latter is the default. If disabling one of them "solves" your issue, then you probably don't have the other.


However, having the service up or down is semi-independent of how the connections are configured.

Lets say that there are connections (there are, by default) and they are set to start (they are, by default). When you start the service, the connections come up. They might not be in the mode that you desire.

The alternative is to have the service enabled all the time and connections disabled by default. That you can set in kickstart install (somehow). That gives you best chance to reconfigure connections to your tastes before you start them.