开发者

domain names and hosts file

i have a small network setup which contains a firewall which has a public static ip, a switch connected to the green NIC and 3 servers connected to the switch.

what i am trying to do is register multiple domain names then point them to my single public static ip which has my router on it. then whenever a r开发者_如何转开发equest is sent to say example1.com the master DNS registar forwards to my ip, but then based on the requested domain name i want to forward that request to a specific static ip in the "local" network behind the router.

how would i accomplish this using hosts file, would a simple entry in my router's hosts file like example1.com 192.168.1.122 example2.com 192.168.1.134 redirect traffic from domain name to the server behind the router through a single public IP or do i need to setup a DNS server.

also if i were to decide to use DNS, would i need to setup DNS with slave forward zone?

PS: im not asking for step by step tutorials but rather a conceptual explanation cause im a bit confused

thank you


the IP header (of a packet coming to your router from the outside) doesn't contain a domain name, it contains the IP address that the DNS server returned for that domain name. neither approach would work, in the general case. if you mean specifically for a protocol that will contain a domain name, such as HTTP, ask a more specific question about exactly what you are trying to accomplish.


The hosts file is there for resolving host names on your local machine- think client, not server. You're asking about resolving and redirecting host names from the Internet in general.

The redirection you want is best handled by a domain name server. Each of the nameservers for your domains would need to return the IP address of your external firewall address for selected hosts on those domains.

The "slave forward zones" are just a means of telling a nameserver to pass the request to another nameserver for resolution. Ultimately, something outside your own network has to resolve hostnames to the address you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