Wccp linux và Cisco

Mô hình:



Các bước thực hiện:

Cài đặt cache (sử dụng squid để làm proxy trên linux):


Cấu hình squid: (các option cơ bản)
http_port xxx.xxx.xxx.xxx:3128 transparent

maximum_object_size 71680 KB

cache_dir diskd /dir ssss 16 256

wccp2_router rrr.rrr.rrr.rrr

acl localnet src nnn.nnn.nnn.0/24

http_access allow localnet

xxx.xxx.xxx.xxx : IP của squid proxy

rrr.rrr.rrr.rrr : IP của Router

/dir : thư mục lưu cache

Các thiết đặt khác trên máy Linux:

Tạo interface gre0 để giao tiếp với router (udp/2048)

Trong file /etc/modprobe.conf thêm dòng sau:
alias gre0 ip_gre

Tạo file ifcfg-gre0 trong thư mục /etc/sysconfig/network-scripts với nội dung:

DEVICE=gre0

BOOTPROTO=static

IPADDR=10.190.19.19

NETMASK=255.255.255.252

ONBOO=yes

Enable interface gre0
ifup gre0

Cấu hình iptable để chuyển hướng yêu cầu trên port 80 qua port squid đang chạy:
iptables -t nat -A PREROUTING -i gre0 -p tcp -m tcp --dport 80 -j DNAT --to-destination xxx.xxx.xxx.xxx:3128

Cấu hình Router:
router1#conf t

router1(config)#ip wccp web-cache ß bật wccp

router1(config)#int f0  ß port kết nối internet

router1(config-if)#ip wccp web-cache redirect out

router1(config-if)#exit

router1(config)#exit

Xem thông tin cache wccp trên router
router1#show ip wccp

Xem thêm thông tin:

  • http://knol.google.com/k/squid-proxy-cache-and-cisco-routers#

  • http://www.cisco.com/en/US/docs/ios/11_2/feature/guide/wccp.html

  • http://articles.techrepublic.com.com/5100-10878_11-6175637.html
######### Tham Khảo ########
File config /etc/rc.local
Ubuntu:
modprobe ip_gre
ifconfig gre0 up
ip addr add 172.16.99.1/30 dev gre0
echo 0 > /proc/sys/net/ipv4/conf/gre0/rp_filter
iptables -F
iptables -F -t nat
ip tables -t nat -A PREROUTING -i gre0 -p tcp -m tcp --dport 80 -j REDIRECT --to-port 3128

Centos:

modprobe ip_gre
iptables -F
iptables -F -t nat
ip tables -t nat -A PREROUTING -i gre0 -p tcp -m tcp --dport 80 -j REDIRECT --to-port 3128
 và file cấu hình interface gre0

DEVICE=gre0
BOOTPROTO=static
IPADDR=10.190.19.19
NETMASK=255.255.255.252
ONBOOT=yes

Post a Comment