Online Book Reader

Home Category

Squid_ The Definitive Guide - Duane Wessels [79]

By Root 1934 0
information:

Router Identifier: 172.16.102.129

Protocol Version: 1.0

Service Identifier: web-cache

Number of Cache Engines: 1

Number of routers: 1

Total Packets Redirected: 1424

Redirect access-list: -none-

Total Packets Denied Redirect: 0

Total Packets Unassigned: 0

Group access-list: -none-

Total Messages Denied to Group: 0

Total Authentication failures: 0

For a few more details, add the word detail to the end of the previous command:

router#show ip wccp web-cache detail

WCCP Cache-Engine information:

IP Address: 172.16.102.66

Protocol Version: 0.4

State: Usable

Initial Hash Info: 00000000000000000000000000000000

00000000000000000000000000000000

Assigned Hash Info: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

Hash Allotment: 256 (100.00%)

Packets Redirected: 1424

Connect Time: 00:17:40

Here you can see Squid's IP address and state. If more than one cache speaks WCCP to the router, the hash assignment information should look different. Most likely, each cache receives an equal proportion of the hash buckets.

Note that the detailed output has a Protocol Version line with a different value than the first command. Unfortunately, the word "version" is overloaded. The show ip wccp web-cache command appears to report the WCCP protocol major version number (i.e., 1 or 2), while the detail version seems to be a different (perhaps internal, or minor version) number that matches the value of Squid's wccp_version directive.

* * *

[2] At various times it has also been called Web Cache Control Protocol.

Operating System Tweaks

You must enable certain networking features in your operating system to make interception caching work. First, you need to enable IP packet forwarding. This allows the operating system to receive packets with foreign destination addresses. Second, you must enable and configure optional code in the kernel that redirects the foreign packets to Squid.

Linux

The instructions in this section should work for the 2.4 series of Linux kernels. I used RedHat Linux 7.2 (kernel 2.4.7-10). If you are using an older or newer version, these may not work. I recommend searching the Squid FAQ and other places for updated or historical information.

In my tests with iptables, it wasn't necessary to enable IP forwarding. However, you may want to enable it initially and see if you can disable it after everything else is working. The best way to enable packet forwarding is to add this line to /etc/sysctl.conf:

net.ipv4.ip_forward = 1

Most likely you'll need to make a new kernel before HTTP interception will work. See O'Reilly's Running Linux by Matt Welsh, Matthias Kalle Dalheimer, and Lar Kaufman, if you don't know how to configure and create a Linux kernel. When you configure the kernel, make sure these options are enabled:

o General setup

Networking support (CONFIG_NET=y)

Sysctl support (CONFIG_SYSCTL=y)

o Networking options

Network packet filtering (CONFIG_NETFILTER=y)

TCP/IP networking (CONFIG_INET=y)

Netfilter Configuration

Connection tracking (CONFIG_IP_NF_CONNTRACK=y)

IP tables support (CONFIG_IP_NF_IPTABLES=y)

Full NAT (CONFIG_IP_NF_NAT=y)

REDIRECT target support (CONFIG_IP_NF_TARGET_REDIRECT=y)

o File systems

/proc filesystem support (CONFIG_PROC_FS=y)

Additionally, make sure this option isn't enabled:

o Networking options

Fast switching (CONFIG_NET_FASTROUTE=n)

The code that redirects foreign packets to Squid is part of the Netfilter software. Here is a rule that sends the intercepted HTTP connections to Squid:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

The Linux kernel maintains a number of different tables. The -t nat option indicates that we are modifying the Network Address Translation (NAT) table. In essence, we're using iptables to translate origin server TCP/IP addresses to Squid's local TCP/IP address.

Each iptables table has a number of chains. The -A PREROUTING option indicates that we are appending a rule to the built-in chain named PREROUTING. The PREROUTING chain applies only to

Return Main Page Previous Page Next Page

®Online Book Reader