1 First, check the IP address of the existing network card and run the following command with the root privilege:
IP addr
From the details above, it can be seen that the network card name of the server is eno16777736 and the IP address is 192.168.22.227.
The configuration file of the network card is stored in the /etc/sysconfig/network-scripts/ directory. The details of each network card will be stored under different names, such as ifcfg-eno16777736.
2 Open this profile and add another IP address
Edit file /etc/sysconfig/network-scripts/ifcfg-eno16777736:
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
Add an additional IP address as below.
This adds an IP address: IPADDR1=192.168.22.231 Of course, more IP addresses can also be added.
IPADDR2=192.168.22.232
IPADDR3=192.168.22.233
IPADDR4=192.168.22.234
......
Finally, save and exit the file. Shortcut: shift+z+z
Restart the network service to make the changes take effect.
systemctl restart network
3 Check if the IP address has been added.
Enter the command:
IP addr
As you can see, a single network card already has 2 IP addresses.