From charlesreid1

This is the short version of Kali/Hotspot:

1. Edit the dhcp and dns config files for private wifi network

# /etc/dhcpcd.conf
interface wlan1
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant
# /etc/dnsmasq.conf
interface=wlan1
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h

2. Start the dhcp and dns services for private wifi network

service dhcpcd start || service dhcpcd restart
service dnsmasq start || service dnsmasq restart

3. Connect to existing wifi network with wlan2

ifdown wlan2 || ifconfig wlan2 down
rfkill unblock wifi && rfkill unblock wlan
sleep 3
ifup wlan2 || ifconfig wlan2 up

4. Edit the hostapd config file

# /etc/hostapd/hostapd.conf
interface=wlan1
driver=nl80211
ssid=MyLittlePony
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=AardvarkBadgerHedgehog
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# /etc/default/hostapd
DAEMON_CONF="/etc/hostapd/hostapd.conf"

5. Start hostapd with wlan1

ifconfig wan1 down
rfkill unblock wifi
rfkill unblock wlan
ifconfig wlan1 192.168.4.1/24 up
# restart the dhcp service too
service dhcpcd start || service dhcpcd restart
service hostapd start || service hostapd restart

6. Configure wlan1 to pass packets to wlan2

iptables -t nat -F
iptables -F
iptables -t nat -A POSTROUTING -o wlan2 -j MASQUERADE
iptables -A FORWARD -i wlan1 -o wlan2 -j ACCEPT
echo '1' > /proc/sys/net/ipv4/ip_forward
service hostapd restart

Flags