curl -x socks5://FcSw8:[email protected]:13425 https:/ip.cn
永久修改fd数量
vim /etc/security/limits.conf
修改以下
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
ubuntu情况下*需要改成指定用户例如root
root soft nproc 65535
root hard nproc 65535
root soft nofile 65535
root hard nofile 65535
树莓派dhcp服务器 isc-dhcp-server
现用:https://blog.csdn.net/weixin_43484014/article/details/109401772
临时修改fd数量
ulimit -HSn 65535
H硬性大小,S软性大小,数量
supervisord自己本身也有这个设置值
minfds=65535
查看进程fd
/proc/进程pid/fd
全局fd
ulimit -a 查看所有
ulimit -n 查看fd数量
ipv4流量转发./set
sysctl -a|grep ip_forward
sysctl -w net.ipv4.ip_forward=1
sysctl -a|grep ip_forward
防火墙清空
iptables -F -t nat
所有流量转发的防火墙规则
#!/usr/bin/env bash
iptables -t nat -X GATEWAY2SOCKS
#建立新表
iptables -t nat -N GATEWAY2SOCKS
#内网IP直接返回,不做转发
iptables -t nat -A GATEWAY2SOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 100.64.0.0/10 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 198.18.0.0/15 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -A GATEWAY2SOCKS -d 83.61.0.0/16 -j RETURN
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 74.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 8.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 202.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 199.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 47.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 128.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 69.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 104.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 103.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 31.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 58.49.136.3 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 162.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 172.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 192.133.0.0/16 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 216.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 174.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 142.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 23.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 157.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 59.0.0.0/8 -j REDIRECT –to-port 8081
iptables -t nat -I GATEWAY2SOCKS -p tcp -d 142.0.0.0/8 -j REDIRECT –to-port 8081
#TCP数据全部转发到8082端口
iptables -t nat -A GATEWAY2SOCKS -p tcp -j REDIRECT –to-port 8082
#最后是应用上面的规则,将OUTPUT出去的tcp流量全部经过SOCKS链
iptables -t nat -A PREROUTING -p tcp -j GATEWAY2SOCKS