IP代理服务器搭建(含拨号)

Squid Install

Centos

#!/bin/bash
yum install openssl -y
yum install squid -y
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
yum install httpd-tools -y
htpasswd  -cb /etc/squid/passwd  username password #用户名和密码
echo '
via off 
forwarded_for transparent
access_log /var/log/squid/access.log
cache_mem 64 MB
auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd
acl auth_user proxy_auth REQUIRED
http_access allow auth_user
maximum_object_size 4 MB
cache_dir ufs /var/spool/squid 100 16 256
http_port 3389
http_access allow all
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0%  0
refresh_pattern . 0 20% 4320
httpd_suppress_version_string on
via off
forwarded_for delete
'> /etc/squid/squid.conf
systemctl stop   squid
squid -z 
sleep 5
systemctl start   squid
systemctl enable squid.service

Ubuntu

#!/bin/bash
apt-get install openssl -y
apt-get install squid -y
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
apt-get install apache2 -y
htpasswd  -cb /etc/squid/passwd  username password #用户名和密码
echo '
via off 
forwarded_for transparent
access_log /var/log/squid/access.log
cache_mem 64 MB
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
acl auth_user proxy_auth REQUIRED
http_access allow auth_user
maximum_object_size 4 MB
cache_dir ufs /var/spool/squid 100 16 256
http_port 3389
http_access allow all
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0%  0
refresh_pattern . 0 20% 4320
httpd_suppress_version_string on
via off
forwarded_for delete
'> /etc/squid/squid.conf
systemctl stop   squid
squid -z 
sleep 5
systemctl start   squid
systemctl enable squid.service

安装拨号服务

mkdir /opt/linux_ic
mkdir /media2
chmod +x /etc/rc.local
vi /etc/rc.local
yum -y install cpan
ln -s /usr/lib/libperl.so.5.10.1 /usr/lib/libperl.so
yum install kernel-devel xinetd gcc gcc-c perl-devel perl-ExtUtils-Embed
cpan PAR::Packer
pp
perl -v
cpan pp
perl -MCPAN -e shell
cpan pp
reboot
ifconfig
ipconfig
yum search ifconfig
ipconfig
yum install net-tools.x86_64
ifconfig
nmcli con
cpan pp
pp
init 0
ifconfig
vi /etc/sysconfig/network-scripts/ifcfg-eth0
cd /opt/
ll
vi /etc/ppp/chap-secrets
passwd
init 0
init 0
ifconfig
cat /etc/ppp/chap-secrets
cd /opt/
ll
vi /etc/rc.local
vi /etc/sysconfig/network-scripts/ifcfg-eth0
passwd
init 0
ping baidu.com
ifconfig
pppoe-setup
pppoe-start
ping baidu.com

查看拨号账号&密码

cat /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
"pld19447385@163"       *       "19447385"
"057627764253"  *       "587976"
"056491398317"  *       "666888"

自动拨号

#!/bin/bash
pppoe-stop
sleep 5
pppoe-start