Welcome Guest. Please Login or Register  


You are here: Index > Virtualizor - Virtual Server Control Panel > General Support > Topic : How to use rDNS with OVH/Hetzner



Threaded Mode | Print  

 How to use rDNS with OVH/Hetzner (8 Replies, Read 438 times)
northnetworking
Group: Member
Post Group: Newbie
Posts: 19
Status:
Hello,

I have setup two PDNS server and they are working fine. I added a rDNS to one of my VPS but after a day, when I check the rDNS, the rDNS is still the default one at my provider and not what I set in Virtualizor.

So how do you setup rDNS in Virtualizor to work on IPs that you rent from OVH or Hetzner?

Thanks

-----------------------
Networking made easy
contact[at]northnetworking.com
https://northnetworking.com
IP: --   

How to use rDNS with OVH/Hetzner
wolke
Group: NOC
Post Group: Elite Member
Posts: 273
Status:
How should your provider know what you set in PDNS?
These IP addresses and the rdns entries are managed by your provider, so you need to set the rdns in their controlpanel not in your pdns server.
IP: --   

How to use rDNS with OVH/Hetzner
northnetworking
Group: Member
Post Group: Newbie
Posts: 19
Status:
Exactly my point.

I'm guessing the rDNS in Virtualizor only works when you own the IPs or rent them with the provider announcing the IPs towards you.

-----------------------
Networking made easy
contact[at]northnetworking.com
https://northnetworking.com
IP: --   

How to use rDNS with OVH/Hetzner
wolke
Group: NOC
Post Group: Elite Member
Posts: 273
Status:
Why don´t you use hooks to change the rdns at your provider via API calls?
IP: --   

How to use rDNS with OVH/Hetzner
northnetworking
Group: Member
Post Group: Newbie
Posts: 19
Status:
Yeah, could work. Not sure how to do hooks with Virtualizor tho. I saw the docs on hooks, but from the quick look it only has hooks for after config, after create, before delete, after delete etc?

Could you point me in the right direction?

-----------------------
Networking made easy
contact[at]northnetworking.com
https://northnetworking.com
IP: --   

How to use rDNS with OVH/Hetzner
wolke
Group: NOC
Post Group: Elite Member
Posts: 273
Status:
At master, create a file editvs.php in /usr/local/virtualizor/hooks

I made an example with hetzner webservice API (need to create a user for that in hetzner robot):

PHP Code

<?php
function __editvs($old_vps$new_vps){
#Hetzner Curlcall:#curl -u user:password https://robot-ws.your-server.de/rdns/[IP] -d ptr=[HOSTNAME] -X PUT}
# Translated into PHP curl:

$ch curl_init();

//we take the first value from $new_vps['ips'] => reset
curl_setopt($chCURLOPT_URL'https://robot-ws.your-server.de/rdns/'.reset($new_vps["ips"]));
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_CUSTOMREQUEST'PUT');
curl_setopt($chCURLOPT_POSTFIELDS"ptr=".$new_vps['hostname']);curl_setopt($chCURLOPT_USERPWD'YOURWEBSERVICEUSER' ':' 'YOURWEBSERVICEPASSWORD');
$headers = array();$headers[] = 'Content-Type: application/x-www-form-urlencoded';curl_setopt($chCURLOPT_HTTPHEADER$headers);
$result curl_exec($ch);
if (
curl_errno($ch)) {    echo 'Error:' curl_error($ch);}
curl_close($ch);
?>


I did not test this, but it should be enough to point you into the right direction.
remember to change your username and password in this example and to secure access to your webservice user by setting Ip restriction in the robot.


Edited by wolke : November 18, 2019, 2:50 pm
IP: --   

How to use rDNS with OVH/Hetzner
northnetworking
Group: Member
Post Group: Newbie
Posts: 19
Status:
Thank you!

How well does it work when you have both Hetzner and OVH? Will the editvs.php be able to handle both?

-----------------------
Networking made easy
contact[at]northnetworking.com
https://northnetworking.com
IP: --   

How to use rDNS with OVH/Hetzner
wolke
Group: NOC
Post Group: Elite Member
Posts: 273
Status:
In that case you need to verify first which provider is in charge for the given IP and then call the specific providers API.

IP: --   

How to use rDNS with OVH/Hetzner
wolke
Group: NOC
Post Group: Elite Member
Posts: 273
Status:
Found that example too buggy to be useful. Made a working one (just replace username and password obviously) which works right away with hetzner (using their php client).
You can download the php client directly from hetzner at:
https://robot.your-server.de/downloads/robot-client.zip
or just use the ready template attached to this posting.Take care not to overwrite your editvs.php file if you are already using it.
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is December 13, 2019, 10:37 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.271