Linux command line interface adds multiple IPs

After SSH connection login:
enter cd /etc/sysconfig/network-scripts

Generally, the first one is the default IP editing file of the system. Some systems will have multiple connections. The newly opened VPS on X36 will have 4 connections, that is, there are 5 files starting with ifcfg, and ifcfg-lo is the loopback port. It is best to enter the file editing VI to see which file has the initial default IP, and modify it in this file!

vi ifcfg-7i24NIC
enter this configuration file and


add Ip configuration command:
IPADDR2=103.255.177.88
PREFIX2=24
IPADDR3=103.255.177.89
PREFIX3=24
IPADDR4=103.255.177.90
PREFIX4= 24 IPADDR5=103.255.177.91 PREFIX5=24 IPADDR4
=103.255.177.90
PREFIX4=24
177.92
PREFIX6=24
IPADDR7=103.255.177.93
PREFIX7=24

Rule:
Add the nth IP
command:
IPADDRn=xxx.xxx.xxx.xxx
PREFIXn=24

Save and exit
: wq!
Restart the network card
service network restart

At this point, all new IPs can be pinged. Other online tutorials are basically new connection configurations, this tutorial is to add multiple IPs under the same link!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326409435&siteId=291194637
Recommended