I know I can use ap-hotspot to configure a wifi hotspot in normal connection. But what is I'm connected to internet via a socks proxy? How can I share internet to my mobile devices then?
1 Answer
The ap-hotspot
solution is slightly out of date and has the added disadvantages of being complicated and incompatible with socks proxies. A simpler solution is to use ubuntu's built in network-manager
to create the hotspot as detailed by http://ubuntuhandbook.org/index.php/2014/09/3-ways-create-wifi-hotspot-ubuntu/
TCP traffic from the hotspot can be passed through the ssh -D
socks proxy using redsocks
. With redsocks
installed and configured one can use iptables
to redirect all traffic from the wifi hotspot to redsocks
which then passes it through the socks proxy.
For instance if your wifi hotspot is on the 10.42.0.1/24
subnet and the incoming redsocks
port is 12345
issue:
sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t nat -A PREROUTING -s 10.42.0.0/24 -p tcp -j REDIRECT --to-ports 12345
For a detailed set of instructions visit http://abidmujtaba.blogspot.com/2016/07/ubuntu-create-wifi-hotspot-access-point.html
-
-
ip addr show dev <interface>
will have aninet
field giving you the address and subnet. For interfacewlo1
running this command on my computer givesinet 192.168.1.153/24
so I would use192.168.1.0/24
in myiptables
command. Jan 5, 2019 at 17:57