Search Computer Help Please

Monday, November 23, 2009

Setup ENUM Server with Linux and Bind9

This post will go through the steps for setting up a simple ENUM (Electronic Number Mapping) server on ubuntu linux operating system.

The basic idea behind ENUM is to map your regular E.164 telephone numbers to domain zone files for example your number 98997867 may become 7.6.8.7.9.9.8.9.e164.arpa. Each enum number is given its own zone file which contains a variety of contact methods available for that number. These records are referred to as NAPTR records.

Financial Savings of ENUM

The main reason ENUM exists is to try and connect the IP networks with the telephone networks, with the main objective of avoiding the PSTN (public switch telephone network) and the high costs associated with using these services and termination fee's.

Bind9 DNS Records in Ubuntu

This quick tutorial will go through setting up a simple bind9 enum server capable of hosting an number of records for enum numbers. If your planning on setting up a proper enum server I will cover this topic later on, and how you can hook it up to your Asterisk PBX.

Install Bind9

First ensure you are in root mode using "sudo su"
apt-get -y install bind9

Once bind9 is installed all files and information for bind9 will be found in the directory /etc/bind

once you are in the directory "cd /etc/bind"

you are ready to modify and create the zone files for your enum domain in this example the domain being e164.org

named.conf
named.conf.options
named.conf.enum
db.e164.org

1.) modify named.conf

Modify the file named.conf , using your preferred editor (e.g nano named.conf, or vim named.conf)

Add the following line to the file

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

This just specifies that the file named.conf.enum will be used to store DNS information used by bind9

2.) Create named.conf.enum (simply edit the file and a new file will be created)

Add the following line to the file, ensuring that the format stays intact

add following line

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

};

Here we specify the name of the zone , the type of server (e.g master, slave) and the file that contains the information for the zone.

3.) Create file db.e164.org

add the following to db.e164.org

TTL 86400
e164.org. IN SOA ns.e164.org. root.e164.org. (
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.org. 43200 IN NS ns.e164.org.
;
ns.e164.org. 43200 IN A 192.168.1.2

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

The file contains information for the zone e164.org on the private enum server.

at the very bottom of the zone file contains the enum zone files and naptr contact methods associated with the zones.

The first one is E2U or e164 to URI type of NAPTR record which returns a sip uri of info@example.com, this is the URI that will later be used by your Asterisk PBX.


TESTING AND TROUBLESHOOTING

Remember whenever changes are made to zone files the naming service needs to restarted to apply the changes using

/etc/init.d/bind9 restart

To test an ENUM record use the DIG tool

dig @ 8.1.2.7.5.9.3.3.1.6.1.e164.org -t NAPTR

this will return an answer section containing the sip URI
16133957218@example.com


Note: Any problems you may have such as bind9 not restarting correctly or returning a fail are usually due to incorrect format being used or missing zone files.

always check your /var/log/syslog for errors when troubleshooting


Hope people find this useful, in my next posts I will talk about hosting a private domain name to serve enum records within a private network (I-ENUM private) , as well as testing enumlookup using Asterisk 1.4, 1.6.

I may also cover how to setup a more efficient DNS server using powerdns or similar tools which use databases instead of individual files to store zone records.


7 comments:

  1. good mini howto hope asterisk+enum :)

    ReplyDelete
  2. thanks a lot for the info given

    ReplyDelete
  3. Is it possible, not to get additional information in the NAPTR DNS response packet?

    Additional information contains the SVR records.

    Is there any configuration required in config file.

    Please help. Thanks in advance.

    ReplyDelete
  4. you write

    ns.e164.org. 43200 IN A 192.168.1.2

    what IP is this? Is this IP address of the destination (output) of enum server?

    ReplyDelete
  5. 192.168.1.2 was the ip address of the enum server in this example

    ReplyDelete
  6. and what is the 43200 please

    ReplyDelete
  7. 16133957218@example.com!". Where does this number come from ?

    ReplyDelete

Computer Help Please