0
Goal
I want to get my web browser to display the contents of the page at http://www.google.com when I navigate to http://www.domain.tld (leaving the latter in the browser address bar after loading).
What I've attempted
I'm a bind
newbie trying to set up a local domain (say domain.tld).
In my zone file I tried adding the following records but get various errors like 404, unreachable, serverfail:
# doesn't work
www IN CNAME www.google.com.
www2 IN A www.google.com
When I route to web servers on my LAN, A records work fine:
# works
www IN A 192.168.1.2
nuc IN A 192.168.1.3
Question
Either my DNS configuration is incorrect/incomplete or my understanding of DNS servers is lacking something crucial. Where am I wrong?
Additional information
Contents of /etc/bind/named.conf.local
zone "domain.tld" {
type master;
file "/etc/bind/zones/domain.tld.db";
};**
dig -x www.domain.tld
response:
; <<>> DiG 9.8.1-P1 <<>> -x www.domain.tld
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 34575
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;tld.domain.www.in-addr.arpa. IN PTR
;; AUTHORITY SECTION:
in-addr.arpa. 3600 IN SOA b.in-addr-servers.arpa. nstld.iana.org. 2015072757 1800 900 604800 3600
;; Query time: 1233 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Thu Jan 21 16:20:04 2016
;; MSG SIZE rcvd: 113
There is a good chance that the Google servers look at the
Host:
header your browser sends, and if it says anything besidesgoogle.com
or any of their other domains, it responds with an error. I would testing your bind setup usingnslookup
ordig
, not the web browser. – heavyd – 2016-01-22T00:11:48.000Thanks for the answer. I'll updated my question with the output of
dig
. So is my goal impossible with Google as the target, or is there a more bullet proof way to accomplish what I'm trying to? – Sridhar Sarnobat – 2016-01-22T00:21:06.127You'd need a proxy or redirect. – qasdfdsaq – 2016-01-22T00:31:24.180
Can that be done with a DNS server like
bind
? Or do I need a web server like Apache? (I'd have thought the latter would be limited to a particular port). – Sridhar Sarnobat – 2016-01-22T00:32:32.560And any pointers to the directive I need to look up in the manual would be a big help. – Sridhar Sarnobat – 2016-01-22T00:33:41.773