1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Redirect one domain to another domain?

Discussion in 'Tomato Firmware' started by Quad5Ny, May 5, 2014.

  1. Quad5Ny

    Quad5Ny Connected Client Member

    I'm looking to have foobar3000.com routed to helloworld3000.com for a single computer on my LAN (

    So far the only thing I've come up with is using iptables: iptables -t nat -A PREROUTING -s -d foobar3000.com -j DNAT --to-destination

    Is there anything a bit more elegant that would allow me to do this using Domain names instead of IP's? Because if a IP changes then my rule is useless.
  2. koitsu

    koitsu Network Guru Member

    dnsmasq can "sort of" do this; it can make foobar3000.com resolve to an IP address of your choice, and you can limit what client (i.e. source address) is affected by IP address, IP address range, or MAC using "tags" (in dnsmasq terminology) -- as long as your machine is using DHCP in some way (dynamic or static, doesn't matter). However, if helloworld3000.com's IP address changes, you're SOL. Anyway, the capability is achieved through the alias directive in dnsmasq Custom Config. There are other threads that talk about this in depth.

    The "proper" way to do this -- and to my knowledge dnsmasq cannot do this (if someone more educated than me knows otherwise, please correct me and explain how) -- would be to make dnsmasq return, for foobar3000.com, a DNS CNAME record that points to helloworld3000.com. In that situation no IP addresses are involved; a client would try to resolve foobar3000.com, get shown a CNAME for helloworld3000.com (by dnsmasq), would then try to resolve helloworld3000.com and get back an IP address (as it would normally).

    Also be aware that a DNS lookup for foobar3000.com is not the same thing as a DNS lookup for www.foobar3000.com or ilikesnakes.foobar3000.com. If you really need that kind of wildcard support, you need to look into running your own DNS server (i.e. BIND). I myself do this to blackhole/blacklist certain domains, such as apps.skype.com, to keep ads from appearing in Skype.

Share This Page