I have bought the mikrotik router-board hap ac2 for my home. Since I have poor network konwledge, I have a problem.
When I don’t create vlan interface in lan bridge, i use
/ip firewall nat add action=redirect chain=dstnat dst-port=53 in-interface=local protocol=udp to-ports=53
to redirect dns to local server, it works.
But when I use vlan, I try to change it to
/ip firewall nat add action=redirect chain=dstnat dst-port=53 in-interface-list=lan protocol=udp to-ports=53
the interface list lan contain all lan vlan interface, but it doesn’t work.
I have to use this stupid method
/ip firewall nat add action=redirect chain=dstnat dst-port=53 in-interface=local.vlan10 protocol=udp to-ports=53
/ip firewall nat add action=redirect chain=dstnat dst-port=53 in-interface=local.vlan20 protocol=udp to-ports=53
/ip firewall nat add action=redirect chain=dstnat dst-port=53 in-interface=local.vlan30 protocol=udp to-ports=53.
I want to simply it to one rule, can you help me?
I am struggling with VLANs myself (which is how I found this thread) for a different reason but I too want to direct hosts to the local server for both IPV4 and IPV6. For IPV4 I do it through an IP DHCP server. Using the DHCP Setup button in Winbox, I put the server on the LAN bridge, defined the address space (192.168.1.0/24 for me), let it define the gateway (192.168.1.1) and the addresses to give out. There is no Relay and I don’t specify a DNS server. It will dynamically create the allocation pool but using Winbox IP Addresses, you need to add the address (192.168.1.1/24 for me), network (192.168.1.0 for me) and interface (the name of your bridge). Using Winbox IP DNS, I have a list of external servers for the internal DNS server to use (I chose to not use the dynamic servers from my ISP but they may be all you need) and checked the box to allow remote requests. The hosts don’t get any DNS server information from the DHCP server so they send DNS requests to the gateway which gets them to the internal server.
IPV6 is more complicated but I can describe it if you need it.
I can see different names of the vlan interfaces here than in your earlier posts (local.vlan10 is not the same like lan.vlan10.network). Is it a result of some beautification or is it real? Better post the complete export of your configuration following the suggestion in my automatic signature.
Follow up to my post in case you decide to go that route. One more step is needed. After completing the DHCP Setup, go to the Networks tab of the DHCP window. Open the network just created and add a single DNS server being the same address as the gateway. I discovered that without it, the clients are given a list of servers that consists of the gateway address and the servers in in the DNS configuration. By explicitly specifying the single DNS server for the Network configuration, they are only given that single address which was the goal.
True. In fact some devices seem to have Google server and OpenDNS addresses hard coded, such as Firestick, Roku stick and even iPad. They usually use the router DNS server but sometimes go to the Internet. I have firewall rules to log their IP addresses and destinations. In your case, you could create firewall rules to block any DNS access but the local server.
If that is the full export, it is not supposed to work at all, because the interface named lan which all your /interface vlan use as a bearer interface is not defined anywhere in the configuration. So it may work somehow by chance but not the way it should, and in such case unexpected things may happen at firewall level.
So unless you’ve removed that part of the configuration from the export intentionally or unintentionally, I would first do the following:
/interface bridge
add name=lan protocol-mode=none
/interface bridge port
add bridge=lan interface=ether3
add bridge=lan interface=ether4
add bridge=lan interface=ether5
/interface list member
remove [find list="LAN" interface="lan"]
And I do know that you handle VLANs on the switch chip; nevertheless, the bridge has to be defined.