lakinduakash / linux-wifi-hotspot

Feature-rich wifi hotspot creator for Linux which provides both GUI and command-line interface. It is also able to create a hotspot using the same wifi card which is connected to an AP already ( Similar to Windows 10).
BSD 2-Clause "Simplified" License
3.04k stars 282 forks source link

VPN Hotspot seems not to work #345

Open adrianf0 opened 10 months ago

adrianf0 commented 10 months ago

OS: Ubuntu 22.04 LTS

I have a network interface wlp3s0. It has access to the Internet. The default gateway points to this interface.

I created a VPN using OpenVPN. In the OpenVPN configuration, I don't set a gateway (e.g. redirect-gateway def1 option). OpenVPN creates tun0 interface. I want only the hotspot's traffic to be routed through the VPN, not the whole traffic.

As indicated in the manual, I select this tun0 interface as "Internet Inteface" in wihotspot GUI.

My routing table looks like:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         funbox.home     0.0.0.0         UG    600    0        0 wlp3s0
10.8.0.1        10.8.0.5        255.255.255.255 UGH   0      0        0 tun0
10.8.0.5        0.0.0.0         255.255.255.255 UH    0      0        0 tun0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 virbr0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker_gwbridge
172.19.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-63fdebda51a3
172.30.0.0      0.0.0.0         255.255.0.0     U     0      0        0 br-58acc2e29777
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 wlp3s0
192.168.12.0    0.0.0.0         255.255.255.0   U     0      0        0 ap0
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr0

Bug: The client connected to AP is routed through the default wlp3s0's gateway anyway, not VPN: pages like https://whatismyipaddress.com/ will indicate the IP address of wlp3s0 Internet provider rather than VPN's.