CentOS Stream 9 configure static IP

系统环境:
OS:CentOS Stream 9

CentOS Stream 9Unlike previous versions CentOS, there are no previous network setting related commands, such as:

service network start/restart/status
systemctl start/restart/status network

IPThe configuration file for setting the network card is also /etc/sysconfig/network-scriptno longer found in the directory, so let’s see how to CentOS Stream 9configure static IP. Of course, the easiest way is to open the settings and modify them with a graphical interface. The operation steps are clear at a glance, and will not be described in this article.

1. Open the network card configuration file

CentOS Stream 9Move the network card configuration file in /etc/NetworkManager/system-connections/the directory , open the corresponding network card configuration file:

[imaginemiracle@localhost ~]$ sudo vim /etc/NetworkManager/system-connections/ens192.nmconnection

2. Modify configuration ipv4 item

When the file is opened, the default configuration should be as shown in the figure below:
insert image description here
configure the [ipv4]item as manual mode, and set it to specified IP:
insert image description here

[注]:在配置文件中,不要擅自添加空格,可能会造成无法识别。

3. Reload the network card configuration file

Reload the network card configuration file:

[imaginemiracle@localhost ~]$ sudo nmcli c reload
[imaginemiracle@localhost ~]$ sudo nmcli c up ens192

Use ifconfigthe command to view the configuration information of the network card, and the modification is successful.
insert image description here

This configuration is complete

Help

nmcliOrder
insert image description here

Guess you like

Origin blog.csdn.net/qq_36393978/article/details/127999172