免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1929 | 回复: 8

squid能否包含源地址转发? [复制链接]

论坛徽章:
0
发表于 2012-02-02 15:21 |显示全部楼层
我的squid代理服务器的IP地址是:1.1.1.1,我的域名也解析到这台squid代理服务器上,它的作用就是将用户的http请求转发到我的真实Http Server:2.2.2.2服务器上,请问,我如何配置squid代理,将用户的原始IP地址转发给我的真实服务器?
我在http服务器上看到的用户访问都是1.1.1.1,这不是我想要的,我希望我的squid转发到http Server上的是用户的真实IP地址。

论坛徽章:
0
发表于 2012-02-06 16:15 |显示全部楼层
有知道的吗?谁能帮我解答??

论坛徽章:
0
发表于 2012-02-06 20:52 |显示全部楼层
这个iptables上做个转发就好了,你看下iptables的相关知识就好了,没几天指令就搞定了

论坛徽章:
2
技术图书徽章
日期:2013-10-30 14:37:252015年亚洲杯之伊朗
日期:2015-04-30 13:37:02
发表于 2012-02-07 12:40 |显示全部楼层
可以,在官方的WIKI看到,未尝试。http://wiki.squid-cache.org/Squi ... ng_through_Squid.3F回复 1# zdm


   

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
发表于 2012-02-07 14:12 |显示全部楼层
回复 4# ajdan4q
  1. Can I make origin servers see the client's IP address when going through Squid?
  2. Normally you cannot. Most TCP/IP stacks do not allow applications to create sockets with the local endpoint assigned to a foreign IP address. However, some folks have some patches to Linux that allow exactly that.

  3. In this situation, you must ensure that all HTTP packets destined for the client IP addresses are routed to the Squid box. If the packets take another path, the real clients will send TCP resets to the origin servers, thereby breaking the connections.

复制代码
看那个,应该是直接实现不了吧

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
发表于 2012-02-07 14:12 |显示全部楼层
nginx可以实现楼主的想法.

论坛徽章:
0
发表于 2012-02-07 14:13 |显示全部楼层
回复 1# zdm


    如果是为了记录日志的话,有个x-forwarded-for吧。在squid上开启x-forwarded-for之后,你在2.2.2.2上面能看到这个http header。

论坛徽章:
9
2015亚冠之阿尔纳斯尔
日期:2015-09-10 16:21:162015亚冠之塔什干火车头
日期:2015-07-01 16:23:022015年亚洲杯之巴勒斯坦
日期:2015-04-20 17:19:46子鼠
日期:2014-11-13 09:51:26未羊
日期:2014-08-28 18:13:36技术图书徽章
日期:2014-02-21 09:30:15酉鸡
日期:2014-01-14 11:12:49天蝎座
日期:2013-12-09 17:56:53平安夜徽章
日期:2015-12-26 00:06:30
发表于 2012-02-07 17:36 |显示全部楼层
是的,7楼正解
follow_x_forwarded_for  allow  all

论坛徽章:
0
发表于 2012-03-25 12:30 |显示全部楼层
正解
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP