kali linux虚拟wifi搭建

1、设置DHCP:

leaf /etc/dhcp/dhcpd.conf   编辑dhcp服务器配置文件,修改如下:


authoritative;


default-lease-time 700;

max-lease-time 8000;


subnet 10.0.0.0 netmask 255.255.255.0 {

option routers 10.0.0.1;

option subnet-mask 255.255.255.0;


option domain-name "FreeWiFi";

option domain-name-servers 10.0.0.1;


range 10.0.0.10 10.0.0.100;


}



2、启动激活网卡至监听模式:
airmon-ng start wlan0
airbase-ng -e FreeWiFi -c 6 mon0

3、热点的网络流量会被虚拟到at0这块网卡上面

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
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

4、IP转发
echo 1 > /proc/sys/net/ipv4/ip_forward 

5、配置NAT转换  
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE  #对eth0进行源nat
iptables -A FORWARD -i wlan1 -o eth0 -j ACCEPT     
iptables --append FORWARD --in-interface at0 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000

6、开启dhcp

dhcpd -cf /etc/dhcp/dhcpd.conf -pf /var/run/dhcpd.pid at0
/etc/init.d/isc-dhcp-server start


你可能感兴趣的:(kali linux虚拟wifi搭建)