That sounds great, but I only understand about 65% of that (passing?).No need for public A records if you run your own internal DNS server with a split DNS setup. You can map a domain like mqtt-ha.mydomain.local (or whatever) to 10.100.0.1 and have all your IoT devices point to that DNS server. It’s best practice in setups like this and is simple, reliable and fully under your control.
No, not at all.So are you stating that you wish all the traffic from the locations will go out the WWW to reach the home assistant server at location Y?
I was hoping for a solution that did not involve maintaining a statis DNS entry in each router.Just set the name of MQTT broker in all devices to dns name eg. broker.local.mqtt and in all routers (assuming Mikrotik everywhere) set static dns entry forwarding all dns queries to you local dns server
/ip dns static add forward-to=IP_OF_YOUR_LOCALLY MANAGED_DNS_IN_MIKROTIK regexp=".*local\\.mqtt" ttl=1h type=FWD
and in local DNS set
/ip dns static add address 10.100.0.1 name=broker.local.mqtt
/ip dns static add address 10.100.0.1 name=broker
use local.mqtt private domain only for MQTT but it is not a necessary condition.
If you wish you can change local.mqtt to anything you want but the name has to be so unique to not clash with any public name
Not at all. I used that in production for a corporate network.Is there a problem creating a A record for the domain at the DNS host for the domain?
I'm following except for this:
Then you manage only the one central dns and set all anyservername.local.mqtt names and it serves all other locations.
You just pick out particular domain from others queries and pass to your own DNS. Any dns you want.
OMG....BartoszP please listen to my thinking (;-)OMG ...Josephny please focus
One central DNS is the one you have enabled in your mikrotik (or any other dns/device that serves that function) that is not public.
Local means "local" ... at your home/main office it is probably the same as "central" ... at remote places it is the one that serves DHCP clients.
If you set 8.8.8.8, 1.1.1.1, 9.9.9.9 (or any other public one) then you are out of luck as you have to set DHCP server to point to local DNS server in that router to be able to manage your own domains that means local.mqtt.
Concur, in fact its actually more work to create DNS servers at each location and then modify each IOT device to look for a specific URL.@anav: I see no savings at all![]()
You list A, B, and C, but you don't explain what this is a list of?Huston .... there is a problem.
Please read advices that are presented to you twice. At least.
A. Find a DNS hosting that allows you to define "A" record as you wish with 10.100.0.1 address. Job done. No need to ask us for any help. Case closed.
B. You have to set up and manage the only one private "local" at your main office/place/home DNS server,managed only by you, that is "central" for other your sites. That sites have to be >>persuaded<< (configured) to pass queries for local.mqtt domain to your private central DNS server that resolves names like "anyname.local.mqtt" not involving any public DNS. It means that you have control/configure all "local" DNSes. Just once. With such a configuration all DNS names stay resolved as they are resolved now and only queries for *.local.mqtt are sent to your "central" DNS server.
C. if you locally (at every your site you manage) set DNSes to external ones - eg. 1.1.1.1 or 8.8.8.8 - then you have go back to (A). If you want control what & where is resolved then you need advanced solution and manage your own DNS or the one smart enough to do what you want. It could be hosted enywhere but if it is outside your private managed network you have to deal with it's restrictions.
Hope that you undersand this.
PS.
It's just as setting the rule for an administration staff:
Read the destination address. If it is an address of any of our offices (private) then send the documents using internal post service. If you have no idea what "Mr. Joe Doe @ new office" means then ask someone at the central office to resolve the destination (DNS query) and then send it properly.
What exaclty do you concur with?Concur, in fact its actually more work to create DNS servers at each location and then modify each IOT device to look for a specific URL.@anav: I see no savings at all![]()
Once done, any change to IP address of the home assistant server would require changes to every local DNS server to match, vice the single dstnat rule on the server hosting the server.
Setting up additional DNS servers, and any firewall rules, etc, is an admin burden completely unnecessary, not needed and it saves NO work down the line ( and is actually more work ). Its a great approach/tool to have for the right scenario, this is simply not it.
Directing traffic for the faux address, already embedded in the IOT device, into the wireguard tunnel and pointing the router to select the peer hosting the server for the traffic, is simple, and efficient. At the host server router a one DSTNAT rule to redirect dst faux address to actual Server IP, is tidy and efficient. Any change to the IP needs a single mod to the dstnat rule, and done.
One can lead a horse to water............
What is that advice I should listen to?@Josephny, please listen to BartoszP's advice — they're legit. My recommendation: don’t use an external DNS server for your local needs and private addresses (for a bunch of different reasons)
I'm not playing any game.Josephny ... to be honest ... please do not waste our time. My time at least.
(A) (B) (C) are the three possible solutions or steps you have take.
You do not understand or you do not want understand your own needs?
How to describe it better. You manage your own DNS server or use existing one.
What game you play with us?
Anav:DNS question:
...
To be clear, I am trying to be able to configure the IoT devices with a domain name so that I can change the IP address of the MQTT server without have to go back to each IoT device and reconfigure.
Any ideas? Thanks!
Thank you for your understanding and your help.Just set the name of MQTT broker in all devices to dns name eg. broker.local.mqtt and in all routers (assuming Mikrotik everywhere) set static dns entry forwarding all dns queries to your local dns server
/ip dns static add forward-to=IP_OF_YOUR_LOCALLY MANAGED_CENTRAL_DNS regexp=".*local\\.mqtt" ttl=1h type=FWD
and in that central DNS set
/ip dns static add address=10.100.0.1 name=broker.local.mqtt
/ip dns static add address=10.100.0.1 name=broker
use local.mqtt private domain only for MQTT but it is not a necessary condition.
If you wish you can change local.mqtt to anything you want but the name has to be so unique to not clash with any public name.
That device asks its DNS server (192.168.0.1) and that DNS server tells the device to go and ask the DNS server at a completely different location (for example, 192.168.2.1).
That way, any changes to the IP address of mqtt.local need only be made on the DNS server at 192.168.2.1.
Perfect -- thank you for the clarification.That device asks its DNS server (192.168.0.1) and that DNS server tells the device to go and ask the DNS server at a completely different location (for example, 192.168.2.1).
The DNS server (192.168.0.1) doesn't tell the device to go ask the other server. The DNS server performs the lookup itself, but by asking the other server (192.168.2.1, instead of the usual upstream servers), then the server relays the answer to the client devices. From the viewpoint of the client devices, they have only asked one server (192.168.0.1) in one query and get the answer from one server only (192.168.0.1).
But for you as the admin, the final outcome will still be the desired one below:
That way, any changes to the IP address of mqtt.local need only be made on the DNS server at 192.168.2.1.
I can try to explain (and hopefully make things clearer, and not more confusing).Hi Bartosz, Trying to understand your advice and with Larsa endorsement, of course!
I too like Joseph, being not IT professional need some conceptual guidance.
What I think your saying, in techno speak, is in static DNS we attach or identify an IP address with an URL or domain name that we have given to each IOT deviceas its entry argument to reach thehome assisstant server on a remote router.
So I find it confusing as to why an IOT device on a router should be given an IP of a local DNS server instead of the IP address of the home assistant server on the host router???
/ip dns static add forward-to=IP_OF_YOUR_LOCALLY MANAGED_CENTRAL_DNS regexp=".*local\\.mqtt" ttl=1h type=FWD
Following the bouncing ball, of the above script, the iot device is somehow directed to a local DNS server and then what??? I dont see how this traffic then goes into the wireguard tunnel, exits the remote router and finds its way to the home assistant server on the remote host router.
I am lost trying to follow your solution on this router or any other of the remote routers with iot devices that need to access the home assistant server on the host router.
Thank you -- that adds important depth to the topic we are discussing.Just thought I'd chime in to add to the confusion. Generally, private (RFC1918, etc.) addresses are permitted in public DNS records, in fact this is not uncommon. The rise in popularity of this is in fact rising because it's not exactly easy to do split DNS nowadays with hard-coded DNS servers on devices, default DoH use, the requirement to support not-managed-by-the-given-company devices, etc. Discussions on whether this is good practice leads to long mailing list chains - there was a notable one on the NANOG list a while ago that is actually worth a read.
Another possible solution is to use your public server IP in the DNS record and simply configure your router to nat these connections to your local (preferred) instance.
Maybe I'm misunderstanding, but I assumed that by NAT you meant opening a port that forwards frames arriving on the public IP address port of the router (the WAN port) to the Home Assistant/MQTT server.What you have in your DNS records and whether you do or don't do nat has no bearing on your firewall and access control capabilities.
You miss the point, the OP does not intend on reaching the home assistant server over the WWW, he wants all traffic to go over wireguard tunnels between the routers.The question is about DNS configuration, not how to configure and pass the traffic from branches to main place using VPNs.
Traffic will stay on the WG tunnel. That is not in doubt.You miss the point, the OP does not intend on reaching the home assistant server over the WWW, he wants all traffic to go over wireguard tunnels between the routers.The question is about DNS configuration, not how to configure and pass the traffic from branches to main place using VPNs.
No, I didn't mean that. I meant that the endpoint devices connect to an IP as their server, wither statically configured or obtained using DNS. Then a router (on your preferred side of the tunnel) redirects these to whatever server is actually intended to handle their connections.Maybe I'm misunderstanding, but I assumed that by NAT you meant opening a port that forwards frames arriving on the public IP address port of the router (the WAN port) to the Home Assistant/MQTT server.What you have in your DNS records and whether you do or don't do nat has no bearing on your firewall and access control capabilities.
Wrong...For the simple reason I have outlined, later to change the iot device traffic to a new IP, only requires a change on the dstnat rule and none on the iot devices. Less work in my book.
Perhaps others see a fault in my logic, as I dont mind being wrong.
OP here: I do indeed tinker (way too much).RIGHT, you proved me right again thank Bartosz........
A config is based on a set of established requirements, not vapour future wishes.
If the op wants efficiency, the shortest path to get his 10 routers up and running as they are now, DNS is stewpid.
If the op wants to tinker with DNS, which is more viable now after disclosing he can bulk change the setting on devices, then by all means
go ahead and do the DNS option. It as you say has some future proofing built in, aligns the desired functionality with a tool so designed, and provides further learning experience.
I'm not convinced the OP will be attempting BGP or more complex functionality anytime soon as he is still working on VLAN filtering but one never knows.
Not familiar with home assistant, but similar to UNIFI approach........
Q1 -> can via a DHCP option, we give the IOT devices on the IOT subnet, the IP address of the home assistant server
Q2.--> can we via DHCP for the IOT subnet provide the domain name of the DNS server (domain=bartosz.home) and then in IP static
add-address=serverIP name=HA.bartosz.home type=A
Not familiar with this mqtt or broker concept.