This page covers how to connect a wifi hotspot created with hostapd with an OpenVPN connection with Kali Linux
This approach uses iptables to achieve the following configuration:
Set up the hotspot as described at Kali/Hotspot, but skip the section about connecting to an existing connection (which contains iptables commands). We'll run some different iptables commands to connect the wifi hotspot interface to the OpenVPN interface.
Just to summarize what Kali/Hotspot covers:
- install necessary software (dhcpcd, dnsmasq, hostapd)
- configure dhcpcd and dnsmasq
- start dhcp and dnsmasq
- configure hostapd
- start hostapd
Set up the OpenVPN connection, which will create an interface like
tun1 (we will use
See Kali/OpenVPN for details about how to set up OpenVPN
See Kali/OpenVPN/PIA for details about how to set up OpenVPN with PIA VPN service
Setting iptables rules
Now that we have set up OpenVPN to run the vpn on interface
tun1, we can set iptables rules to forward traffic between the hotspot and the OpenVPN interface.
We will modify the iptables rules from Kali/Hotspot to target the
tun1 interface instead of the
# flush the tables iptables -t nat -F iptables -F # add a postrouting rule to specify a mapping to an outgoing interface iptables -t nat -A POSTROUTING -o tun1 -j MASQUERADE # forward packets from wlan1 to tun1 iptables -A FORWARD -i wlan1 -o tun1 -j ACCEPT # enable ipv4 forwarding echo '1' > /proc/sys/net/ipv4/ip_forward
hostapd, openvpn, and PIAsetting up hostapd, openvpn, and PIA on kali linux Flags · Template:HotspotFlag · e
Kali Linux"The quieter you become, the more you are able to hear."
Penetration testing Linux distribution.
1 Physical Attacks: Kali/Layer 1 Attacks
2 Data/MAC Attacks: Kali/Layer 2 Attacks
3 Network Attacks: Kali/Layer 3 Attacks
4 Transport Attacks: Kali/Layer 4 Attacks
5 Session Attacks: Kali/Layer 5 Attacks
6 Presentation Attacks: Kali/Layer 6 Attacks
7 Application Attacks: Kali/Layer 7 Attacks
Red Team Blue Team
Kali on Raspberry Pi:
Flags · Template:KaliFlag · e
OpenVPNa tool for creating and connecting to virtual private networks.
Creating a Static Key VPN: OpenVPN/Static Key
Configuring Your DNS: DNS
Flags · Template:OpenVPNFlag · e