I am tring to setup a fake AP using my WLAN which when connected to causes all browsers to redirect to my apache server, where a fake login page is setup.
I've been struggling for a few days trying to set this up. I've not got the the stage where i can successfully create a AP using airbase and then have other clients connect to it and be given an IP address, using dhcpd3-server, not the isc-dhcp-server.
on my machine there are two interfaces eth1 which is connected to my LAN and wlan0. i do not want any connected clients access to the internet via eth1, i only want redirection to the local apache httpd server.
Below is the contents of my dhcpd.conf file and the two scripts which setup the AP and then configure the machine to handle DHCP requests.
dhcpd.cong
Code:
ddns-update-style ad-hoc;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.2.128 netmask 255.255.255.128 {
option subnet-mask 255.255.255.128;
option broadcast-address 192.168.2.255;
option routers 192.168.2.129;
option domain-name-servers 8.8.8.8;
range 192.168.2.130 192.168.2.140;
}
The below scripts creates and AP:
Code:
airmon-ng check kill
airmon-ng start wlan0 7
airbase-ng -e TESTER -a 6C:4C:A5:2F:6A:D1 -c 7 mon0
This script sets up the TAP interface,dhcpd, http and mysql daemons. The script executes fine and clients can connected and receive IP addresses but they will not redirect to my apache server.
Code:
ifconfig at0 up
ifconfig at0 192.168.2.129 netmask 255.255.255.128
route add -net 192.168.2.128 netmask 255.255.255.128 gw 192.168.2.129
touch /var/run/dhcpd.pid
chmod 777 /var/run/dhcpd.pid
dhcpd3 -cf /etc/dhcp3/dhcpd.conf -pf /var/run/dhcpd.pid at0
/etc/init.d/dhcp3-server start
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --append FORWARD --in-interface at0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
service mysql start
service apache2 start
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 000.000.00.000:80
Would anyone know what is causing the problem, I think its the IPTables commands.
Thanks for any feedback.