Add IP to centos system
vi /etc/sysconfig/network-scripts/ifcfg-eth0
An IP address is added: IPADDR1=192.168.22.231. Of course, more IP addresses can also be added.
IPADDR2=192.168.22.232
Finally, save and exit the file. Shortcut key: shift+z+z
Restart the network service for the changes to take effect.
systemctl restart network
③ Check whether the IP address has been added.
Enter command:
ip addr
How to add an IP in Centos7.6
1. Log in to the virtual machine
![How to add IP-2892 in Centos7.6](https://www.zoneidc.com/uploads/image/20230519/16844615932316404.png)
2. Enter the command:
cd /etc/sysconfig/network-scripts/
3. Re enter the command:
![How to add IP-2893 in Centos7.6](https://www.zoneidc.com/uploads/image/20230519/16844616047879332.png)
4. Modify the network card configuration: vi ifcfg-eth0
![How to add IP-2894 in Centos7.6](https://www.zoneidc.com/uploads/image/20230519/16844616102951414.png)
5. Click keyboard i to add a new IP address. For different gateways, you need to enter corresponding gateways, and for different masks, you need to enter different masks
![How to add IP-2895 in Centos7.6](https://www.zoneidc.com/uploads/image/20230519/16844620144476865.png)
6. Click the keyboard esc,
Enter wq!
Exit Save
![How to add IP-2896 in Centos7.6](https://www.zoneidc.com/uploads/image/20230519/16844620191086484.png)
7. Restart the network card
service network restart
that will do
![How to add IP-2897 in Centos7.6](https://www.zoneidc.com/uploads/image/20230519/16844620233725400.png)