Deploying CentOS 9 to Azure...

Issues related to configuring your network
Post Reply
frosty90
Posts: 4
Joined: 2024/03/08 12:09:53

Deploying CentOS 9 to Azure...

Post by frosty90 » 2024/03/08 17:22:43

Hi All,

Firstly thanks for taking the time to look at this! I am quite new to the Linux world.

Scenario

I have been tasked to create a Centos9 Stream (non-GUI) virtual machine within Microsoft HyperV (Generation 2) and configure the VM as per this Microsoft article - https://learn.microsoft.com/en-us/azure ... oad-centos, so that it can be generalized and uploaded to Microsoft Azure, with the attention to create a custom image for us to push within our Azure environment.

Description of Problem:

As part of the Microsoft article, the initial guidelines begin with the general networking config requirements, namely around the ethernet interface. It states that a profile - ifcfg-eth0, be created (or edited if pre-existing) under /etc/sysconfig/network-scripts/

Now, when i initially browsed to this directory i observed the 'readme-ifcfg-rh.txt' advising that network-scripts is now legacy, and since replaced by NetworkManager. After Googling for further info i understand that the entire service is being phased out - any profiles created under the 'network-scripts' should be migrated to NetworkManager key files using nmcli connection migrate

Given this procedure seems to have the potential to be very temperamental, I am trying to follow this article to a tee, therefore i have carried out the following regardless of this advisory to move on to NetworkManager:

1) Created a file (as there was no pre-existing using: touch ifcfg-eth0 /etc/sysconfig/network-services
2) Added the beneath Variables into the file: (this is the full contents of the file as it was not pre-existing)

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=no
NM_CONTROLLED=no

3) Rebooted the server.

Post reboot - the network is broken. I cannot ping anything for example 8.8.8.8.

If i change the NM_CONTROLLED variable to =yes and follow up with a reboot - networking works again. Which does make sense as as it is redirecting things to NetworkManager with that change. It is clear this profile that is causing the issue. If i migrate the profile using the nmcli connection migrate command, the profile is migrated and the network comes back up.

I know that network-services is deprecated, and best practice is obviously to utilize NetworkManager, however in order to satisfy the Microsoft requirements - is there anyway to get things working via network-scripts? When running command sudo systemctl enable network.service it states network.service does not exist. Running sudo yum install network-scripts does not seem to help either, it downloads packages but then fails to install anything, presumably because Centos9 Stream does not wish to push it anymore?

I guess my question is.... am i urinating in the wind here - trying to satisfy a clearly outdated article? When i check the eth0 config under /etc/NetworkManager/system-connections/ post migration - it does not include any of the variables that it supposedly successfully migrated from network-scripts? (See screenshot 'NetManager_migratedconfig')

I am at a bit of a loss, being new to Linux i of course want to adopt best practice - however trying to use this as a basis of an Azure custom image i do need to satisfy Azure pre-requisites also. Any ideas welcome and please if their is any information you need to assist just flag with me!

Thank you for the time,
Mike.
Attachments
NetManager_migratedconfig.png
NetManager_migratedconfig.png (7.52 KiB) Viewed 3898 times
Net_Config_Reqs.png
Net_Config_Reqs.png (47.59 KiB) Viewed 3898 times

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

Re: Deploying CentOS 9 to Azure...

Post by TrevorH » 2024/03/08 17:47:36

CentOS 9 doesn't use files in /etc/sysconfig/network-scripts any more. If you want to set up network connections it's done from .nmconnection files in /etc/NetworkManager/system-connections

However, unless this is for development purposes for deploying the _next_ point release of a RHEL system, you do NOT want to use CentOS Stream for it. Following on from changes announced by Red Hat at the end of 2020, CentOS was effectively abolished and replaced by a beta program which is CentOS Stream. It's a permanent beta and in no way is it suitable for production use. It breaks on a regular basis when RH engineers push untested packages to it.

If you're looking for a clone of RHEL like CentOS used to be then you should look at deploying Alma or Rocky Linux instead. Both these projects aim to carry on from where CentOS left off and produce - as near as possible - clones of RHEL that are suitable for production use.

As for your example ifcfg file, you specify NM_CONTROLLED=no and there is nothing other than NM to do network connections in EL9. The MS article you are attempting to follow is just broken for EL9 systems.
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

frosty90
Posts: 4
Joined: 2024/03/08 12:09:53

Re: Deploying CentOS 9 to Azure...

Post by frosty90 » 2024/03/11 16:15:52

Thank you for the input Trevor, I do agree with what you are saying here.

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

Re: Deploying CentOS 9 to Azure...

Post by jlehtone » 2024/03/12 11:57:29

frosty90 wrote:
2024/03/08 17:22:43
so that it can be generalized and uploaded to Microsoft Azure, with the attention to create a custom image for us to push within our Azure environment.
I'd guess that both AlmaLinux and Rocky Linux do have images for clouds, Azure included.
You could probably spawn instance on Azure from such image and then look what they have put into it.
Furthermore, both distros do have (these days more active) communities -- people to ask about EL9 image creation.

In my limited experience the cloud can either let a guest use DHCP to receive network config from hypervisor,
or inject config on instantiation (or every boot) via cloud-init (a package/tool that is installed in the image).
The cloud-init can/does use NetworkManager to create the config in the instance on RHEL/Alma/Rocky.
If Azure does not use either of those, then what can be said about it?


The NetworkManager does understand both the "initscripts format" and its own ini-style config files.
Up to EL8 the NetworkManager did store most connections in the legacy "initscripts format".
In EL9 that is discontinued. I can't remember whether it still reads from legacy file location too.
The NetworkManager has been the default in RHEL since EL7, so from 2014 ...

frosty90
Posts: 4
Joined: 2024/03/08 12:09:53

Re: Deploying CentOS 9 to Azure...

Post by frosty90 » 2024/05/15 14:56:32

Hi Jlehtone,

Thanks so much for the input, i did in the end do a bit of comparative work and did manage to get something stable deployed, so happy days! It is possible. However i am exploring Rocky Linux also as per the concerns raised by Trevor.

Thanks everyone for their advice on this thread!!

Mike

Post Reply