I'm using Ubuntu Server and I have a SOCKS Proxy server on my client which is created with ssh -D command. I want to create a Wifi Hotspot on this computer which passes the traffic through this SOCKS Proxy. I'm connected to Internet through ethernet, so Wifi is idle.

Is this possible? How can I achieve this?

  • Both TCP and UDP traffic and the rest (e.g. ICMP) dropped?
    – phk
    Oct 25 '15 at 15:49

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 subnet and the incoming redsocks port is 12345 issue:

sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t nat -A PREROUTING -s -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

  • 1
    Is there a way to not have to run the iptables command every time?
    – becko
    Sep 3 '18 at 18:45
  • iptables-save , google
    – waza123
    Jul 11 '20 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.