I created reservations in the Flint 3 GUI to set up MAC to IP address mappings. That worked as expected. I then opened Advanced Settings and examined Luci settings. After doing that, the mappings no longer show in the main GUI as expected, though the clients still get the expected IP addresses.
Yup. I noticed the same thing on my Slate AX. Use one or the other. I recommend LuCI so you can set a proper .internal
domain name. Who doesn't like https://router.freebird.internal
?
It'd be nice if GL.iNet tried moving as much as they could from custom scripts to instead make appropriate uci
show
/get
/set
calls/pushes. IDK why they want to recreate the wheel.
Hello,
Thank you for your feedback.
Although the two functions have the same effect, but the configuration formats they use are different. Recommended to only choose one of them to configure.
Follow up: here's how to quickly set a myname.internal
domain name. Use ssh to copy & paste in the commands. Be sure to change DOMAIN
to taste and match ROUTER_IP
to your device's IP:
DOMAIN='mycustomnamehere'
ROUTER_IP='192.168.8.1'
uci batch <<- __EOF
set dhcp.@dnsmasq[0].local='/internal/'
set dhcp.@dnsmasq[0].domain="${DOMAIN}.internal"
set dhcp.@dnsmasq[0].expandhosts='1'
add dhcp domain
set dhcp.@domain[-1].name='router'
set dhcp.@domain[-1].ip="${ROUTER_IP}"
__EOF
uci commit dhcp && service dnsmasq restart
That is a useful script. For the last 20+ years, I've used a .lan domain and will continue using that.
I hear that. I'd rather use .lan
but IIRC from the RFC(?) one of the Big Tech bastards (GOOG?) is now the exclusive holder of that TLD. I wonder if they expensed it as 'payola.' /s
Jokes on them. It's an internal-only name.
I think the real joke is on us. /off-topic
Follow up: Stock GL.iNet firmware settings, which includes two pre-existing 'domains', may impact the ability to reach https://router.mycustomnamehere.internal
. They should be removed before adding custom ones. This should make quick work of them:
uci show dhcp.@domain[0].name | grep -m 1 'console.gl-inet.com'
status_gl_domain="${?}"
if [ "${status_gl_domain}" = '0' ]; then
uci delete dhcp.@domain[0]
uci delete dhcp.@domain[1]
uci commit dhcp
fi
You can see your entries within GL GUI -> System -> Advanced Settings -> LuCI -> Network -> DHCP and DNS -> Hostnames
So if I want to add my nas (domain: nas.lan ip: 192.168.1.10) I have to do the followwing:
uci set dhcp.@dnsmasq[0].local='/lan/'
uci set dhcp.@dnsmasq[0].domain="nas.lan"
uci set dhcp.@domain[0].ip="192.168.1.10"
uci add dhcp domain
uci commit dhcp && service dnsmasq restart
Not quite. The command ordering is incorrect. uci add dhcp domain
goes above the nas
line to begin a new domain addition. I'm not sure if you intend nas
to refer to a (n)etwork (a)ttached (s)torage device or if that's what you want as your mycustomname.lan
. Furthermore...
I really would use .internal
to prevent any possible future collisions with the WAN-side .lan
TLD but it's your subnet. This snippet will also strip any stock GL.iNet entries if they are present per my previous comment ITT. Edit to taste:
DOMAIN='mycustomnamehere'
ROUTER_IP='192.168.8.1'
NAS_IP='192.168.1.10'
uci show dhcp.@domain[0].name | grep -m 1 'console.gl-inet.com'
status_gl_domain="${?}"
if [ "${status_gl_domain}" = '0' ]; then
uci delete dhcp.@domain[0]
uci delete dhcp.@domain[1]
uci commit dhcp
fi
uci batch <<- __EOF
set dhcp.@dnsmasq[0].local='/internal/'
set dhcp.@dnsmasq[0].domain="${DOMAIN}.internal"
set dhcp.@dnsmasq[0].expandhosts='1'
add dhcp domain
set dhcp.@domain[-1].name='router'
set dhcp.@domain[-1].ip="${ROUTER_IP}"
add dhcp domain
set dhcp.@domain[-1].name='nas'
set dhcp.@domain[-1].ip="${NAS_IP}"
__EOF
uci commit dhcp && service dnsmasq restart
Multiple domains (technically 'sub-domains') can point to the same IP (put them above the last __EOF
line). Eg:
add dhcp domain
set dhcp.@domain[-1].name='ftp'
set dhcp.@domain[-1].ip="${ROUTER_IP}"
Change the name=
& ip=
to point to a different client. Mind the use of '
.
Result(s): reachable router.mycustomnamehere.internal
& ftp.mycustomnamehere.internal
& nas.mycustomnamehere.internal
after setting the approp. reserved IP(s)/static DHCP(s) & any appropriate routing.
LuCI -> Network -> DHCP and DNS -> Hostnames will show the configuration as will uci show dhcp | grep 'dnsmasq' && uci show dhcp | grep '@domain\['
I understand that the logic of this script is to delete the default entries for console.gl-inet.com, then add dnsmasq entry for domain and add subdomains with IP addresses. But i want shorter names like nas.lan, router.lan and switch.lan. It should be possible...
The other way is to use your method with short domain name like nas.my.lan or something like this.
Your preferred method is possible. In fact it's the default. Delete the lines:
set dhcp.@dnsmasq[0].local='/internal/'
set dhcp.@dnsmasq[0].domain="${DOMAIN}.internal"
I just found where every command is located in Luci, so in my case all i had to do is to add them as hostnames for example as just nas and its ip to get it in nas.lan. I found out that local domain names does not work if tailscale is enabled. At least i learned the UI better this way. Thank you for your help.
Don't forget to check out the 'CNAME' tab while you're there.
I've never used TailScale. That seems to a whole other 'kettle of fish.'