Transparent proxy in squid 2.6

การ config transparent proxy ตั้งแต่ squid version 2.6 เป็นต้นไป ได้เปลี่ยนการตั้งค่าใหม่โดยใช้

http_port 3128 transparent

แทนการตั้งค่าแบบเก่าที่ต้องมี configuration มากมายหลายบรรทัด ตามตัวอย่างด้านล่าง

http_port 3128
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on

และให้เพิ่ม REDIRECT rule ของ iptables ด้วย

จากข้างบนจะสามารถ config transparent proxy ได้ตามขั้นตอนด้านล่างดังนี้

แก้ไขไฟล์ /etc/squid/squid.conf โดยให้แก้ไขบรรทัด http_port เป็นดังนี้

http_port 3128 transparent

จากนั้นให้ restart squid ด้สนคำสั่ง

[root@zylinux ~]# service squid restart

เซ็ต iptables สำหรับการ redirect การร้องขอใช้งาน port 80 ไปยัง port 3128

[root@zylinux ~]# iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

หลังจากทำตามขั้นตอนข้างต้นเสร็จแล้วทดสอบการใช้งานได้โดยให้เครื่อง client ชี้ gateway มาที่ squid server ตัวที่ได้ config ไว้

อ่านข้อมูลเพิ่มเติมสำหรับการ Setup squid transparent proxy ให้สามารถใช้ https

Related posts:

  1. Setup a transparent proxy over ssl https with Squid การนำ Squid มาทำ transparent proxy ส่วนใหญ่จะใน website ต่างๆจะบอกแต่วิธีทำ...
  2. Proxy Auto Configuration (PAC) – Proxy auto-config เรื่องนี้อาจจะเก่าสำหรับหลายๆคน แต่สำหรับผมแล้วเป็นเรื่องใหม่ เพราะเมื่อสองสามวันมานี้เกิดคำถามกับตัวเองว่า ถ้าเราต้องการใช้งาน proxy เฉพาะบางเวป และเวปที่อื่นๆให้ออกตรงโดยไม่ต้องผ่าน proxy...
  3. Squid fatal error: Could not determine fully qualified hostname ถ้าหากคุณเพิ่งติดตั้งเครื่องสำหรับทำ proxy server แล้วเจอ error ตามตัวอย่างด้านล่าง เมื่อทำการ start...
  4. Get Squid Performance Statistic from command line เมื่อต้องการทราบรายละเอียดการทำงานของ Squid เราสามารถใช้คำสั่ง squidclient เพื่อใช้ในการขอดูข้อมูลต่างๆ ใน Squid *...
  5. Increase the maximum file descriptors for Squid ถ้า squid คุณเกิดปัญหาหรือ error message ขึ้นว่า WARNING! Your...

You can leave a response, or trackback from your own site.

Leave a Reply