OVH vRACK - Cloud images comparability

Terminatrix

New Member
Aug 23, 2021
18
1
3
32
The problem I am facing with OVH vRACK IP blocks and Generic Cloud images is each IP block has it's own gateway IP and may have a different netmask (depending on block sizes).

Example block 51.xx8.1xx.64/28

Code:
Network IP              : 51.xx8.1xx.64
Gateway IP              : 51.xx8.1xx.78 (not usable)
Broadcast IP:          : 51.xx8.1xx.79

Then use the sub-netmask 255.255.255.240.

for CentOS 7 I would need to configure the virtual machine as follows

/etc/sysconfig/network-scripts/ifcfg-eth0

Code:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
NETMASK=255.255.255.240
IPADDR=51.xx8.1xx.72
ARP=yes

/etc/sysconfig/network-scripts/route-eth0
Code:
51.xx8.1xx.64/28 dev eth1 table vrack
default via 51.xx8.1xx.78 dev eth1 table vrack

How could I do this? I guess I could run a script after cloud-init to read the gateway and paste it into /etc/sysconfig/network-scripts/route-eth0 but I can't think of how I would get the correct netmask.