Mon Mar 28, 2011 1:38 am
You can use destination NAT (not source NAT) to rewrite the destination IP address of a packet a client sends to a server. Whatever you send the altered packet to will have to be able to cope with requests for resources it doesn't have. This is functionality on layer three of the OSI model.
Hotspots and proxies can do true redirects on layer seven of the OSI model and are assisted by destination NAT. First destination NAT is used to rewrite the packet so that it is sent to the Hotspot or proxy. That service then accepts the packet and issues an HTTP redirect either via the appropriate status code indicating to the client that the requested resource has moved together with the new location, or by serving the requested resource in such a fashion that the client then requests a different resource immediately - usually a meta refresh or JavaScript.
The latter works better without a specially programmed web server. If you only use NAT the web server would get the exact request the original server would have gotten. If a client asks yahoo.com for this.html, and the packet is rewritten by destination NAT to a different server, that server will still be asked for this.html. It likely won't have that resource and respond with an error (404 not found).