okaa

Socks5多IP代理搭建教程

安装SS5

yum install -y gcc openldap-devel pam-devel openssl-devel
wget http://jaist.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
tar -vzx -f ss5-3.8.9-8.tar.gz
cd ss5-3.8.9/
./configure
make
make install
chmod a+x /etc/init.d/ss5
service ss5 restart
vim /etc/opt/ss5/ss5.conf
vim /etc/opt/ss5/ss5.passwd
#端口号自己设置 注意开放你设置的端口号
# Add startup option here
SS5 0PTS=" -u root -b 0.0.0.0:1080"
service ss5 restart

 配置iptables

useradd admin1 -p aa123456
useradd admin2 -p aa123456
id admin1
id admin2
#配置用户admin1
iptables -t mangle -A OUTPUT -m owner --uid-owner 1000 -j MARK --set-mark 1000
iptables -t nat -A POSTROUTING -m mark --mark 1000 -j SNAT --to-source 192.168.0.48

#配置用户admin2
iptables -t mangle -A OUTPUT -m owner --uid-owner 1001 -j MARK --set-mark 1001
iptables -t nat -A POSTROUTING -m mark --mark 1001 -j SNAT --to-source 192.168.0.49
iptables -nvL -t nat
iptables -nvL -t mangle
service ss5 stop #由于服务启动无法写入,这里需要关闭
ss5 -u admin1 -b 192.168.0.48
ss5 -u admin2 -b 192.168.0.49
service ss5 start #关闭后再次启动
echo 'mkdir /var/run/ss5/' >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
/sbin/chkconfig ss5 on
service ss5 start && service ss5 status
退出移动版