Kali/Hotspot/Short: Difference between revisions
From charlesreid1
(Created page with "This is the short version of Kali/Hotspot: <pre> service dhcpcd start || service dhcpcd restart service dnsmasq start || service dnsmasq restart ifdown wlan2 || ifconfig...") |
(→Flags) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
This is the short version of [[Kali/Hotspot]]: | This is the short version of [[Kali/Hotspot]]: | ||
1. Edit the dhcp and dns config files for private wifi network | |||
<pre> | |||
# /etc/dhcpcd.conf | |||
interface wlan1 | |||
static ip_address=192.168.4.1/24 | |||
nohook wpa_supplicant | |||
</pre> | |||
<pre> | |||
# /etc/dnsmasq.conf | |||
interface=wlan1 | |||
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h | |||
</pre> | |||
2. Start the dhcp and dns services for private wifi network | |||
<pre> | <pre> | ||
service dhcpcd start || service dhcpcd restart | service dhcpcd start || service dhcpcd restart | ||
service dnsmasq start || service dnsmasq restart | service dnsmasq start || service dnsmasq restart | ||
</pre> | |||
3. Connect to existing wifi network with wlan2 | |||
<pre> | |||
ifdown wlan2 || ifconfig wlan2 down | ifdown wlan2 || ifconfig wlan2 down | ||
rfkill unblock wifi && rfkill unblock wlan | rfkill unblock wifi && rfkill unblock wlan | ||
sleep 3 | sleep 3 | ||
ifup wlan2 || ifconfig wlan2 up | ifup wlan2 || ifconfig wlan2 up | ||
</pre> | |||
4. Edit the hostapd config file | |||
<pre> | |||
# /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 | |||
</pre> | </pre> | ||
<pre> | |||
# /etc/default/hostapd | |||
DAEMON_CONF="/etc/hostapd/hostapd.conf" | |||
</pre> | |||
5. Start hostapd with wlan1 | |||
<pre> | |||
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 | |||
</pre> | |||
6. Configure wlan1 to pass packets to wlan2 | |||
<pre> | |||
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 | |||
</pre> | |||
=Flags= | =Flags= | ||
{{HotspotFlag}} | |||
{{KaliFlag}} | {{KaliFlag}} | ||
Latest revision as of 05:33, 2 December 2019
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
| hostapd, openvpn, and PIA setting up hostapd, openvpn, and PIA on kali linux
Kali/OpenVPN/Hotspot · Kali/OpenVPN/DNS · Kali/OpenVPN/PIA
|