Hallo zusammen,
ich grabe diesen Thread mal aus weil das praktisch 1:1 auch mein Problem ist.
zum System:
RHEL 5.2 in einer VM mit 2 Netzwerkkarten
eth0=DHCP, Gateway, Internet, IP 192.9.201.210
eth1=lokales Netz, IP 192.168.2.1 (nur zum Test, das Ganze soll letztendlich im 192.9.201.XX Netz laufen)
darüber hinaus habe ich einem weiteren (XP-)Rechner die IP 192.168.2.3 gegeben. Beide können sich gegenseitig sehen, Internet funktioniert mit Eingabe des Proxys auch einwandfrei (ohne weitere iptables config), nur eben nicht transparent.
Für mich sieht das aus als ob irgendwas mit dem Routing nicht stimmt (squid/Internet funktioniert ja ansonsten), und da ich nicht so der Netzwerkspezialist bin frage ich euch mal, vielleicht seht ihr den Fehler
squid -v gibt folgendes aus
Code:
Squid Cache: Version 3.0.STABLE19
configure options: '--enable-linux-netfilter'
also nehme ich mal an dass ich squid richtig kompiliert habe für den transparenten Betrieb.
Ich habe meine config aus diversen Tuts zusammengebastelt, hier meine vorläufige config (wird noch erweitert wenn das dann endlich funktioniert)
Code:
http_port 3128 transparent
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl domain-blacklist url_regex "/usr/local/squid/etc/blacklists/domains"
acl LAN src 192.168.0.0/16
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
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access deny domain-blacklist
http_access allow LAN
http_access deny all
hierarchy_stoplist cgi-bin ?
access_log /usr/local/squid/var/logs/access.log squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern (cgi-bin|\?) 0 0% 0
refresh_pattern . 0 20% 4320
icp_port 3130
coredump_dir /usr/local/squid/var/cache
visible_hostname squid
cache_mem 256 MB
cache_dir ufs /usr/local/squid/var/cache 1000 16 256
und hier mein Network script
Code:
#!/bin/sh
# squid server IP
SQUID_SERVER="192.9.201.210"
# Interface connected to Internet
INTERNET="eth0"
# Interface connected to LAN
LAN_IN="eth1"
# Squid port
SQUID_PORT="3128"
# DO NOT MODIFY BELOW
# Clean old firewall
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Load IPTABLES modules for NAT and IP conntrack support
modprobe ip_conntrack
modprobe ip_conntrack_ftp
# For win xp ftp client
#modprobe ip_nat_ftp
echo 1 > /proc/sys/net/ipv4/ip_forward
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
# Unlimited access to loop back
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Allow UDP, DNS and Passive FTP
iptables -A INPUT -i $INTERNET -m state --state ESTABLISHED,RELATED -j ACCEPT
# set this system as a router for Rest of LAN
iptables --table nat --append POSTROUTING --out-interface $INTERNET -j MASQUERADE
iptables --append FORWARD --in-interface $LAN_IN -j ACCEPT
# unlimited access to LAN
iptables -A INPUT -i $LAN_IN -j ACCEPT
iptables -A OUTPUT -o $LAN_IN -j ACCEPT
# DNAT port 80 request comming from LAN systems to squid 3128 ($SQUID_PORT) aka transparent proxy
iptables -t nat -A PREROUTING -i $LAN_IN -p tcp --dport 80 -j DNAT --to $SQUID_SERVER:$SQUID_PORT
# if it is same system
iptables -t nat -A PREROUTING -i $INTERNET -p tcp --dport 80 -j REDIRECT --to-port $SQUID_PORT
# DROP everything and Log it
iptables -A INPUT -j LOG
iptables -A INPUT -j DROP
Da damit jegliche iptables Einstellungen zurückgesetzt werden, nehme ich mal nicht an dass da irgend eine Regel dazwischenfunkt.
sobald ich das ausführe, tut sich auch gleich ziemlich viel bei der Ausgabe. Da ich das nicht kopieren kann, hab ich nen Screen gemacht.

Dort erscheinen nur IPs von den restlichen Systemen im 192.9.201.XX Netz (SRC=192.9.201.....). Auch sehe ich dort nur ein IN=eth0 und kein IN=eth1, oder sagt das was Anderes aus? Könnte mir einer diese Ausgabe evtl. erklären? Warum erscheint da keine Anfrage von 192.168.2.3? auch in der access.log ist nichts zu sehen im transparenten Betrieb.
kann mir vielleicht einer die Ausgabe erklären?
beide Systeme können sich weiterhin sehen (ping), aber sobald ich den proxy aus Firefox entferne, kann ich keine Seite mehr aufrufen. Es kommt auch kein Error seitens Squid, sondern nur dass die Adresse nicht gefunden werden konnte.
Ich hoffe ihr könnt mir da weiterhelfen, ich sitze jetzt schon den 3. Tag dran.
danke schonmal für eure Hilfe.
Edit: ich bin ja der Meinung dass des port forwarding nicht so läuft wie es sollte, ich habe mal folgendes Skript ausgeführt
Code:
#!/bin/bash
# Defines the location of iptables executables.
iptables=/sbin/iptables
#Clears if any old iptable rules/ policies are there.
iptables --flush -t nat
# Now we will do Masquerading ie. we are doing NAT.
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
# Enabling packet forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward
am besagten Rechner habe ich die IP 192.168.2.3, Gateway 192.168.2.1 und DNS 192.168.2.1 angegeben, theoretisch müsste die VM jetzt doch als Router fungieren, und ich müsste Seiten aufrufen können, oder nicht? das ist aber nicht der Fall.