How to add multiple ips in centos 7
By
PrasadNaik
October 22, 2018
In centos 7 by default ifconfig command will not work.
You need to install it using this command yum install net-tools
1. Create a file in /opt/1.sh
2. create ip list in an excel sheet,
Example:
| ip addr add |
|
198.xxx.xx.xx |
|
dev enp6s0f0 label |
|
enp6s0f0:1 |
| ip addr add |
|
198.xxx.xx.xx |
|
dev enp6s0f0 label |
|
enp6s0f0:2 |
| ip addr add |
|
198.xxx.xx.xx |
|
dev enp6s0f0 label |
|
enp6s0f0:3 |
| ip addr add |
|
198.xxx.xx.xx |
|
dev enp6s0f0 label |
|
enp6s0f0:4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3. Add ips in /opt/1.sh file
4. Execute sh 1.sh for the ips to display in ifconfig
5. For the ips to reflect in ifconfig even after server is rebooted add this command sh /opt/1.sh in /etc/rc.d/init.d/network file and it should be added above exit $rc