Tuesday, 28 October 2008

UK Second Level Domain DNS Architecture

The UK's TLD (.uk) is spread across 11 DNS servers, as follows: ns1.nic.uk to ns7.nic.uk, then nsA.nic.uk to nsD.nic.uk. Although very few domains actually use the TLD directly, most use second level domains, most commonly .co.uk.

The second level domain, .co.uk, is balanced accross the same 11 DNS servers as the TLD, .uk. The same configuration is also used for ltd.uk, .me.uk, .net.uk, .nic.uk, .org.uk, .plc.uk, and .sch.uk.

Alternative configurations are used for .ac.uk, using ns0.ja.net to ns4.ja.net, and the following servers: sunic.sunet.se, ns.uu.net, ws-fra1.win-ip.dfn.de and ns1.cs.ucl.ac.uk.

The second level domain .gov.uk uses the same five ja.net DNS servers as ac.uk, and the UCL server, it also uses auth50.ns.de.uu.net, auth00.ns.de.uu.net and ns1.surfnet.nl

The Ministry of defence second level domain mod.uk, uses only three DNS servers. relay.mod.uk, ns1.nic.uk and the DNS server at UCL used for .ac.uk and .gov.uk.

The National Health service second level domain, nhs.uk, is served by two DNS nodes, nsa.nhs.uk and nsb.nhs.uk

The police force second level domain, police.uk, seems unrelated to the other uk domain names, using totally different DNS servers as follows: ns2.psops.net, ns0.cwci.net, chtdns1.cwci.net, ns1.psops.net, and ns1.cwci.net

Thursday, 18 September 2008

Aruba Registration services

redirect en 5

English: Aruba is one of the biggest Italian internet services provider. Aruba offers web domains, web hosting, dedicated servers and web connection

Saturday, 9 August 2008

Plesk Interface in PHP



Our initial Design of FreeNameServers.co.uk used PLESK as a back-end DNS provider, we moved away from this model for licensing issues, however, the PHP interface was already developed, so this is included below for anyone who is looking to automate their plesk DNS system.

<?php

define("HOST", "localhost");
define("PORT", 8443);
define("PATH", "enterprise/control/agent.php");
define("LOGIN", "admin");
define("PASSWD", "xxxxxxx");
define("PROTO_VER", "1.3.1.0");


$proto = PROTO_VER;
$action=$_GET['action'];
$domain=$_GET['domain'];
$host=$_GET['host'];
$type=$_GET['type'];
$value=$_GET['value'];
$opt=$_GET['opt'];
$domain_id=NULL;
$record_id=NULL;

//retrieve the domain id
if ( $action != 'adddomain' && $action !='listdomains' ) {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<domain>
<get>
<filter/>
<dataset>
<gen_info/>
</dataset>
</get>
</domain>
</packet>
EOF;

sendCommand(get_domid);
}

switch ( $action ) {

case 'listdomains':
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<domain>
<get>
<filter/>
<dataset>
<gen_info/>
</dataset>
</get>
</domain>
</packet>
EOF;
sendCommand(print_response);
break;

case 'adddomain':
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<domain>
<add>
<gen_setup>
<name>$domain</name>
<client_id>1</client_id>
<ip_address>62.233.105.208</ip_address>
</gen_setup>
</add>
</domain>
</packet>
EOF;

sendCommand(print_response);
break;

case 'removedomain':
if ( $domain_id ) {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<domain>
<del>
<filter>
<id>$domain_id</id>
</filter>
</del>
</domain>
</packet>
EOF;
sendCommand(print_response);
} else {
echo "Error: domain $domain not found in the database<br>";
}
break;

case 'listrecords':
if ( $domain_id) {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<dns>
<get_rec>
<filter>
<domain_id>$domain_id</domain_id>
</filter>
</get_rec>
</dns>
</packet>
EOF;
} else {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<dns>
<get_rec>
</get_rec>
</dns>
</packet>
EOF;
}
sendCommand(print_response);
break;

case 'addrecord':
switch ( $type ) {
case 'A':
case 'CNAME':
case 'TXT':
case 'NS':
case 'MX':
if ( $opt) {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<dns>
<add_rec>
<domain_id>$domain_id</domain_id>
<type>$type</type>
<host>$host</host>
<value>$value</value>
<value>$value</value>
<opt>$opt</opt>
</add_rec>
</dns>
</packet>
EOF;
} else {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<dns>
<add_rec>
<domain_id>$domain_id</domain_id>
<type>$type</type>
<host>$host</host>
<value>$value</value>
</add_rec>
</dns>
</packet>
EOF;
}
sendCommand(print_response);
break;
default:
echo "Error: unknown record type $type<br>";
break;
}
break;

case 'removerecord':
//retrieve the record id
if ( $domain_id) {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<dns>
<get_rec>
<filter>
<domain_id>$domain_id</domain_id>
</filter>
</get_rec>
</dns>
</packet>
EOF;
} else {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<dns>
<get_rec>
</get_rec>
</dns>
</packet>
EOF;
}
sendCommand(get_recid);

//remove the record
if ( $record_id ) {
$data =<<<EOF
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<packet version="$proto">
<dns>
<del_rec>
<filter>
<id>$record_id</id>
</filter>
</del_rec>
</dns>
</packet>
EOF;
sendCommand(print_response);
} else {
echo "Error: the specified record not found in the database<br>";
}
break;

default:
echo "Error: unknown action $action<br>";
break;
}

