Mikrotik split-dns:他們做到了

不到 10 年後,RoS(在穩定版 6.47 中)的開發人員添加了允許您根據特殊規則重定向 DNS 查詢的功能。 如果以前需要在防火牆中使用第 7 層規則來規避,現在可以簡單而優雅地完成:

/ip dns static
add forward-to=192.168.88.3 regexp=".*\.test1\.localdomain" type=FWD
add forward-to=192.168.88.56 regexp=".*\.test2\.localdomain" type=FWD

我的快樂沒有界限!

這對我們有什麼威脅?

至少,我們擺脫了像這樣的奇怪的 NAT 結構:


/ip firewall layer7-protocol
add comment="DNS Nat contoso.com" name=contoso.com regexp="\x07contoso\x03com"
/ip firewall mangle
add action=mark-packet chain=prerouting comment="mark dns contoso.com" dst-address-type=local dst-port=53 in-interface-list=DNSMASQ layer7-protocol=contoso.com new-packet-mark=dns-contoso.com passthrough=yes protocol=udp
add action=mark-packet chain=prerouting comment="mark dns contoso.com" dst-address-type=local dst-port=53 in-interface-list=DNSMASQ layer7-protocol=contoso.com new-packet-mark=dns-contoso.com passthrough=yes protocol=tcp
/ip firewall nat
add action=dst-nat chain=dstnat comment="DST-NAT dns contoso.com" dst-port=53 in-interface-list=DNSMASQ packet-mark=dns-contoso.com protocol=udp to-addresses=192.0.2.15
add action=dst-nat chain=dstnat comment="DST-NAT dns contoso.com" dst-port=53 in-interface-list=DNSMASQ packet-mark=dns-contoso.com protocol=tcp to-addresses=192.0.2.15
add action=masquerade chain=srcnat comment="mask dns contoso.com" dst-port=53 packet-mark=dns-contoso.com protocol=udp
add action=masquerade chain=srcnat comment="mask dns contoso.com" dst-port=53 packet-mark=dns-contoso.com protocol=tcp

這還不是全部,現在您可以註冊多個轉發器,這將有助於進行 dns 故障轉移。
智能 DNS 處理將使開始將 ipv6 引入公司網絡成為可能。 在此之前,我沒有這樣做,原因是我需要將許多 dns 名稱解析為本地地址,而在 ipv6 中,如果沒有相當大的拐杖,這是無法完成的。

來源: www.habr.com