How to assign MACs to OVH failover IPs (script included)

Any failover IP in OVH requires to be assigned to the given MAC, before that, you need to generate the MAC on the OVH client control panel.

If you only have several IPs, it's fine to do it in the panel, but in case you have a /24 block....

There are API methods from OVH official documents, here I'm just sharing a small trick, you can always choose to use the API requests

Firstly, you need to login into the OVH client control panel, then copy the cookies from your browser.

Secondly, you will need to know the server name as well as the IP subnet prefixes.

Finally, swap the info into the script below (in "{}")and run in any Linux servers.

for ipid in {1..255}
do
curl 'https://www.ovh.com/engine/apiv6/dedicated/server/{Your-Server-Name}/virtualMac'
-H 'authority: www.ovh.com'
-H 'accept: application/json, text/plain, */*'
-H 'content-type: application/json;charset=UTF-8'
-H 'origin: https://www.ovh.com'
-H 'referer: https://www.ovh.com/manager/dedicated/'
-H 'cookie: {Your-Browser-Cookies}'
--data-raw '{"ipAddress":"{Your-IP-Subnet-Prefixes}.'"$ipid"'","type":"ovh","virtualMachineName":"{Your-IP-Subnet-Prefix}.'"$ipid"'"}'
--compressed ;
sleep 30
done

Top News