How to set Linux static IP

Before modification, first query your own subnet IP in NAT connection mode
Insert picture description here

登录***root***账户
进入终端

输入 cd /etc/sysconfig/network-scripts/
输入vim ifcfg-ens33

Insert picture description hereInsert picture description hereModify BOOTPROTO=static (it does
not matter if you add "" after the equal sign) ONBOOT must be equal to yes, then change it.

Add the following information at the end. The
Insert picture description hereblue box is consistent with the subnet ip. The
green box is 2 unchanged. The
black box can be customized (note the rules)

Then press esc and enter: wq to exit.
If you can't change this file, please change it with root privileges

Enter the systemctl restart network configuration file in the terminal to take effect.

Guess you like

Origin blog.csdn.net/Kruskual/article/details/108286566