Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 -R选项 一个问题 #26

Closed
cod1ingcoding opened this issue Jun 20, 2020 · 4 comments
Closed

关于 -R选项 一个问题 #26

cod1ingcoding opened this issue Jun 20, 2020 · 4 comments

Comments

@cod1ingcoding
Copy link

cod1ingcoding commented Jun 20, 2020

-R选项:使用 REDIRECT(DNAT) 而非 TPROXY(针对 TCP)。
-R 选项为什么会让 -b 127.0.0.1 设置无效,直接绑定0.0.0.0?
我记得REDIRECT同样可以转发数据到127.0.0.1,只是要设置内核参数
net.ipv4.conf.all.route_localnet=1

@zfl9
Copy link
Owner

zfl9 commented Jun 25, 2020

-R 选项为什么会让 -b 127.0.0.1 设置无效,直接绑定0.0.0.0?

只需要将 -R 选项放在 -b/-B 选项之前,他就有效了。

记得REDIRECT同样可以转发数据到127.0.0.1,只是要设置内核参数

谢谢你,我现在才知道可以这么做,哈哈。

@zfl9 zfl9 closed this as completed Jun 25, 2020
@zfl9
Copy link
Owner

zfl9 commented Jun 25, 2020

$ ipt2socks -R
2020-06-25 21:48:42 INF: [main] server address: 127.0.0.1#1080
2020-06-25 21:48:42 INF: [main] listen address: 0.0.0.0#60080
2020-06-25 21:48:42 INF: [main] listen address: ::#60080
2020-06-25 21:48:42 INF: [main] udp cache maximum size: 256
2020-06-25 21:48:42 INF: [main] udp socket idle timeout: 60
2020-06-25 21:48:42 INF: [main] number of worker threads: 1
2020-06-25 21:48:42 INF: [main] enable tcp transparent proxy
2020-06-25 21:48:42 INF: [main] enable udp transparent proxy
2020-06-25 21:48:42 INF: [main] use redirect instead of tproxy
^C
$ ipt2socks -R -b127.0.0.1 -B::1
2020-06-25 21:48:54 INF: [main] server address: 127.0.0.1#1080
2020-06-25 21:48:54 INF: [main] listen address: 127.0.0.1#60080
2020-06-25 21:48:54 INF: [main] listen address: ::1#60080
2020-06-25 21:48:54 INF: [main] udp cache maximum size: 256
2020-06-25 21:48:54 INF: [main] udp socket idle timeout: 60
2020-06-25 21:48:54 INF: [main] number of worker threads: 1
2020-06-25 21:48:54 INF: [main] enable tcp transparent proxy
2020-06-25 21:48:54 INF: [main] enable udp transparent proxy
2020-06-25 21:48:54 INF: [main] use redirect instead of tproxy

@zfl9
Copy link
Owner

zfl9 commented Jun 25, 2020

至于要不要改变这个默认行为,我个人愚见,就不改了(懒得改了~~)。我想大多数人也是不知道这个 sysctl 选项的。如果确实关心监听地址为 0:0:0:0,那么自己调换下选项的顺序即可,问题也不大。

@cod1ingcoding
Copy link
Author

cod1ingcoding commented Jun 29, 2020

只需要将 -R 选项放在 -b/-B 选项之前,他就有效了。

还有这种操作,好的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants