another way, quick and dirty, but works:
Redirect via iptables all http traffic directed at port 80 to another port of the router, e.g. port 81, except http traffic to the wanted URL.
In my case, wiithout use of br0:
/usr/sbin/iptables -t nat -A PREROUTING -p tcp --destination ! <ipaddr_URL> --dport 80 -i eth1 -j DNAT --to-destination <ipaddr_router>:81
/usr/sbin/iptables -t nat -A PREROUTING -p tcp --destination ! <ipaddr_URL> --dport 80 -i vlan0 -j DNAT --to-destination <ipaddr_router>:81
3. start via a script 'nc' to answer all calls on that port by spitting out a short html message which contains the redirect command. The script, e.g. //etc/init.d/S80redirect
################################
#!/bin/sh
IFS=" "
while :; do
/usr/bin/nc -l -p 81 < /www/redir.html > /dev/null
done &
################################
//www/redir.html:
#################################
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<html>
<head>
<title>Auto-Forward index.html</title>
<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=http://Your_wanted_URL">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>If you are not automatically forwarded, please click <a href="http://Your_wanted_URL">here</a>.
</body>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
</HTML>
##################################
In this way no http server is needed at all on the router !
in the above:
<ipaddr_URL> = ip address of the website you want the clients to go to.
<ipaddr_router> = ip address of the router the clients connect to.
Your_wanted_URL = web address of the website you want the clients to go.
As an alternative to using the script with endless loop with nc you could launch nc from xinet.
(Last edited by doddel on 24 Mar 2007, 11:55)