Euler server specifies static IP openeuler fixed ip address

start up

Log in as the root account

View network card IP

ip addr

insert image description here
See that the corresponding name is eno4

Modify the configuration file (also by command)

Method 1 (configuration file method)

Go to the configuration folder location

cd /etc/sysconfig/network-scripts

insert image description here

edit configuration file

vi ifcfg-eno4
# 修改为如下内容
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes # 这里修改为yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno4
UUID=105f2DD7-8723-45cf-8961-d8b0b434ec3b
DEVICE=eno4
ONBOOT=yes
IPADDR=192.168.10.15 # 改为要固定的ip地址,不要和局域网其他ip重复
PREFIX=24
GATEWAY=192.168.10.254 # 配置网关
DNS1=218.85.152.99 # 配置dns解析
DNS2=218.85.157.99 # 配置dns解析
BOOTPROTO=none
PEERDNS=no
IPV6_PRIVACY=no

save and exit

输入:ew
回车

way two

Refer to official website documents

Reload to make the configuration take effect

Method 1: Enter the reload command

systemctl reload NetworkManager

如果reload没生效, use the following command

# 停止
systemctl stop NetworkManager
# 重启
systemctl restart NetworkManager

Method 2: Restart the machine

reboot

verify

Use the ssh tool to connect to the specified ip test. If the following information appears, it means success. You can also use other tools (such as SSH session in idea)
insert image description here

Guess you like

Origin blog.csdn.net/qq_41070393/article/details/126932108
Recommended