squid 투명 프락시 성공하신 분?
squid transparent proxy를 테스트 중입니다.
VMWare에 가상머신을 돌려 테스트하고 있는데요.
CentOS 5.4 32bit 가상 머신을 하나 올리고 가상 랜카드 2장을 달아 주었습니다. 게이트웨이 서버로 만들어 하단에 윈도서버2003 가상머신을 물렸습니다.
집에서 공유기를 쓰고 있어서 하나의 랜카드는 브릿지, 다른 하나는 NAT로 지정하였습니다.
그래서 브릿지 인터페이스 쪽은 공유기에서 직접 받은 192.168.0.0/24 네트웍에서 주소를 받습니다.
NAT 쪽은 10.0.0.0/24 네트웍을 쓰도록 했습니다. 인터페이스 주소는 10.0.0.254를 항당했습니다.
이 게이트웨이를 통해 통신하게 될 윈도2003은 10.0.0.10 주소를 할당했고 iptables의 마스커레이드 설정을 통해 인터넷이 가능토록 만들었습니다.
문제는 투명 프락시 세팅 문제입니다.
투명 프락시가 아닌 노말 프락시로 세팅하고 윈도2003의 익스플로러 인터넷옵션->연결->LAN 설정에서 프록시서버를 10.0.0.254로 지정하면 프록시를 거쳐 인터넷이 잘 되었습니다. 키워드 필터링 등의 acl 룰 적용도 모두 성공했고요.
▼ 투명 프락시 설정을 위해 iptables 설정을 아래와 같이 해주었습니다.
[root@localhost ~]# iptables -t nat -A PREROUTING -s 10.0.0.0/24 -p tcp --dport 80 -j REDIRECT --to-port 3128
[root@localhost ~]# iptables -nL -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT tcp -- 10.0.0.0/24 0.0.0.0/0 tcp dpt:80 redir ports 3128
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 10.0.0.0/24 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@localhost ~]#
▼ 그리고 인터넷 각종 겁색을 통해 나온 squid 투명 프락시 설정을 위한 옵션을 추가해 주었습니다. 아래 것입니다.
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
▼ 적용하고 스퀴드를 리스타트하면 에러가 납니다. 그래도 스퀴드는 올라오긴 합니다.
[root@localhost squid]# /etc/init.d/squid restart
squid 를 정지 중: 2010/01/28 15:32:09| parseConfigFile: line 406 unrecognized: 'httpd_accel_host virtual'
2010/01/28 15:32:09| parseConfigFile: line 407 unrecognized: 'httpd_accel_port 80'
2010/01/28 15:32:09| parseConfigFile: line 408 unrecognized: 'httpd_accel_with_proxy on'
2010/01/28 15:32:09| parseConfigFile: line 409 unrecognized: 'httpd_accel_uses_host_header on'
. [ OK ]
squid (을)를 시작 중: . [ OK ]
[root@localhost squid]#
▼ 웹브라우저로 아무 사이트나 접속해보면 아래와 같은 메시지가 뜹니다.
에러
요청된 URL을 가져올 수 없습니다.
--------------------------------------------------------------------------------
다음 요청을 처리 하던 중:
GET / HTTP/1.1
Accept: */*
Accept-Language: ko
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
Host: www.google.co.kr
Connection: Keep-Alive
Cookie: PREF=ID=66146b17fe09a005:U=6ad0394c20433fb2:NW=1:TM=1263473187:LM=1263473195:S=3q4XoCCHfRABgeqc; NID=30=xTd5a8YvdGiqSXBtDEMLWhvCo5qTcqQa-jCP8gDH2lYzDhOrwRbjZFvL7fE0FWt7ajW7nUS9zgDx6E0ccNt23uQnRUg-KA7Iwd3N8aRCZar6rN2mt-6MjMJ1TdB53wrY
아래와 같은 에러가 발생했습니다:
잘못된 요청
HTTP 요청 방법중 다음과 같은 부분이 잘못될 수 있습니다.
Request method가 잘못되었거나 빠져 있다.
URL이 빠져 있다.
HTTP Identifier (HTTP/1.0)이 빠져 있다.
Request가 너무 크다.
POST나 PUT 요청일 경우 Content-Length가 빠져 있다.
호스트네임에 잘못 된 문자가 있다; 밑줄은 허용되지 않습니다.
--------------------------------------------------------------------------------
Generated Thu, 28 Jan 2010 06:13:58 GMT by localhost.localdomain (squid/2.6.STABLE21)
해결책 아시는 분들의 조언을 간곡히 기다립니다.
자답입니다.squid
자답입니다.
squid 최신 버전으로 와서는 transparent mode 적용 방법에 변화가 있나 보군요.
검색하면 나오는 문서들 태반이 아래 옵션을 squid.conf에 적용하라는데...
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
CentOS 5.4 32bit에 기본 지원되는 squid rpm 버전은 squid-2.6.STABLE21-3.el5입니다.
걍 http_port 3128 옵션 뒤에 transparent라고 추가만 해주면 되네요.
http://kuscsik.blogspot.com/2008/01/transparent-proxy-with-squid-3-on.html
[root@localhost ~]# cat /etc/squid/squid.conf | grep transparent
# WARNING: authentication can't be used in a transparently intercepting
# transparently intercepting port 80, not a limitation in Squid.
# # NOTE: proxy_auth can't be used in a transparent proxy as
# transparent Support for transparent interception of
http_port 3128 transparent
# Pack 1 has an issue with transparent proxies, wherein it
# In many setups of transparently intercepting proxies Path-MTU
[root@localhost ~]#
댓글 달기