nameres 


 

 NAME RESOLUTION EXTENSION FOR KERNEL AODV

 

INTRODUCTION

This site presents an implementation of the RFC draft draft-engelstad-manet-name-resolution-01 for Kernel AODV (NIST) as well as a dns proxy solution to render the name request transparent to user applications. The dns proxy is based on dnrd. The code proposed is experimental and the example discussed below is the only one that have been tested so far.

PHILOSOPHY

The figure below illustrates the different steps needed to resolve a name using the name request extension as implemented in this project:



philosophy 


  1. A user applicatin wants to communicate with the host whose name is uml03.lln.rc. Typically, the user application calls the function gethostbyname which in turns try to resolve the given name according to the configuration file /etc/host.conf. If the resolver is configured for using a dns server (order bind), the configuration file /etc/resolv.conf is inspected to find the ip address of the server to which the dns query should be send.
  2.  In our setup,  resolv.conf is setup for using the local host as a name server (nameserver 127.0.0.1) and the dns query is send via the loopback device. The structure of the dns query is described in RFC1035 and does not need to be modified. This allow for using unmodified resolver library on the system.
  3. The proxy dns finds out that this query has to be answered via the name request extension according to some switch on the command line. The proxy dns daemon may be started with the "--nameres" switch which specifies what domain has to be resolved through this method. The syntax is "-n int1,..intn(:domain)"   where "int1,...,intn" are the interfaces to send the request to and "domain" specifies which names belong to the aodv domain. In our example, the line would read "dnrnd -n eth0:rc". If no domain is specified, the name request extension is the default method. In conjonction with other switches already available in dnrd, this  allow for using this system to resolve name belonging to the aodv domain along with other fully qualified domain names existing on the internet (through the -s switch, not tested). This also allows for other hosts on the internet to resolve name in the aodv domain by using the proxy as their name server. The original dns query is stored in the proxy and a route request (RREQ) and name resolution extension (NREQ_EXT) are forged and broacasted. The destination entry in the RREQ is set to 255.255.255.255 to ensure that no intermediary node may reply to this request.
  4. Intermediary nodes receive this request and process the extension if they understand it. If not, the method still works provided that the RREQ is forwarded with the extension (this is not the case for the unmodified kaodv code which drops the packet because it is too long, a simple patch fixes this problem and makes aodv transparent to extension).
  5.  If the name is not the name of that intermediary node and as the requested address is not in the routing table, the RREQ is forwarded with the extension.
  6. The RREQ eventually reaches the node  whose configured name matches the name requested (each node find its own name in the /proc/sys/kernel/hostname and /proc/sys/kernel/domainname ). If this is the case, the destination ip in the RREQ is changed to the ip of the interface from which the request comes. As the extension is processed before the RREQ is analysed, later processing of the request will result in the generation of a route reply (RREP) to which a name reply extension (NREP_EXT) is appended in response to the NREQ_EXT. 
  7. This packet is then unicasted to the source which originated the request. This method therefore presents a very low traffic overhead impact as the name resolution results in the creation of a route between the source and the destination which would have been established by broadcasting a RREQ anyway. As the RREQ makes its way toward the source, the name resolution is cache in intermediary nodes. The resolved names are available via a /proc interface in /proc/aodv/name_res. (proxy reply is not implemented)
  8. The proxy dns server receives the name reply by listening on a netlink socket which multicast every name request the kernel receives. The reception is therefore asynchronous and multiple application may register to this multicast group to be informed of new name resolutions. The proxy dns finds the original dns query that was stored during the name resolution process and forges a dns reply using the information received from the kernel and on fields available in the query.   

A SIMPLE EXAMPLE

This example documents the steps required to test the simple example described above.

Configuring the switch daemon.

Two "switch daemons" are used to obtain two separated broacast domains.
uml_switch -unix /tmp/vlan0
uml_switch -unix /tmp/vlan1

Starting uml

Linux must be compiled with the necessary options for kernel_aodv and three cow files must be available. I use the the file system Debian-3.0r0.ext2.bz2 available at the user mode linux site. I have added a couple of utilities such as the 'ip' command, tcpdump... In some cases you can use the utilities from your host via /mnt if the required libraries are available on the uml.

linux umid=uml01 ubd0=cow1 eth0=daemon,,unix,/tmp/vlan0 devfs=nomount
linux umid=uml02 ubd0=cow2 eth0=daemon,,unix,/tmp/vlan0 eth1=daemon,,unix,/tmp/vlan1 devfs=nomount
linux umid=uml01 ubd0=cow1 eth0=daemon,,unix,/tmp/vlan1 devfs=nomount

Configuration of the machines

The path are given as example, they should be change to reflect the actual configuration

    uml01

#configure the interface
ip addr add dev eth0 192.168.0.1/24
ip link set dev eth0 up
ip addr add dev lo 127.0.0.1/8
ip link set dev lo up

#mount the host file system
mount none /mnt -t hostfs

# setup your name
echo lln.rc > /proc/sys/kernel/domainname
echo uml01 > /proc/sys/kernel/hostname

# insert aodv module
insmod /mnt/var/uml/checkout/kaodv/kernel_aodv.o

#start the dns proxy
/mnt/var/uml/checkout/dnrd-2.10/src/dnrd -n eth0:rc

    uml02

#configure the interface
ip addr add dev eth1 192.168.1.2/24
ip addr add dev eth0 192.168.0.2/24
ip link set dev eth0 up
ip link set dev eth1 up
ip addr add dev lo 127.0.0.1/8
ip link set dev lo up

#mount the host file system
mount none /mnt -t hostfs

