简单 adsl 拨号和 squid 代理部署 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

一、             系统环境

OS as4u5i386

系统硬件: hp prolient g3 CPU2.4g*2  / mem 1g /disk 68 g

功能描述:可以实现基本的拨号共享和简单代理( adsl 无认证, squid 监控功能)

二、             系统图

 

                                                 Linux as4 u5

                                          eth0 10.1.8.137:3128 adsl +quid
 
 
 
三、             adsl 安装设置

(一)  安装(系统自带版本号大于 3.5.1 否则 rpm -uvh rp-ppoe-3.5.3.i386.rpm

(二)  设置

步骤如下:

#adsl-setup

 

1. 账号数字

2. 网卡 eth0 (作为代理的 ip

3. 断线后是否自动拨号 yes (包月) / no (其它)

4. 输入 dns ip 地址( adsl DNS 服务器)

5.adsl 密码

6. 是否允许普通用户关闭开启 adsl    yes (可以)

7 防火墙等级 0 (不启用)

8 启动时就拨号 no (普通) / yes (包月)

9. 摘要 输入 yes

 

共享网络连接

#iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

 

开机启动设置

1.chkconfig --add adsl

2.setup

3. 选择 system service

4. 选中 adsl

5.ok 退出

6. /etc/rc.d/rc.local 加入以下内容

 

echo "[ok]"

echo "Drop ICMP from anywhere"

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all

echo "[ok]"

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

 

通过 adsl-start adsl-stop adsl-status 控制 adsl 连接查看 ppp0 连接状况

 

 

QUESTIONS:

1 设置 dns 地址

/etc/resolv.conf

nameserver   192.168.1.100

2 如果 ppp0 没有启动

ifup PPP0

3. 查看网络连接

ifconfig -a  

ip 绑定网卡

ifconfig etho 192.168.1.1 然后重启网络服务

service network restart

route -n 查看默认网关是否设置正确

netconfig 更改默认网关

使用计时上网的用户需要去掉 eth0 的网关

 

四、             squid 安装设置

(一)  安装在

用系统自带的 disk2 \RedHat\RPMS \squid-2.5.STABLE14-1.4E

Rpm –ivh squid-2.5.STABLE14-1.4E.rpm

 

(二)  软件配置

/etc/squid/squid.conf 文件中加入如下内容

 

http_port 10.1.80.137( 代理 IP eth0 ):3128 (代理端口)

 

cache_dir ufs /var/spool/squid 100 16 256 

cache_access_log /var/log/squid/access.log

cache_log /var/log/squid/cache.log

cache_store_log /var/log/squid/store.log

pid_filename /var/log/squid.pid

 

#auth_param basic children 5

#auth_param basic realm Squid proxy-caching web server

#auth_param basic credentialsttl 2 hours

 

acl all src 0.0.0.0/0.0.0.0

http_access allow all 

 

cache_effective_user   squid

cache_effective_group  squid

 

3. 启动步骤

(1)squid –z (建立缓冲目录结构)

(2)sqiud start

注意:

如需管理加入一下内容:

#cp /usr/lib/squid/cachemgr.cgi /home/httpd/cgi-bin

在文件 /etc/http/conf/htttp.conf 加入以下内容:

<Location /cgi-bin/cachemgr.cgi>

AuthTypeBasic

AuthNamw"Squidadmin"

AuthUserFile/usr/local/squid/etc/squid.pwd

require valid-user

</Location>

生成密码文件

#cd /usr/local/squid/etc

#htpasswd -c squid.pwd squidadmin  " 创建密码文件 "

New passwd:

Re-type new passwd:

Adding passwd for user squidadmin

#chown apache:apche squid.pwd     将口令文件的属主改为 Apache

五、             客户端设置

IE 的代理服务器参数如下:

IP:10.1.80.137  端口号: 3128