1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
---------------------------------------------------------------------
NAMESERVICE PLUGIN FOR OLSRD
by Bruno Randolf <bruno.randolf@4g-systems.biz>
---------------------------------------------------------------------
a simple DNS replacement for OLSR networks
this plugin distributes host name (DNS) information over OLSR. every
node which runs the olsr daemon can announce it's own name, names for
other IP adresses it is associated with (HNAs) and if it is running
a "real" nameserver which can resolve other (internet) names (upstream
dns server).
the nodes in the network collect this information and write the host
names to a file (possibly /etc/hosts), and the 3 nearest upstream
nameservers to another file (possibly /etc/resolv.conf).
these files can be used to resolve hostnames on the local system and/or
be read by a DNS server like "dnsmasq", to make the names available
via the ordinary DNS protocol to other clients as well.
the default location of the hosts file is
"/var/run/hosts_olsr" on unixes
"C:\WINDOWS\hosts_olsr" on windows
---------------------------------------------------------------------
PLUGIN PARAMETERS (PlParam)
---------------------------------------------------------------------
PlParam "name" "my-name.mesh"
the name of this OLSR node (main address).
can be specified multiple times for different names.
PlParam "IP.ADDR" "another-name.mesh"
a name for a specified IP address.
the IP address has to be either from one of the olsr
interfaces or within a HNA network we announce.
can be specified multiple times.
PlParam "hosts-file" "/path/to/hosts_file"
which file to write to (usually /etc/hosts).
(default: /var/run/hosts_olsr)
PlParam "suffix" ".olsr"
local suffix which is appended to all received names.
(default: "")
PlParam "add-hosts" "/path/to/file"
copy contents of this additional hosts file to output file.
this is practical if you alreay use your /etc/hosts file.
PlParam "dns-server" "IP.ADDR"
anounce that this IP has a full (upstream) DNS server. if
IP.ADDR is not specified (""), the main address is used.
nodes which don't know a nameserver will automatically use
this nameserver.
PlParam "resolv-file" "/path/to/resolv.conf"
path to resolv.conf file (usually /etc/resolv.conf)
if set, the 3 nearest (best ETX) upstream nameservers annonced
by other nodes in the network are written to this file
PlParam "interval" "SEC"
interval for sending NAME messages in seconds.
(default: 120 - 2 minutes)
PlParam "timeout" "SEC"
validity time for received NAME messages in seconds.
(default: 3600 - 1 hour)
PlParam "lat" "12.123"
Float: Decimal latitude for this node to be flooded in the mesh
PlParam "lon" "12.123"
Float: Decimal longitude for this node to be flooded in the mesh
PlParam "latlon-file" "/var/run/latlon.js"
Filename to write Javascript statements to. Default is "latlon.js"
(either /var/run or windows directory). This file is written, if
the "lat" and "lon" parameters are set. It has this format:
/* One or more mid-aliases of multihomed nodes */
Mid('fromip','toip');
/* One special Node() entry for this node
* defhna means: This node announces hna 0.0.0.0/0
* defroute means: The current neighbour IP for 0.0.0.0/0
*/
Self('mainip',lat,lon,defhna?1:0,'defroute','name');
/* One or more node entires for other nodes */
Node('mainip',lat,lon,this-node-defhna?1:0,'defroute','name');
/* One or more links between nodes */
Link('fromip','toip',lq,nlq,etx);
PlParam "latlon-infile" "name-of-input.txt"
Filename to read lat/lon positions from. Meant to be used
by a walking GPS receiver. Just write comma separated decimal
latitude and longitude to this file. Will overwrite the
"lat" and "lon" parameters during runtime.
PlParam "sighup-pid-file" "/path/to/pidfile.pid"
(*nix systems only) Sends a HUP signal to the process specified
by the pidfile (usually /var/run/dnsmasq.pid) when the host name
table changes. This is useful for letting dnsmasq or bind know
they have to reload their hosts file.
PlParam "name-change-script" "/path/to/script"
Script to execute when there is a change in the hosts names
table. Useful for executing a script that uses the hosts file
to keep a website or a database updated.
PlParam "service" "http://me.olsr:80|tcp|my little homepage"
Add a new service announcement to be spreaded in the mesh.
PlParam "services-file" "/path/to/services_file"
File to write (default: /var/run/services_olsr)
PlParam "services-change-script" "/path/to/script"
Similar to the previous parameter. Script to execute when there
is a change in the services list propagated by the nameserver
plugin. Useful for executing a script that uses the services file
to keep a website or a database updated.
PlParam "mac" "xx:xx:xx:xx:xx:xx[,0-255]"
Add a new MAC addr to be spreaded in the mesh. This MAC addr
may be used to fine control nerve-wreck-page solutions based
on MAC adresses. The optional dec. number designates a class.
PlParam "macs-file" "/path/to/macs_file"
File to write (default: /var/run/macs_olsr)
PlParam "macs-change-script" "/path/to/script"
Similar to the previous parameter. Script to execute when there
is a change in the macs list propagated by the nameserver
plugin. Useful for executing a script that uses the services file
to keep a website or a database updated.
---------------------------------------------------------------------
SAMPLE CONFIG
---------------------------------------------------------------------
add in /etc/olsrd/olsrd.conf:
LoadPlugin "olsrd_nameservice.so.0.2"
{
PlParam "name" "thisismyname"
PlParam "hosts-file" "/etc/hosts"
PlParam "resolv-file" "/etc/resolv.conf"
}
---------------------------------------------------------------------
USING THE NAME INFORMATION
---------------------------------------------------------------------
to use the name information distributed by the plugin actually for
name resolution you can do one of the following.
UNIX VARIANTS:
* overwrite /etc/hosts
be sure you have nothing in /etc/hosts which you still need and
configure the plugin with PlParam "host-file" "/etc/hosts"
* link /etc/hosts
ln -s /var/run/hosts_olsr /etc/hosts
* use dnsmasq
if you want to make the names available via ordinary DNS
you can use dnsmasq to read the hosts file and serve it to
users. add "addn-hosts=/var/run/hosts_olsr" to dnsmasq.conf
and:
PlParam "sighup-pid-file" "/var/run/dnsmasq.pid"
to your nameservice plugin configuration.
This is especially usefull for infrastructure mesh networks that
can't afford to run olsrd on all the clients but wish to provide
DNS to them. This is solved by running dnsmasq and olsrd with
this setup on "edge" nodes that provide connectivity.
WINDOWS:
* overwrite C:\WINDOWS\system32\drivers\etc\hosts
be sure you have nothing in the file which you still need
and configure the plugin with
PlParam "hosts-file" "C:\WINDOWS\system32\drivers\etc\hosts"
---------------------------------------------------------------------
TODO
---------------------------------------------------------------------
* implement a small DNS server into the plugin?
* or make dynamic DNS updates for bind?
---------------------------------------------------------------------
EOF / 30.06.2007
|