Disabling the network initialization during boot in centos7.6

Issues related to configuring your network
Post Reply
ankubisht
Posts: 3
Joined: 2019/03/06 16:56:50

Disabling the network initialization during boot in centos7.6

Post by ankubisht » 2019/03/06 17:02:14

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?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

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

Post by TrevorH » 2019/03/06 17:16:27

Actually the solution is to make sure that they do exist and contain "ONBOOT=no"
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

ankubisht
Posts: 3
Joined: 2019/03/06 16:56:50

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

Post by ankubisht » 2019/03/07 05:52:30

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 ?

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

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

Post by jlehtone » 2019/03/07 06:53:37

What do you want to achieve with that?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

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

Post by TrevorH » 2019/03/07 07:23:33

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

ankubisht
Posts: 3
Joined: 2019/03/06 16:56:50

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

Post by ankubisht » 2019/03/11 09:21:05

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.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

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

Post by jlehtone » 2019/03/11 14:45:11

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.

Post Reply