You are here

Auto create /etc/hosts file of mesh nodes

9 posts / 0 new
Last post
wb6tae
Auto create /etc/hosts file of mesh nodes
I have a computer (MacOS 10.11)  that connects to both my home network (with Internet gateway) and the mesh network. I have no problem with packet routing - that was easily resolved by adding a static route for 10.0.0.0/8. The problem now is DNS. There are a number of options, most of them fairly complex and involve adding a separate DNS server for selective forwarding. So, given the relatively small size of the local mesh, I have just been manually maintaining /etc/hosts entries for the mesh entities (nodes and services).  

However, this is a bit of a pain and I am sure there must be some way to automate the process. For example, I could scrape the olsr data from a node (port 1978). But, that does not show "services."

So, my questions: has anyone done something like this?  Is there a package (olsrd-mod) I could add to provide what I need? Is there a way to "dump" the dns listing - like a secondary server would do?  Is there some other simpler solution I have overlooked.

Thanks,

Richard - wb6tae
K5DLQ
K5DLQ's picture
Have you tried to check the
Have you tried to check the "Disable default route" checkbox on the setup page?
wb6tae
Not sure
Darryl... Not sure how that would help?
wb6tae
Solved
I solved this quite easily.  /temp/run/hosts_olsr has everything I wanted. No additional formatting required. I can use scp to grab a daily copy and have a simple shell script merge it into my local /etc/hosts.  Unfortunately, olsrd likes to have only one host declaration per line in the hosts file so the file is much longer than necessary.   Eg: foo and foo.local.mesh are separate entries like:
10.1.2.3.  foo
10.1.2.3.  foo.local.mesh
rather than
10.1.2.3.   foo foo.local.mesh

But, that's only cosmetic and not really an issue.
wb6tae
Actually...

There seems to be a small problem with this approach. While actual nodes are entered once for each possible host or domain name. Services are not.  For example, a dtd linked node, foo, is listed three times...
10.1.2.3 foo
10.1.2.3 foo.local.mesh
10.1.2.3 dtdlink.foo local.mesh

However, a service host is just listed once as a host name and not as a fqdn.
10.1.2.4 foo-pi

This becomes an issue since the links shown on the mesh status page use fqdns. I am sure I can fix this with a little scripting, but it does add a slight amount of complexity.  
 

wb6tae
Fixed
A quick hack.  short shell script to append .local.mesh to simple host names and then added local.mesh to the domain search list.

Works as hoped for.  I'd be glad to share the scripts if there is interest. YMMV
AE6XE
AE6XE's picture
Richard,
Richard,

One way to do this is to copy from the mesh node down to your mac computer, the file "/var/run/hosts_olsr" and have it appended to the local hosts file or a 2nd hosts file for DNS to look at.   This file is auto-maintained by olsr on the mesh node of all the routing in question.     Just copy it down and hook in periodically.  This will also address some issues with routing to tunnel nodes on the mesh network that have 172.16.x.x. addresses (which will fail to route for the moment).

Have you considered only plugging the mac into the mesh node, then routing through the mesh node's WAN port to your home network->internet?  The DNS resolution would also follow this path naturally.  The only difference is a NAT-masq between you and your home network.  It would work great, unless complicated by trying to host services on the mac to other computers on your home network.  You do not have to advertise the mesh node as a gateway for this to work.

Joe AE6XE
wb6tae
same idea
Joe:  it looks like we posted at the same time.  This particular case is actually for a friend. In my own case, I run dnsmasq on my gateway router and it can selectively choose a resolver based on domain name. It also routes between my home, Comcast and the mesh.  Routing through the wan port in the router is an interesting idea. But, I have pretty fast access and a very fast internal network, so I'd rather not insert a NanoStation in my path.

BTW for anyone with an interest. The particular connection we are discussing uses a R-Pi as a router between the home lan and the lan port on the local mesh node. Works quite nicely, and the Pi also provides data on the solar power system and some emcomm services.

Richard - wb6tae
K5DLQ
K5DLQ's picture
Sorry.  I misunderstood.  my
Sorry.  I misunderstood.  my bad.

 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer