Public subnet routing

Jaffa asked:

I have one public IP from my ISP 198.51.100.123/21 and a public 203.0.113.1/29 subnet routed by my ISP through the first IP.
OS: CentOS 7.

I want to assign each IP from the /29 subnet to a virtual NIC. How can I do that?

Thank you.

My answer:


You may edit /etc/sysconfig/network-scripts/ifcfg-e* (whatever it is named on your system) and add the additional IP addresses. For example:

IPADDR=198.51.100.123
PREFIX=21
IPADDR2=203.0.113.1
PREFIX2=29
IPADDR3=203.0.113.2
PREFIX3=29
IPADDR4=203.0.113.3
PREFIX4=29
IPADDR5=203.0.113.4
PREFIX5=29
IPADDR6=203.0.113.5
PREFIX6=29

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.