How to set IP in CentOS9

How to set IP in CentOS9

Just for record, I found that there are still huge differences between CentOS9 and my most commonly used CentOS7.X, such as the location of the network card file, the command to restart the network card, the content of the network configuration file, etc., so I recorded it so that I can look it up next time I encounter it, so that I don’t have to use the search engine every time, especially when most of the search results are useless information.

The CentOS9 network card configuration file path is in the /etc/NetworkManager/system-connections/ directory, similar to files such as enp2s0.nmconnection (where enp2s0 is the name of the network card)

As shown above, you can see all the files in the folder. There are as many files as there are network cards on the machine. You can select the corresponding file to modify. For example, the network card we are using here is enp2s0

 [connection]
id=enp2s0
uuid=17562457-5af0-1137-4cea-637e1f345447
type=ethernet
autoconnect-priority=-999
interface-name=enp2s0

[ethernet]

[ipv4]
address1=192.168.1.2/29,192.168.1.1
dns=8.8.8.8;
method=manual

[ipv6]
addr-gen-mode=eui64
method=auto

After modification, save, exit, and restart the network card.

 nmcli c reload # Reload the configuration file nmcli c up enp2s0 # Restart the enp2s0 network card

Note that service and systemctl in centos9 system can no longer be used to operate network cards

<<:  RAKsmart: 35% off all VPS hosting, monthly payment starting from $1.95, CN2/AS9929 available in US/Japan/Korea/Hong Kong/Germany data centers

>>:  BandwagonHost has launched CN2 GIA at a special price starting from $74.5/year, with 1GB/20G SSD/1TB@1Gbps/multiple nodes available

Recommend

A simple introduction to the consensus algorithm Raft

[[417323]] This article is reprinted from the WeC...

Wi-Fi Alliance launches next-generation WPA3 security certification program

[51CTO.com original article] On June 26, the Wi-F...

It’s settled! 5G official logo officially announced

In the 4G era, although "4G" and "...

Several secrets to protect cabling in green data centers

At present, the degree of enterprise informatizat...

RackNerd: San Jose data center VPS promotion starting at $11.88/year

A week ago, we shared RackNerd's promotional ...

Challenges of Deploying Wireless Mesh Networks

Wireless mesh networks have been around since the...

5G is so good, but how many people can afford the data charges?

In the past 2019, with the issuance of 5G commerc...

Where is the future of 5G terminals?

[[400174]] In the 5G era, in order to rapidly adv...

F5: Five trends in enterprise AI applications in Asia Pacific by 2025

Over the past year, I have had the privilege of s...

Talk about Kerberos kinit command and ccache mechanism

1. Introduction Hello everyone, I recently encoun...