# Small pf nightblock project.



## svensmikael (Jun 16, 2011)

Hi Everyone,

I'm new to this forum and my English is terrible but hopefully you will understand what I'm trying to say.

I'm planning on doing a small "impelemtation" to my existing FreeBSD gateway (acting gateway/firewall and running apache/mysql/php etc) I have at home.

The thing is rather complicated to explain but I want to do an automatic perl script which is shutting down the internet connection at a certain time and open the connection again at another time. That is not the problem - I use a perl-scipt with pf anchors and crontab to fix that part but I also want, when the connection is shut down, to redirect all outgoing traffic from the internal network to a special php-login page running from my apache webserver. To clairify, when the connection is down no one from the internal network is able to reach pages on the internet but will instead be redirected to a login page which is able to open the network by typing a password or it will be done automatically in the morning again.

(the php-login page is operating by creating a txt file with some content like "open" or "closed" and the perl-script will read the file by a cronjob and then open or close the connection to the Internet by using pf rules).

I want some pf redirect rule to redirect all outgoing traffic from the internal network to my own apache hosted site on the gateway.

Please give me some tip or a push in the right direction.

Thanks in advance.

Regards
Mikael


----------

