Add IPv6 address to IP Manager via command-line

Daniel-Doggy

Verified User
Joined
Nov 16, 2019
Messages
462
Hello everyone,

I am currently tweaking my DirectAdmin automatic installation script.
At the moment DirectAdmin only adds the IPv4 address of the server to the IP Manager and does not add the IPv6 address of the server as well.

So this means that every time I deploy a server I need to manually add its IPv6 address to the IP Manager and link it to the IPv4 address by hand.
While this is not the end of the world, it is very time consuming when I reinstall DirectAdmin multiple times a day on my test VM. (Delete VM and clone VM from template.)

So I was wondering if it is possible to add an IP address to the IP Manager via the command-line. (Since the docs only say to login into the web panel and do it via the GUI.)

Thanks in advance.
 
To link (v6 to IPv4, NOT the other way around), DA makes a POST containing this request to: /CMD_IP_MANAGER_DETAILS?json=yes

Code:
{"ip":"i.p.v.4",
"ip_to_link":"i:p:v:6:h:e:r:e",
"dns":"yes","apache":"yes","apply":"yes",
"json":"yes","action":"add","background":"yes"}

This was successful and got the response you see in the GUI:

Code:
{
    "result": "",
    "success": "IP will be linked in the background"
}

Un-linking is via the same endpoint /CMD_IP_MANAGER_DETAILS?json=yes

Code:
{"select0":"0:0:0:0:0:0:0:0",
"ip":"1.1.1.1","rewrite_apache":"yes",
"flush_dns":"yes","json":"yes","action":"select","remove":"yes"}

Before that, you have to add the IPv6 from the Linux network device it's already configured on, via: /CMD_IP_MANAGER?json=yes

Code:
{"ip":"0:0:0:0:0:0:0:0",
"netmask":"ffff:ffff:ffff:ffff:ffff:ffff:0:0",
"add_to_device":"no","json":"yes","action":"add","add_to_device_aware":"yes"}

Removal of an IP is also via /CMD_IP_MANAGER?json=yes

Code:
{"select0":"fe80:0:0:0:0:0:0:0",
"json":"yes","action":"select","delete":"yes"}
 
For API requests you might try /CMD_API_IP_MANAGER
That's fantastic, thank you!

Is there a way to get write access to docs.directadmin.com so I can contribute improvements somehow without bugging support?

Find there are some very long pages which have expanses of valuable info nested. Could be optimised, and a lot from the forum and changelogs seems to be critically valuable - like with the Link IP docs having wrong wording at the moment with v4-to-v6 vs v6-to-v4 linking (NOK vs OK).
 
Back
Top