A主机:192.168.56.20
B主机:192.168.56.25
通过route路由的方式解决socks5转发的问题!!!
1、第一步A主机不能上网,那么我们用B主机先安装squid代理http、https连接:
B主机:
yum install -y squid systemctl restart squid
netstat -ntlp | grep squid tcp6 0 0 :::3128 :::* LISTEN 18330/(squid-1)
然后在A主机上:
export ALL_PROXY=http://192.168.56.25:3218
source /etc/profile2、第二步
在A主机和B主机上都装上route进程:
yum install -y net-tools
A主机route -n:
B主机route -n:
3、进行配置A :192.168.56.20 不能上网 B :192.168.56.25 能上网 A: 1.下一t跳到能上网机器: route add default gw 192.168.56.25 echo 'nameserver 114.114.114.114' >> /etc/resolv.conf echo 'nameserver 192.168.56.25' >> /etc/resolv.conf B: 1.开启路由转发: echo 1 > /proc/sys/net/ipv4/ip_forward 2.开启SNAT规则: iptables -F iptables -X iptables -t nat -A POSTROUTING -s 192.168.56.0/24 -j SNAT --to 10.0.3.15
192.168.56.25:B主机与A主机同局域网的ip
10.0.3.15:B主机能上网ip



