# captive portal (sorta)

## chinkypyro

Hi,

I am currently playing around with madwifi in master mode and I have everything up and running fine. I also have apache running on the access point. Currently the AP does not have a connection to the internet.

This is what I am trying to do.

Whenever a associated client tries to access an external page, i.e. www.google.com, they should get a page that is hosted locally by apache on the AP.

I've tried playing around with dnsmasq, but could not figure out how to do it for all external pages, only pages from specific domains. I have a feeling this is the wrong tool for the job.

I also tried to get NoCatSplash working, but it kept complaining that there was no external device since I did not have a connection to the internet.

Any suggestions?

----------

## Kruegi

You need to redirect the packets with your firewall. Look for a guide how to setup a transparent proxy. It works similar.

On your webserver you'll need some rewrite rules to cover all URLs.

Thomas

----------

## chinkypyro

thanks for the help Kruegi, I think I managed to get iptables to forward the traffic to apache.

would you mind elaborating on how to reconfigure apache so that it covers all URLs?

----------

## Kruegi

Configure a vitual host (e.g. "wlan.local"):

```
ServerName wlan.local

[...]
```

This will be the site displayed to the WLAN users.

Now configure your default host (maybe for one special IP where you are forwarding the packets to):

```
[...]

RewriteEgine On

RewriteRule .* http://wlan.user/ [l,r]

```

Don't forget the wlan.local DNS entry.

Thomas

----------

