Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->新闻动态 ->Linux新闻 ->正文

Linux下宽带设置使局域网连接互联网

来源: 作者: 时间:2007-04-11 点击: [收藏] [投稿]

例如192.168.100.123/24.不要设置默认路由(网关),DNS设置为广州地区(61.144.56.100),

其它

地区的相应改动为本地区的DNS. 在/etc/rc.d/目录下用touch命令建立firewall文件,执行

chmod u+x firewall以改变文件属性,编辑/etc/rc.d/rc.local文件,在末尾加上/etc/rc.d

/firewall以确保开机时能自动运行该脚本。

firewall内容为:

#!/bin/sh echo “Enable IP Forwarding…
echo “1″>/proc/sys/net/ipv4/ip_forward echo ”Starting iptables 
rules…“/sbin/modprobe iptable_filter /sbin/modprobe ip_tables /
sbin/modprobe iptable_nat #Refresh all chains /sbin/iptables -F -t nat 
iptables -t nat -A POSTROUTING -s

192.168.0.0/24 -o ppp0 -j MMASQUERADE客户端设置(windows98/2000/xp、linux)网关

设置为这台linux地址(192.168.100.123),DNS设置为61.144.56.100.

透明代理配置代理软件squid:

编辑/usr/local/squid/etc/squid.conf,修改以下内容,确保以下配置:

http_port 192.168.100.123:8080

cache_mem 48 MB acl all src 0.0.0.0/0.0.0.0 acl 
manager proto cache_object acl localhost src 127.0.0.1/255.255.255.255
 acl SSL_ports port 443 563 acl Safe_ports port 80 # http acl 
Safe_ports port 21 # ftp acl Safe_ports port 443 563 # https, snews 
acl Safe_ports port 70 # gopher acl Safe_ports port 210 # wais acl 
Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port280 
# http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 
591 # filemakāer acl Safe_ports port 777 # multiling http acl CONNECT 
method CONNECT acl flag src 192.168.100.0/255.255.255.0 httpd_accel_host
 virtual httpd_accel_port 80 httpd_accel_with_proxy on httpd_accel_
uses_host_header on cache_effective_user nobody cache_
effective_group nobody http_access allow flag
http_access deny all

(限制只允许局域网用户使用代理,具体可以参考squid手册中关于Access Control Lists的

内容来限制访问代理)

cache_dir ufs /var/spool/squid 100 16 256

cache_dir type Directory-Name Mbytes Level-1 Level2

(说明:指定squid用来存储对象的交换空间的大小及其目录结构。可以用多个cache_dir命令来

定义多个这样的交换空间,并且这些交换空间可以分布不同的磁盘分区。“directory ”指明了

该交换空间的顶 级目录。如果你想用整个磁盘来作为交换空间,那么你可以把该目录作为装载点

把整个磁盘mount上去。缺省值为/var/spool/squid.“Mbytes”定义了可用的空间总量。需要注

意的是,squid进程必须拥有对该目录的读写权力。“Level-1″是可以在该顶级目录下建立的第

一级子目录的数目,缺省值为16.同理,”Level-2″是可以建立的第二级子目录的数目,缺省值

为256.为什么要定义这么多子目录呢?这是因为如果子目录太少,则存储在一个子目录下的文件

数目把大大增加,这也会导致系统寻找某一个文件的时间大大增加。

()

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:新闻观察:Linux KDE-3.5.3测试版释出   下一篇:关注新闻:微软难走开放源代码之路

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号