Online Book Reader

Home Category

Squid_ The Definitive Guide - Duane Wessels [77]

By Root 1916 0
1

create vlan Internet

configure Internet ip 172.16.102.129 255.255.255.192

configure Internet add port 2

create vlan Squid

configure Squid ip 172.16.102.65 255.255.255.192

configure Squid add port 3

The next step is to enable and configure routing in the switch:

enable ipforwarding

configure iproute add default 172.16.102.130

Lastly, you configure the switch to redirect HTTP connections to Squid:

create flow-redirect http tcp destination any ip-port 80 source any

configure http add next-hop 172.16.102.66

Cisco Arrowpoint

The following configuration is based on notes from an old test I ran. However, I don't have access to an arrowpoint switch now and can't verify that these lines are correct.

circuit VLAN1

ip address 172.16.102.1 255.255.255.0

service pxy1

type transparent-cache

ip address 172.16.102.66

port 80

protocol tcp

active

owner foo

content bar

add service pxy1

protocol tcp

port 80

active

A comment on HTTP servers and health checks

I've set up these examples so that the router/switch forwards packets without changing the destination TCP port. The packet filtering rules that I'll cover in Section 9.4 change the destination port. An interesting problem arises when you also run an HTTP server on the Squid box.

To run an HTTP server on port 80 while running Squid on port 3128, your packet filter configuration must have a special rule that accepts TCP connections for the HTTP server. Otherwise, the connection gets diverted to Squid. The special rule is simple to construct. If the destination port is 80, and the destination address is the server's, accept the packet normally. All the intercepted packets have foreign destination addresses, so they won't match the special rule.

However, when the router/switch makes an HTTP health check, it connects to the server's IP address. Thus, the health-check packet matches the special rule and isn't diverted to Squid. The router/switch is checking the health of the wrong server. If the HTTP server is down, but Squid is up (or vice versa), the health check will be wrong.

If you find yourself in this situation, you have a few options:

Don't run an HTTP server on the Squid host.

Add a specific packet filtering rule that diverts TCP health check connections from the router/switch to Squid.

Configure your router/switch to change the destination port to 3128.

Disable layer four health checks.

Cisco Policy Routing

Policy routing isn't that different from what I've talked about with layer four switches. It is implemented in routing products made by Cisco and others. The primary difference is that policy routing doesn't include any health checking. Thus, if Squid becomes overloaded or fails entirely, the router continues to forward packets to Squid, rather than route them directly to origin servers. Policy routing requires that Squid be on one of the router's directly connected subnets.

In this example, I'm using a Cisco 7204 router running IOS Version 12.0(5)T. The network configuration is the same as the previous example, shown in Figure 9-5.

The first configuration step is to define an access list that matches port 80 packets coming from clients. You must make sure that port 80 packets coming from Squid aren't reintercepted. One way to do this is with a specific rule that denies packets coming from Squid, followed by a rule that allows all others:

access-list 110 deny tcp host 172.16.102.66 any eq www

access-list 110 permit tcp any any eq www

Alternatively, if Squid and your users are on different subnets, you can permit only those packets that originate from the client network:

access-list 110 permit tcp 10.102.0.0 0.0.255.255 any eq www

The next step is to define a route map. This is where you tell the router where to forward the intercepted packets:

route-map proxy-redirect permit 10

match ip address 110

set ip next-hop 172.16.102.66

Those commands say, "If the IP address matches access-list 110, forward the packet to 172.16.102.66." The 10 on the route-map line is a sequence number in case you have multiple route maps.

Return Main Page Previous Page Next Page

®Online Book Reader