//handles the response. This default handler simply prints the response.
function print_response($ch, $data)
{
echo $data;
return strlen($data);
}

//handles the response. This handler extracts the domain id that corresponds $domain
function get_domid($ch, $data)
{
global $domain;
global $domain_id;
$xml = new SimpleXMLElement($data);
foreach ($xml->xpath('/packet/domain/get/result') as $result) {
if ( $result->data->gen_info->name == "$domain" ) { $domain_id = $result->id; }
}
return strlen($data);
}

//handles the response. This handler extracts the record id that corresponds search conditions
function get_recid($ch, $data)
{
global $host;
global $type;
global $value;
global $opt;
global $record_id;
$xml = new SimpleXMLElement($data);
foreach ($xml->xpath('/packet/dns/get_rec/result') as $result) {
if ( $result->data->host != "$host" ) { continue; }
if ( $result->data->type != "$type" ) { continue; }
if ( $result->data->value != "$value" ) { continue; }
if ( $opt ) { if ( $result->data->opt != "$opt" ) { continue; } }
$record_id = $result->id;
}
return strlen($data);
}

//sends the request to plesk and call the response handler
function sendCommand($handler)
{
$url = "https://" . HOST . ":" . PORT . "/" . PATH;
$headers = array(
"HTTP_AUTH_LOGIN: " . LOGIN,
"HTTP_AUTH_PASSWD: " . PASSWD,
"HTTP_PRETTY_PRINT: TRUE",
"Content-Type: text/xml",
);

// Initalize the curl engine
$ch = curl_init();

// Set the curl options
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// this line makes it work under https
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, &$headers);

// Set the URL to be processed
curl_setopt($ch, CURLOPT_URL, $url);

// Set the callback functions
curl_setopt($ch, CURLOPT_WRITEFUNCTION, $handler);

// Set the data to be send
global $data;
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

// Debug, however...
curl_setopt($ch, CURLOPT_VERBOSE, 1);

$result = curl_exec($ch);

if ($result == CURL_OK) {
#print_r(curl_getinfo($ch));
} else {
echo "\n\n-------------------------\n" .
"cURL error number:" .
curl_errno($ch);
echo "\n\ncURL error:" . curl_error($ch);
}

curl_close($ch);

return;
}
?>

Friday, 8 August 2008

About FreeNameServers.co.uk


FreeNameServers.co.uk, is a website that gives free public access to two live DNS servers. This allows people to set up DNS for their website, if their webhost or registrar does not provide it for them. It also can be used to add extra redundancy to a website, that has experienced DNS resolution problems in the past.

FreeNameServers is a website developed by Open Merchant Account Ltd, a company perhaps more known for it's Sage components and SMS websites. However, for once this venture is entirely philanthropic. Our kind of Corporate social responsibility so to speak. Giving something back to the internet in the form of something genuinely useful, and genuinely free.

Is this service reliable?, is probably one of the main questions you may ask. And I guess we'd be as reliable as most other webhost's DNS systems. In the IT world computers can fail without warning, and we do have redundancy on 2 DNS servers, which is the norm. If you need more than that, then try DynDns.org, they offer 5 DNS server redundancy.