Kali/OpenVPN/Hotspot: Difference between revisions
From charlesreid1
(Created page with "This page covers how to connect a wifi hotspot created with hostapd with an OpenVPN connection with Kali Linux This approach uses iptables ==Setup== Set up the hotspot as d...") |
No edit summary |
||
| (9 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
This page covers how to connect a wifi hotspot created with hostapd with an OpenVPN connection with Kali Linux | This page covers how to connect a wifi hotspot created with hostapd with an OpenVPN connection with Kali Linux | ||
This approach uses iptables | This approach uses iptables to achieve the following configuration: | ||
[[Image:Hostapd_diagram.png|500px]] | |||
Set up the hotspot as described at [[Kali/Hotspot]], but skip the iptables commands | ==Setup Hotspot== | ||
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 | |||
==Setup OpenVPN== | |||
Set up the OpenVPN connection, which will create an interface like <code>tun0</code> or <code>tun1</code> (we will use <code>tun1</code>) | Set up the OpenVPN connection, which will create an interface like <code>tun0</code> or <code>tun1</code> (we will use <code>tun1</code>) | ||
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 <code>tun1</code>, 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 <code>tun1</code> interface instead of the <code>wlan2</code> interface. | We will modify the iptables rules from [[Kali/Hotspot]] to target the <code>tun1</code> interface instead of the <code>wlan2</code> interface. | ||
| Line 25: | Line 45: | ||
echo '1' > /proc/sys/net/ipv4/ip_forward | echo '1' > /proc/sys/net/ipv4/ip_forward | ||
</pre> | </pre> | ||
==Flags== | |||
{{HotspotFlag}} | |||
{{KaliFlag}} | |||
{{OpenVPNFlag}} | |||
[[Category:Iptables]] | |||
Latest revision as of 03:32, 10 July 2020
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:
Setup Hotspot
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
Setup OpenVPN
Set up the OpenVPN connection, which will create an interface like tun0 or tun1 (we will use tun1)
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 wlan2 interface.
# 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
Flags
| hostapd, openvpn, and PIA setting up hostapd, openvpn, and PIA on kali linux
Kali/OpenVPN/Hotspot · Kali/OpenVPN/DNS · Kali/OpenVPN/PIA
|
| OpenVPN a tool for creating and connecting to virtual private networks.
Creating a Static Key VPN: OpenVPN/Static Key Configuring Your DNS: DNS
|