LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 680|回复: 1

关于双网卡上网透明代理的问题

[复制链接]
发表于 2003-12-16 19:23:32 | 显示全部楼层 |阅读模式
我新装了一个网卡eth1,IP:192.168.0.1 MASK 255.255.255.0
原先的eth0 ,IP:外网地址,状态全部UP了,外网没有问题
eth1内网的ping 不通
eth0:218.x.x.x mask:255.255.255.252
eth1:192.168.0.1 mask:255.255.255.0
eth0外网没问题,用eth1内网ping其它内网的机器互相都是不通,我想实现内网的机器通过访问eth1实现上网功能,不知道在怎么设置
我的网卡都是8139,外网的,是光纤接入有因定IP,内网就是192.168.0.1,以前一个eth0的时候没问题,今天我把服务器由xp装成了linux7.2想做双网卡透明代理,现在就出现这个问题,请您多指教,真是不懂了
发表于 2003-12-17 11:18:41 | 显示全部楼层

回复: 关于双网卡上网透明代理的问题

最初由 yinglong 发表
我新装了一个网卡eth1,IP:192.168.0.1 MASK 255.255.255.0
原先的eth0 ,IP:外网地址,状态全部UP了,外网没有问题
eth1内网的ping 不通
eth0:218.x.x.x mask:255.255.255.252
eth1:192.168.0.1 mask:255.255.255.0
eth0外网没问题,用eth1内网ping其它内网的机器互相都是不通,我想实现内网的机器通过访问eth1实现上网功能,不知道在怎么设置
我的网卡都是8139,外网的,是光纤接入有因定IP,内网就是192.168.0.1,以前一个eth0的时候没问题,今天我把服务器由xp装成了linux7.2想做双网卡透明代理,现在就出现这个问题,请您多指教,真是不懂了


第一步:首先安装和配置好防火墙,我用的是 shorewall 防火墙
可以参考我的帖子:http://bbs.linuxsir.cn/showthread.php?threadid=78668

配置如下:

  1. cat /etc/shorewall/zones:
  2. ================================================
  3. wan        Internet         Internet
  4. lan        Lan              Lan
  5. ================================================

  6. cat /etc/shorewall/interfaces
  7. ================================================
  8. wan     eth0    detect
  9. lan     eth1    detect
  10. ================================================

  11. cat /etc/shorewall/masq
  12. ================================================
  13. eth0    192.168.0.0/24          218.x.x.x         #----- Lan Masq To Internet
  14. ================================================

  15. cat /etc/shorewall/policy
  16. ================================================
  17. fw      all     ACCEPT      # Firewall 可以任意访问所有区域,包括互联网
  18. lan     wan     ACCEPT      # Lan 可以任意访问互联网

  19. wan     all     DROP        # 互联网不能随意访问内部网络
  20. all     all     REJECT
  21. ================================================

  22. cat /etc/shorewall/rules    #配置透明代理
  23. ================================================
  24. ACCEPT          lan    fw            tcp     squid
  25. REDIRECT        lan  3128            tcp     80      -       -  
  26. ================================================
复制代码


第二步:配置SQUID代理服务器

  1. cat /etc/squid/squid.conf
  2. =============================
  3. http_port 3128

  4. visible_hostname localhost
  5. httpd_accel_host virtual
  6. httpd_accel_port 80
  7. httpd_accel_with_proxy on
  8. httpd_accel_uses_host_header on

  9. acl manager proto cache_object
  10. acl localhost src 127.0.0.1/255.255.255.255
  11. acl SSL_ports port 443 563
  12. acl Safe_ports port 80
  13. acl Safe_ports port 21
  14. acl Safe_ports port 443 563
  15. acl Safe_ports port 70
  16. acl Safe_ports port 210
  17. acl Safe_ports port 1025-65535
  18. acl Safe_ports port 280
  19. acl Safe_ports port 488
  20. acl Safe_ports port 591
  21. acl Safe_ports port 777

  22. acl all src 0.0.0.0/0.0.0.0
  23. acl lan src 192.168.0.0/24

  24. acl CONNECT method CONNECT
  25. acl QUERY urlpath_regex cgi-bin \?
  26. no_cache deny QUERY

  27. http_access allow lan
  28. http_access deny all
  29. icp_access allow all

复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表