Modify the IP address of CentOS7

Table of contents

1. Open the network card configuration file

vi /etc/sysconfig/network-scripts/ifcfg-ens33

2. Modify parameters

(1) BOOTPROTO=static #dhcp: automatically assign ip, static: static ip

(2) ONBOOT=yes #Enable startup must be yes

Third, set the IP and mask, etc.

Just add these lines at the end

IPADDR=10.100.100.15 #IP address

NETMASK=255.255.255.0 #mask

GATEWAY=10.100.100.2 #Gateway

DNS1=10.100.100.2 #Domain name server 1

DNS2=8.8.8.8 #Domain name server 2

Then press (1) esc (2) shift+: (3) wq to save and exit

4. Restart the service

systemctl restart network

Guess you like

Origin blog.csdn.net/zhao__b/article/details/129580180