Tuesday, June 16, 2009

How to install Bind9 as ENUM Server

How to install BIND9 as ENUM Server on Ubuntu

Why do you need an ENUM server?

ENUM server works like DNS server but it matches Phone number with SIP URI instead of IP and URL. Some IMS Core systems use this kind of resolutions.

Installing BIND9

I'm going to explain this for Ubuntu Server, it is quite easy to install but tricky to configure at the begining.

1) apt-get install bind9

2) After installation succefully completed, go to /etc/bind/ directory. You need to edit following files only.

named.conf
named.conf.options
named.conf.enum (actually we will create it in next step)
db.e164.arpa (actually we will create it in next step)

3) named.conf

add following line

include "/etc/bind/named.conf.enum";

4) named.conf.enum

add following line

zone "e164.arpa" {
type master;
file "/etc/bind/db.e164.arpa";

};

5) db.e164.arpa

$TTL 86400
e164.arpa. IN SOA ns.e164.arpa. root.e164.arpa. (
2004011522 ; Serial no., based on date
21600 ; Refresh after 6 hours
3600 ; Retry after 1 hour
604800 ; Expire after 7 days
3600 ; Minimum TTL of 1 hour
)
e164.arpa. 43200 IN NS ns.e164.arpa.
;
ns.e164.arpa. 43200 IN A 192.168.1.2

0.9.8.7.6.5.4.3.2.1.e164.arpa. NAPTR 10 100 "u" "E2U+sip" "!^.*$!sip:info@example.com!".
0.9.8.7.6.5.4.3.2.1.e164.arpa. NAPTR 10 101 "u" "E2U+h323" "!^.*$!h323:info@example.com!".
0.9.8.7.6.5.4.3.2.1.e164.arpa. NAPTR 10 102 "u" "E2U+msg" "!^.*$!mailto:info@example.com!".
8.1.2.7.5.9.3.3.1.6.1.e164.arpa. NAPTR 100 10 "U" "SIP+E2U" "!^.*$!sip:16133957218@example.com!".

6) named.conf.options

#logging {
# channel query-log {
# file "/var/log/query-log" versions 2 size 10m;
# print-time yes;
# print-category yes;
# };
# category queries { query-log; } ;
#};
#
#options {
# directory "/var/cache/bind";

// If there is a firewall between you and nameservers you want
// to talk to, you might need to uncomment the query-source
// directive below. Previous versions of BIND always asked
// questions using port 53, but BIND 8.1 and later use an unprivileged
// port by default.

// query-source address * port 53;

// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.

// forwarders {
// 0.0.0.0;
// };

# auth-nxdomain no; # conform to RFC1035
#
#};

7) You need to restart bind service

/etc/init.d/bind9 restart

8) Now you can query your request with dig tool

dig @ 8.1.2.7.5.9.3.3.1.6.1.e164.arpa -t NAPTR

You suppose to get following answer

;; ANSWER SECTION:
8.1.2.7.5.9.3.3.1.6.1.e164.arpa. 86400 IN NAPTR 100 10 "U" "SIP+E2U" "!^.*$!sip:16133957218@example.com!" .

I hope you find it useful

Typhoon Master

7 comments:

  1. nice tutorial, just wondering when i run dig @ 8.1.2.7.5.9.3.3.1.6.1.e164.arpa -t NAPTR it doesn't work but when i remove the @ its ok, does that mean i haven't setup my fictional domain properly? thanks

    ReplyDelete
  2. sorry silly question , ignore that I wasn't thinking straight

    ReplyDelete
  3. Sorry for late response, you need to apply that query at application dig, so you realize that already i guess

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hi,

    Nice blog.... and it was useful . And I would
    like to have info on OPT RR with ENUM query and how to configure bind9 to response an OPT query (like NAPTR which you showed up).
    I gone for OPT query because we can send a optional parameter which is used to manipulate the response in ENUM server.

    ReplyDelete
  6. Hi Vimtron,

    I don't have an ENUM server installed in hand right now. I need to check OPT method in related RFC first. Before that you can try to change all NAPTR to OPT in scripts above. It might work but i cannot be sure till i check with RFC. By the way Bind9 manuals doesn't give a clue about that.

    Cheers

    ReplyDelete
  7. hy, typhoon master..

    Thank you very much for your tutorial.
    I want to ask you about using enum server as enum between IMS and NGN softwitch. Where I must configure the enum setting, if I want, the output destination of the enum server is go to IP Address IMS? Is it right if I configure in the named.conf.options, and changed the (forward) line with the IMS IP address?

    forwarders {
    // 0.0.0.0;
    // };

    thanks for your help..

    ReplyDelete