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
    Commented Oct 25, 2015 at 15:49

1 Answer 1


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?
    – a06e
    Commented Sep 3, 2018 at 18:45
  • iptables-save , google
    – jmp
    Commented Jul 11, 2020 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .