У меня проблема с очень простой конфигурацией Squid.

Моя сеть настроена так, как показано:

=== 192.168.3.xxx LAN === (eth1 - .100) [прокси-хост] (. 18.240.66 - eth0) === 10.xxx LAN

Я хочу прокси-запросы от локальной сети 192.168.3.0/24 к локальной сети 10.0.0.0/8. Я настроил параметры прокси на 192.168.3.200, чтобы использовать прокси на 192.168.3.100:8080. Прокси-запрос поступает на прокси просто отлично, но, похоже, на eth0 он не выходит. Я проверил оба из них с Wireshark.

В частности, я пытаюсь отправить HTTP-запрос от 192.168.3.200 до 10.63.78.243 через прокси. Это то, что заканчивается в squid access.log:

192.168.3.200 TCP_MISS/000 0 GET http://10.63.78.243:8080/path/server.jsp? - DIRECT/10.63.78.243 -

Пакет, отправленный с .200 по .100:8080, имеет следующее содержимое (через Wireshark):

GET http://10.63.78.243:8080/path/server.jsp?x=x HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1; MS-RTC LM 8)
Accept-Encoding: gzip, deflate
Proxy-Connection: Keep-Alive
Host: 10.63.78.243:8080

У меня есть следующая конфигурация Squid:

#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1

# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7       # RFC 4193 local private network range
acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines
acl RDnet dst 10.0.0.0/8

acl SSL_ports port 443
acl Safe_ports port 80      # http
acl Safe_ports port 21      # ftp
acl Safe_ports port 443     # https
acl Safe_ports port 70      # gopher
acl Safe_ports port 210     # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280     # http-mgmt
acl Safe_ports port 488     # gss-http
acl Safe_ports port 591     # filemaker
acl Safe_ports port 777     # multiling http
acl CONNECT method CONNECT

#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost

#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#

# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
http_access allow RDnet

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 8080

# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?

# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /var/spool/squid 100 16 256

# Leave coredumps in the first cache dir
coredump_dir /var/spool/squid

# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp:       1440    20% 10080
refresh_pattern ^gopher:    1440    0%  1440
refresh_pattern -i (/cgi-bin/|\?) 0 0%  0
refresh_pattern .       0   20% 4320

netstat -rn дает следующее:

[root@localhost squid]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.3.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0
10.18.240.0     0.0.0.0         255.255.248.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1
0.0.0.0         10.18.247.254   0.0.0.0         UG        0 0          0 eth0

Я прочитал это как маршрутизацию любого пакета (в том числе к 10.63.78.243) к 10.18.247.254 через eth0. Я знаю, что это достижимо (см. Этот вывод ping -R)

[root@localhost squid]# ping -c 1 -R 10.63.78.243
PING 10.63.78.243 (10.63.78.243) 56(124) bytes of data.
64 bytes from 10.63.78.243: icmp_seq=1 ttl=50 time=377 ms
RR:     10.18.240.66
    10.138.156.186
    10.17.182.22
    10.190.11.66
    112.78.255.4
    198.19.1.41
    10.143.222.81
    10.143.222.98
    172.31.206.129


--- 10.63.78.243 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 377ms
rtt min/avg/max/mdev = 377.644/377.644/377.644/0.000 ms

Какие-нибудь мысли? Одна мысль у меня в том, что Squid прекрасно получает запрос и пытается отправить его, но .... Куда это может идти? Этот хост имеет только 2 интерфейса, и пакеты до 10.xxx должны выходить из eth0. Но в Wireshark нет пакетов. Так что я немного растерялся.

ОБНОВЛЕНИЕ: добавлено следующее в файл конфигурации:

cache_peer 10.159.3.23 parent 8080 0 default

Это позволило моему прокси-серверу переадресовывать запросы на прокси, который на самом деле может достигать хоста 10.63.78.243.

1 ответ1

0

MISS/000 означает прервано, не уверен, что это от клиента или нет ответа после передачи запроса на 10.63.78.243:8080

Что вы получаете с "telnet 10.63.78.243 8080" ОТ хоста squid? GET / HTTP / 1.1 Хост: 10.63.78.243:8080

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .