OpenWrt Forum Archive

Topic: How can I rewrite domain name to use with redirecting to specific webs

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

How can I rewrite domain name to use with redirecting to specific website.

Example
        Wifi user visits http://facebook.com/photos.php?photo=1
        Address bar will still say http://facebook.com/photos.php?photo=1
        Browser displays the content of http://hotmalldeals.com/photos.php?photo=1

Nodogsplash and Chillispot seems like its a splash page then it gives access to internet this router is simply to keep people on my website only.

Is there any way to do this using only iptables or dns server?

See DNS and DHCP configuration

Set up in /etc/config/dhcp:

config domain
        option name             'facebook.com'
        option ip               '69.174.255.254'

Where 69.174.255.254 is hotmalldeals.com IP adress.

Also you can use Privoxy for advanced filtering capability.

Is this something that is possible to rewrite all domain names to my IP?
       

config domain
        option name             '*'
        option ip               '69.174.255.254'

Basically I would like any domain name visited to silently browse my website with the URL intact so the links in the website works.

Try some transparent proxy: tinyproxy, squid etc.
If proxy works on the router, then run:

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8888

If proxy works on other host (69.174.255.254 for example), then run on router:

iptables -t nat -A PREROUTING -i br-lan -s ! 69.174.255.254 -p tcp --dport 80 -j DNAT --to 69.174.255.254:8888
iptables -t nat -A POSTROUTING -o br-lan -s 192.168.1.0/24 -d 69.174.255.254 -j SNAT --to 192.168.1.1
iptables -A FORWARD -s 192.168.1.0/24 -d 69.174.255.254 -i br-lan -o br-lan -p tcp --dport 8888 -j ACCEPT

Traffic will be redirected to the proxy server. On the proxy you can manage traffic.

Black Roland I will be glad to pay you to help me set that up using teamviewer if you are willing.  I am still waiting for my router to come in the mail from china with Attitude Adjustment preloaded.

Hey, I wanted to do a similar thing, redirect all traffic to a certain web page.
Doing this is called Rick Rolling.

I found this website:
http://hak5.org/hack/auto-rickrolling-wifi-pineapple.

Just follow the steps and change 192.168.1.1 for the address you want.

You don't need a wifi pineapple or jasager just an openwrt router with dnsmasq.

The discussion might have continued from here.