# setup your name
echo uml02 > /proc/sys/kernel/hostname
echo lln.rc > /proc/sys/kernel/domainname

#enable ip forward
echo 1 > /proc/sys/net/ipv4/ip_forward

# insert aodv module
insmod /mnt/var/uml/checkout/kaodv/kernel_aodv.o

#start the dns proxy
/mnt/var/uml/checkout/dnrd-2.10/src/dnrd -n eth0,eth1:rc

    uml03

#configure the interface
ip addr add dev eth0 192.168.1.1/24
ip link set dev eth0 up
ip addr add dev lo 127.0.0.1/8
ip link set dev lo up

#mount the host file system
mount none /mnt -t hostfs

# setup your name
echo lln.rc > /proc/sys/kernel/domainname
echo uml03 > /proc/sys/kernel/hostname

# insert aodv module
insmod /mnt/var/uml/checkout/kaodv/kernel_aodv.o

#start the dns proxy
/mnt/var/uml/checkout/dnrd-2.10/src/dnrd -n eth0:rc

The system in action

uml01:~# ping uml03.lln.rc

PING uml03.lln.rc (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=63 time=1.9 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=63 time=1.6 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=63 time=1.6 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=63 time=1.6 ms

--- uml03.lln.rc ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 1.6/1.6/1.9 ms

#What we see in the log at uml01

Received nrep extension, type=3, lenght=18, num_ad=1, name=uml03.lln.rc
nrep with ip_src=192.168.0.2,ip_dest=192.168.0.1,rrep_src=192.168.0.1,rrep_dest=192.168.1.1 hop_count=3


#What we see in the log at uml02

Received nreq extension, type=2, lenght=12, hostname=uml03.lln.rc
nreq with ip_src=192.168.0.1,ip_dest=255.255.255.255,rreq_src=192.168.0.1,rreq_dest=255.255.255.255 hop_count=2
Received nrep extension, type=3, lenght=18, num_ad=1, name=uml03.lln.rc
nrep with ip_src=192.168.1.1,ip_dest=192.168.1.2,rrep_src=192.168.0.1,rrep_dest=192.168.1.1 hop_count=2
AODV: Forwarding a route to: 192.168.1.1 from node: 192.168.0.1


#What we see in the log at uml03

Received nreq extension, type=2, lenght=12, hostname=uml03.lln.rc
nreq with ip_src=192.168.1.2,ip_dest=255.255.255.255,rreq_src=192.168.0.1,rreq_dest=255.255.255.255 hop_count=3
FOUND !! changing dst ip to 192.168.1.1
AODV: Generating RREP -  src: 192.168.0.1 dst: 192.168.1.1


#Debug from the dns proxy


uml01:~#  /mnt/var/uml/checkout/dnrd-2.10/src/dnrd -n eth0:rc

Debug: Using aodv name extension for domain rc
Debug: cache low/high: 800/1000
Debug: initialising master DNS database
Debug: no master configuration: /etc/dnrd/master
Debug: initialising from /etc/hosts, domain= <none>
Debug: /etc/hosts: 0 records
Debug: added authority for 0.0.127.in-addr.arpa
Debug: 3 records in master DNS database
Debug: Received DNS query for "uml03.lln.rc"

- -- query
000 - 09 8A 01 00 00 01 00 00 00 00 00 00 05 75 6D 6C  .............uml
010 - 30 33 03 6C 6C 6E 02 72 63 00 00 01 00 01        03.lln.rc.....


id= 2442, q= 0, opc= 0, aa= 0, wr/ra= 1/0, trunc= 0, rcode= 0 [0100]
qd= 1
  name= uml03.lln.rc., type= 1, class= 1
ans= 0
ns= 0
ar= 0

Debug: Replying to query with name res ext for domain rc

- -- request
000 - 00 00 01 00 00 01 00 00 00 00 00 00 05 75 6D 6C  .............uml
010 - 30 33 03 6C 6C 6E 02 72 63 00 00 01 00 01        03.lln.rc.....


id= 0, q= 0, opc= 0, aa= 0, wr/ra= 1/0, trunc= 0, rcode= 0 [0100]
qd= 1
  name= uml03.lln.rc., type= 1, class= 1
ans= 0
ns= 0
ar= 0

Debug: sending nreq toward eth0
Debug: rcv from netlink:uml03.lln.rc             192.168.1.1
Debug: found initial query
Debug: Received DNS reply for "uml03.lln.rc"

- -- reply
000 - 00 00 84 00 00 01 00 01 00 00 00 00 05 75 6D 6C  .............uml
010 - 30 33 03 6C 6C 6E 02 72 63 00 00 01 00 01 05 75  03.lln.rc......u
020 - 6D 6C 30 33 03 6C 6C 6E 02 72 63 00 00 01 00 01  ml03.lln.rc.....
030 - 00 00 00 3C 00 04 C0 A8 01 01                    ...<......


id= 0, q= 1, opc= 16, aa= 1, wr/ra= 0/0, trunc= 0, rcode= 0 [8400]
qd= 1
  name= uml03.lln.rc., type= 1, class= 1
ans= 1
  name= uml03.lln.rc., type= 1, class= 1, ttl= 60
ns= 0
ar= 0

Debug: cache: added uml03.lln.rc, type= 1, class: 1, ans= 1
Debug: Forwarding the reply to the host

CODE DOWNLOAD

Code is no longer available for download but if you think you really need, please contact me directly and I will send it to you.

  • dnrd-nameres-2004-09-04.tgz
  • kaodv-nameres-2004-09-04.tgz

SOFTWARE USED
  • User mode linux 2.4.19um45
  • Kernel AODV 2.1
  • dnrd 2.1

REFERENCES


LINKS