New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow a distributed set of hostname-aliases for local servers running in a libremesh cloud #193
Comments
Great feature, i like it :) I tried to code something, but I don't have the time now to finish it... it is just a draft. #! /bin/lua
-- This file needs to be called when
-- 1. file /etc/hosts.aliases gets updated
-- 2. a new host gets in the network
-- We also have to share /etc/hosts.aliases through alfred
-- TODO:
-- * how to remove first column from a line (awk print $2)
-- * how to run a command and get the output
-- * how to read a file line by line
function get_origin_host(line)
run("awk '{print $1}'", line)
end
function get_alias_list(line)
run("awk '{print $2..}'", line)
end
function register(alias, origin)
-- add a line to /tmp/dhcp.hosts.aliases
origin_ip = run('nslookup '..origin..' | grep Address | grep -v 127 | tail -1 | awk \'{print $2}\'')
run('echo '.. origin_ip .. ' ' .. alias .. '>> /tmp/dhcp.hosts.aliases')
end
run('rm /tmp/dhcp.hosts.aliases')
for line in readlines('/tmp/hosts.aliases') do
origin_host = get_origin_host(line)
if origin_host then
alias_list = get_alias_list(line)
register(alias_list, origin_host)
end
end
|
Can't you use dnsmasq-distributed-hosts package included by default in LibreMesh? |
Long ago I wrote something like this for the QMP firmware. https://github.com/routek/qMp/tree/testing/packages/bmx6-mdns It uses the bmx6-sms plugin to distribute the DNS hosts among all nodes and configures dnsmasq. It has LUCI web integration, so it can be managed on the web interface. Porting this package to libremesh should be quite easy. |
@ilario the idea in that script is to build on top of the dnsmasq-distributed-hosts
and with that table and the distributed-hosts table, generate a new hosts table that has the ip of the registered hosts with all the aliases defined. That way you solve the problem of the static IPs. @p4u is bmx6-sms working now? For what I remembered, @altergui tried it when we were in the Hackathon in Quintana and it didn't worked. Also, would be nice for the implementation to be based on hosts and not IP addresses. |
Thanks for the immediate feedback! I wouldn't put a high priority on this issue and there are perhaps complexities that might arise through naming conflicts? Btw, do you address this issue with the existing hostnames? |
The current implementation is naive in the sense that it doesn't deal with this conflicts, probably because noone hasa reported issues related with this. |
Sorry, it is not a duplicate.
which requires a static IP, you want also something new like
it is interesting. I think that the easiest way to do this is to specify a CNAME for dnsmasq into
should we document this solution somewhere? |
How could we propagate these CNAME records using shared-state @G10h4ck? |
We could tie the aliases to the mac addresses of the devices, so we don't step onto each other. |
I don't understand this, could you elaborate, is this for?
Yes it is! |
.thisnode.info is as annoying as .lan (actually, .lan is not annoying). Imagine you have a raspberry pi with wikipedia in it, and that node's hostname is "internetinabox". When it gets connected to the network, it gets assigned the domain 'internetinabox.lan', and within the network it is accesible using that domain. |
See #540 and #541 regarding connection from mobile browsers and Chrome/Chromium.
Rather than breaking online websites, I would suggest to just use Additionally to this, as suggested in lime-example here and on the website here,
The proposal I wrote above, adding an automatic alias |
Writing http:// or the slash at the end is couter intuitive, users don't make sense of it. the lime-xxx is for nodes, i am talking about hosts. I explained the proposed heuristics in my previous comment:
|
Ah, sorry, I did not understand this. Ok, so I have no idea about how to do this mac->names thing. |
Using dnsmasq-dhcp that assigns IP to a MAC:
|
(my first issue with the help of @nicopace)
What happens
I would like to set a custom URL to a local server attached to a libremesh router; and advertise this URL for users to connect to this server from any libremesh device in the same network.
In the current situation I could do this by changing the hostname of my server device and use this as the readable URL including the default ".local" and ".mesh" extensions. For example, I could advertise the URL "myneighbourhood.local" where "myneighbourhood" is the hostname of my server.
What I expect to happen
I would like to be free to choose any type of simple or complex URL (myneighbourhood.here, my.neighbourhood.here.service, etc.) that resolve to the same server's IP and make this possible through a simple web admin interface.
(the reason I want to do this is that I want to avoid the captive portal approach and invest on marketing custom handmade URLs for accessing local services)
The text was updated successfully, but these errors were encountered: