Mikrotik split-dns: ci sono riusciti

Non sono passati neanche 10 anni da quando gli sviluppatori di RoS (nella stable 6.47) hanno aggiunto una funzionalità che permette di reindirizzare le richieste DNS in base a regole specifiche. Se prima era necessario destreggiarsi con regole Layer-7 nel firewall, ora questo è fatto in modo semplice ed elegante:

/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

La mia felicità non ha confini!

Cosa comporta tutto ciò per noi?

Almeno ci liberiamo da strane configurazioni NAT simili a questa:


/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

E non è tutto, ora è possibile specificare più server inoltri, il che aiuterà a realizzare il failover DNS.
L'elaborazione intelligente del DNS darà la possibilità di iniziare l'implementazione di IPv6 nella rete dell'azienda. Prima non lo facevo, la ragione era che avevo bisogno di risolvere diversi nomi DNS in indirizzi locali, e in IPv6 non poteva essere fatto senza un bel po' di lavori evidenti.

Fonte: habr.com

Acquista hosting affidabile per siti web con protezione DDoS, VPS VDS server 🔥 Acquista hosting affidabile per siti web con protezione DDoS, VPS VDS server | ProHoster