如何使用socks5代理设置热点

Sea*_*ene 5 networking linux proxy iptables socks

我有一台装有 linux 的笔记本电脑。笔记本电脑有两个网络接口:eth0 和 wlan0。平时我是通过eth0上网的,我已经成功在linux中设置了一个热点供我的kindle使用。重要代码如下:

# Enable NAT
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# Run access point daemon
sudo hostapd /etc/ap-hotspot.conf
Run Code Online (Sandbox Code Playgroud)

通常我想通过一个加密的socks5代理上网:127.0.0.1:10000,我想要全系统的代理,所以我安装了redsocks,它可以将所有TCP连接重定向到socks5代理。重要代码如下:

#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
Run Code Online (Sandbox Code Playgroud)

到目前为止,似乎一切都很好。我的kindle可以连接热点,在linux下可以通过全系统代理上网。问题是,我的kindle绕过socks5代理,直接上网。那么如何让我的kindle在使用热点时通过代理呢?我的意思是,如何在 linux 中执行此操作,因为无法在我的 Kindle 中设置代理。

小智 0

我没有任何使用 hostapd 的经验,但它很可能会修改路由表(甚至可能修改 iptables)。

启动 hostapd 后,运行一下可能是个好主意

网络统计-nr

iptables -t nat -L

iptables -t 过滤器 -L

并尝试找出数据包的去向。

然后,启动你的 redsocks 并重新审视完整的 iptables 设置

让我知道这些输出,我也许可以提供帮助