I have a laptop with linux installed on it. The laptop has two network interfaces: eth0 and wlan0. Normally I surf the Internet through eth0, and I've successfully set up a hotspot in linux for my kindle to use. Important codes are as follows:
# Enable NAT
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Run access point daemon
sudo hostapd /etc/ap-hotspot.conf
Usually I would like to surf the Internet through an encrypted socks5 proxy: 127.0.0.1:10000, and I want the proxy system-wide, so I installed redsocks, which can redirect all the TCP connections to the socks5 proxy. Important codes are as follows:
#redsocks requires all the data to be redirected to port 12345, and the socks5 address and port(127.0.0.1:10000) has been written to redsocks's configuration file.
sudo iptables -t nat -A OUTPUT -p tcp -j REDIRECT --to-port 12345
So far, It seems everything works great. My kindle can connect to the hotspot, and I can surf the Internet through a system-wide proxy in linux. The problem is, my kindle bypasses the socks5 proxy and connects to the Internet directly. So how to make my kindle go through the proxy when using the hotspot? I mean, how to do it in linux, because there's no way to set up a proxy in my kindle.