Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

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
Thanked by 2srvjap jar

Comments

  • hellb0yhellb0y Member
    edited October 2021

    !/usr/bin/env python

    -- encoding: utf-8 --

    '''
    First, install the latest release of Python wrapper: $ pip install ovh
    '''

    import os
    import sys
    import json
    import ovh

    serverid = sys.argv[1]
    ip = sys.argv[2]
    mac = sys.argv[3]
    vm = sys.argv[4]

    client = ovh.Client(
    endpoint='ovh-eu',
    application_key='XXXXXXXXXX',
    application_secret='XXXXXXXXXXXXXXXX',
    consumer_key='XXXXXXXXXXXXXXXXXXXX',
    )

    client = ovh.Client()
    result = client.post('/dedicated/server/%s/virtualMac/%s/virtualAddress' % (serverid,mac),
    ipAddress=ip,
    virtualMachineName=vm,
    )

    Pretty print

    print json.dumps(result, indent=4)

    Thanked by 1wiseocean
  • ./ovhmac serverid ipv4 macaddress description

  • Easiest way is to use API instead of someone kind of developing web browser

Sign In or Register to comment.