Configure DNS re-write

DNS rewrite is a feature to alter the resolved IP address for a particular domain name or URL, instead of returning the default resolved DNS record to client, essentially "spoofing" users to connect to another IP for a particular domain name or URL.

It typically required in below scenario:

 

Below is how mbox DNS rewrite works:

 

 

CONFIGURATION EXAMPLE 

In this example,


!interface eth0description "connection to Internet"enableip address 202.127.9.3/28ip address 202.127.9.2/28 remarks “public IP for DMZ server”!interface eth1description "connection to LAN"enableip address 172.16.1.1/16dhcp-server  router 172.16.1.1  range 172.16.1.5 172.16.1.254!interface eth2description "connection to DMZ"enableip address 10.1.1.1/24!ip host test.com 10.1.1.2 rewrite                           <--redirect to an DMZ IP (for internal users)!ip name-server 8.8.8.8 8.8.4.4!ip route 0.0.0.0/0 nexthop 202.127.9.1!ip dhcp-server start!firewall-input 13 permit inbound eth1 udp src 172.16.1.0/24 dport 53 remark "permit DNS request from internal users only"!firewall-dnat 00 redirect inbound eth1 udp dport 53 src 172.16.0.0/16 remark "intercept DNS requests"firewall-dnat 11 translate ip dst 202.127.9.2 xdst 10.1.1.2             <--- 1-to-1 DNAT for external clients to access DMZ server (static NAT)!firewall-access 10 permit outbound eth0 remark "permit outbound Internet access"firewall-access 20 permit all tcp dst 10.1.1.2 dport 80 remark "permit access to DMZ web server"firewall-access 21 permit all tcp dst 10.1.1.2 dport 443 remark "permit access to DMZ web server"!firewall-snat 1 overload outbound eth0 remark "PAT for Internal users to go out"