captive portal, self to self nat etc.

Hi and sorry for my english :)

Preambule:
I'm not new to FreeBSD, and I'd like to setup some kind of "admin-eye-candy" - captive portal :)
Our organization use Squid proxy, port 80 closed from inside, so if user disable proxy - he has no internet connection. I'd like to redirect all connection from inside to my web-server (on the same server as Squid and default gateway) with info page that saying "Hey, turn it up!" :)
I'm using ipfw and I don't like to recompile the kernel or ipfw to use "ipfw fwd"+transproxy or something like that. I don't like to use pf either.
Is it possible to do with nat?

Ok. Environment:
- Freebsd 8
- Server IP 192.168.0.10
- webserver IP 192.168.0.10
- Internal net 192.168.0.0/24
- IPFW nat 1 config if wan

here: http://gara.opennet.ru/http_redirect.html (RUSSIAN) i was found same thing (using natd), but server is on another host. Whats the matter? interface & ip. If www on another host, packet returned from lan, but on my server it's from lo0 (loopback interface) and have same ip as server (ok, i can use aliases if needed)

What i have:
here is my packet flow now (192.168.0.18 - test client from int net, 217.69.128.41 - mail.ru [telnet mail.ru 80 from client] (i'm using ipfw nat, but here is log from natd, becouse it more visual as i see))

Code:
Out {default}[TCP]  [TCP] 192.168.0.18:1648 -> 217.69.128.41:80 aliased to
           [TCP] SERVER_EXTERNAL_IP:1648 -> 217.69.128.41:80
In  {default}[TCP]  [TCP] 217.69.128.41:80 -> SERVER_EXTERNAL_IP:1648 aliased to
           [TCP] 217.69.128.41:80 -> 192.168.0.18:1648

I would like it will be:
Code:
Out {default}[TCP]  [TCP] 192.168.0.18:1648 -> 217.69.128.41:80 aliased to
           [TCP] 192.168.0.10:1648 -> 192.168.0.10:80
In  {default}[TCP]  [TCP] 192.168.0.10:80 -> 192.168.0.10:1648 aliased to
           [TCP] 217.69.128.41:80 -> 192.168.0.18:1648

I think solution will be very simple.I think i can use -proxy_rule or -redirect_address, but i cant understand how
Please help :)
 
Ok.

Code:
00003 divert 8668 ip from 192.168.0.18 to not 192.168.0.10 dst-port 80
00004 divert 8668 ip from 192.168.0.1 80 to any

Code:
natd -v -n lan -reverse -proxy_rule port 80 server 192.168.0.1:80

192.168.0.1 = 192.168.0.10 (alias)

how i can do this with ipfw?
 
Back
Top