How to start a VPN hotspot in Linux (How to set up a proxy hotspot with Linux

1. You would need a USB WiFi that supports AP(access point) mode

Buy such one, because it’s cheaper than a wireless router.

2. Set up a v2ray client or any socks5 service on 127.0.0.1:1089

Just google, you can do it.

3. Install redsocks

sudo apt-get install redsocks
sudo vim /etc/redsocks.conf

Change local_ip to 0.0.0.0

Change local_port to 22345

Change ip to 127.0.0.1

Change port to 1089

sudo service redsocks restart

Now your redsocks listens on 0.0.0.0:22345

redsocks has a lot of bugs.

4. Install and Launch linux-wifi-hotspot

https://github.com/lakinduakash/linux-wifi-hotspot

sudo add-apt-repository ppa:lakinduakash/lwh 
sudo apt install linux-wifi-hotspot

sudo apt-get install rfkill
sudo rfkill unblock all

5. Set up the iptables

sudo iptables --table nat --list

sudo iptables -t nat -A PREROUTING -s 192.168.12.0/24 -p tcp -j REDIRECT --to-ports 22345

sudo sysctl -w net.ipv4.ip_forward=1

#sudo apt install iptables-persistent

6. Even more, let the Virtualbox go through the proxy

All you have to do is let your virtual system use only one bridged adopter, and attach the hotspot wif interface you created before to it.

7. More options than redsocks 

moproxy --port 22345 --socks5 1089

References

Author

https://github.com/yingshaoxo