Здравствуйте!
Есть комп который должен раздавать инет в локальную сеть со Stargazer 2.402.9.7.
На нем стоит Debian 3.1 r4. На нем поднят нат. Также есть прозрачный сквид. Проблема в том что Stargazer очень странно считает прокси трафик. Примерно в 2 раза больше чем нужно. Именно в 2 раза + ещё немного. Нат трафик считается правильно. Подчсет идет с использованием ipq. Если без него, то прокси трафик также считается неправильно, но попадает почему то в другое направление. Бьюсь уже неделю - толку 0.
И ещё. Этот комп используется для соединения с другой подсетью через адсл. Т.е. он основной шлюз. Все пакеты которые в другую подсеть идут он перенаправляет через другой интерфейс, а все что в инет натит или на проксю заворачивает.
Вот мои конфиги:
Инициализация фаервола:
OnStart
---------------------------------------------------------------
#!/bin/sh
# 1. Configuration options.
# 1.1 Internet Configuration.
INET_IP="212.*.*.*"
INET_IFACE="eth1"
# 1.1.1 DHCP
# 1.1.2 PPPoE
# 1.2 Local Area Network configuration.
LAN_IP="192.168.1.7"
LAN_IFACE="eth0"
LAN_IP_RANGE="192.168.1.0/24"
# 1.3 DMZ Configuration.
# 1.4 Localhost Configuration.
LO_IP="127.0.0.1"
LO_IFACE="lo"
# 1.5 IPTables Configuration.
IPTABLES="/sbin/iptables"
# 1.6 Other Configuration (Remote LAN).
RLAN_IP="192.168.4.2"
RLAN_IFACE="eth2"
#Local LAN's
LLAN_IP_RANGE="192.168.0.0/16"
# 2. Module loading.
/sbin/depmod -a
# 2.1 Required modules
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_filter
/sbin/modprobe iptable_mangle
/sbin/modprobe iptable_nat
/sbin/modprobe ipt_REDIRECT
/sbin/modprobe ipt_REJECT
/sbin/modprobe ipt_state
/sbin/modprobe ip_queue
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_nat_ftp
/sbin/modprobe ip_conntrack_irc
/sbin/modprobe ip_nat_irc
# 2.2 Non-Required modules
#/sbin/modprobe ipt_owner
#/sbin/modprobe ipt_MASQUERADE
#/sbin/modprobe ipt_LOG
#/sbin/modprobe ipt_limit
# 3. /proc set up.
# 3.1 Required proc configuration
#echo "1" > /proc/sys/net/ipv4/ip_forward
# 3.2 Non-Required proc configuration
#echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter
#echo "1" > /proc/sys/net/ipv4/conf/all/proxy_arp
#echo "1" > /proc/sys/net/ipv4/ip_dynaddr
# 4. rules set up.
# 4.1 Filter table
# 4.1.1 Set policies
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
# 4.1.2 Create userspecified chains
$IPTABLES -N bad_tcp_packets
$IPTABLES -N allowed_tcp_packets
$IPTABLES -N tcp_packets
$IPTABLES -N udp_packets
$IPTABLES -N icmp_packets
# 4.1.3 Create content in userspecified chains
# bad_tcp_packets chain
$IPTABLES -A bad_tcp_packets -p tcp --tcp-flags SYN,ACK SYN,ACK -m state --state NEW -j REJECT --reject-with tcp-reset
# allowed_tcp_packets chain
$IPTABLES -A allowed_tcp_packets -p TCP --syn -j ACCEPT
$IPTABLES -A allowed_tcp_packets -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A allowed_tcp_packets -p TCP -j DROP
# TCP rules
#$IPTABLES -A tcp_packets -p TCP -s 0/0 --destination-port 22 -j allowed_tcp_packets
# UDP rules
#$IPTABLES -A udp_packets -p UDP -s 0/0 --destination-port 123 -j ACCEPT
# ICMP rules
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT
# 4.1.4 INPUT chain
$IPTABLES -A INPUT -p tcp -j bad_tcp_packets
$IPTABLES -A INPUT -p TCP -i $LAN_IFACE -s $LAN_IP_RANGE --destination-port ! 3128 -j ACCEPT
$IPTABLES -A INPUT -p UDP -i $LAN_IFACE -s $LAN_IP_RANGE -j ACCEPT
$IPTABLES -A INPUT -p ICMP -i $LAN_IFACE -s $LAN_IP_RANGE -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LO_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LAN_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $INET_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $RLAN_IP -j ACCEPT
$IPTABLES -A INPUT -p UDP -i $LAN_IFACE --dport 67 --sport 68 -j ACCEPT
$IPTABLES -A INPUT -p ALL -i $INET_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -p TCP -i $INET_IFACE -j tcp_packets
$IPTABLES -A INPUT -p UDP -i $INET_IFACE -j udp_packets
$IPTABLES -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
$IPTABLES -A INPUT -p ALL -i $RLAN_IFACE -d $RLAN_IP -j ACCEPT
#$IPTABLES -A INPUT -i $INET_IFACE -d 224.0.0.0/8 -j DROP
# 4.1.5 FORWARD chain
$IPTABLES -A FORWARD -p tcp -j bad_tcp_packets
$IPTABLES -A FORWARD -i $LAN_IFACE -o $RLAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -i $RLAN_IFACE -o $LAN_IFACE -j ACCEPT
# 4.1.6 OUTPUT chain
$IPTABLES -A OUTPUT -p tcp -j bad_tcp_packets
$IPTABLES -A OUTPUT -p ALL -o $LO_IFACE -j ACCEPT
$IPTABLES -A OUTPUT -p TCP -o $LAN_IFACE --source-port ! 3128 -j ACCEPT
$IPTABLES -A OUTPUT -p UDP -o $LAN_IFACE -j ACCEPT
$IPTABLES -A OUTPUT -p ICMP -o $LAN_IFACE -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -o $INET_IFACE -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -o $RLAN_IFACE -j ACCEPT
# 4.2 nat table
# 4.2.1 Set policies
# 4.2.2 Create user specified chains
# 4.2.3 Create content in user specified chains
# 4.2.4 PREROUTING chain
$IPTABLES -t nat -A PREROUTING -i $LAN_IFACE -d ! $LLAN_IP_RANGE -p TCP --dport 80 -j REDIRECT --to-ports 3128
# 4.2.5 POSTROUTING chain
$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -s $LAN_IP_RANGE -j SNAT --to-source $INET_IP
# 4.2.6 OUTPUT chain
# 4.3 mangle table
# 4.3.1 Set policies
# 4.3.2 Create user specified chains
# 4.3.3 Create content in user specified chains
# 4.3.4 PREROUTING chain
# 4.3.5 INPUT chain
# 4.3.6 FORWARD chain
# 4.3.7 OUTPUT chain
# 4.3.8 POSTROUTING chain
# Proc configuration
echo "1" > /proc/sys/net/ipv4/ip_forward
# Static routes
/sbin/route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.4.1
/sbin/route add -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.4.1
# Temporary (Для днс серверов локалки)
$IPTABLES -A FORWARD -i $LAN_IFACE -s 192.168.1.2 -j ACCEPT
$IPTABLES -A FORWARD -o $LAN_IFACE -d 192.168.1.2 -j ACCEPT
$IPTABLES -A FORWARD -i $LAN_IFACE -s 192.168.1.3 -j ACCEPT
$IPTABLES -A FORWARD -o $LAN_IFACE -d 192.168.1.3 -j ACCEPT
---------------------------------------------------------------------------------------------
OnConnect
---------------------------------------------------------------------------------------------
# Login
LOGIN=$1
#user IP
IP=$2
#cash
CASH=$3
#user ID
ID=$4
IPTABLES="/sbin/iptables"
LAN_IFACE="eth0"
INET_IFACE="eth1"
$IPTABLES -A INPUT -p TCP -i $LAN_IFACE -s $IP --dport 3128 -j QUEUE
$IPTABLES -A OUTPUT -p TCP -o $LAN_IFACE -d $IP --sport 3128 -j QUEUE
$IPTABLES -A FORWARD -i $LAN_IFACE -o $INET_IFACE -s $IP -j QUEUE
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -i $INET_IFACE -o $LAN_IFACE -d $IP -j QUEUE
echo "C `date +%Y.%m.%d-%H.%M.%S` $IP $CASH" >> /var/stargazer/users/$LOGIN/connect.log
-----------------------------------------------------------------------------------------------
OnDisconnect
-----------------------------------------------------------------------------------------------
# Login
LOGIN=$1
#user IP
IP=$2
#cash
CASH=$3
#user ID
ID=$4
IPTABLES="/sbin/iptables"
LAN_IFACE="eth0"
INET_IFACE="eth1"
$IPTABLES -D INPUT -p TCP -i $LAN_IFACE -s $IP --dport 3128 -j QUEUE
while [ $? -eq 0 ]
do
$IPTABLES -D INPUT -p TCP -i $LAN_IFACE -s $IP --dport 3128 -j QUEUE
done
$IPTABLES -D OUTPUT -p TCP -o $LAN_IFACE -d $IP --sport 3128 -j QUEUE
while [ $? -eq 0 ]
do
$IPTABLES -D OUTPUT -p TCP -o $LAN_IFACE -d $IP --sport 3128 -j QUEUE
done
$IPTABLES -D FORWARD -i $LAN_IFACE -o $INET_IFACE -s $IP -j QUEUE
while [ $? -eq 0 ]
do
$IPTABLES -D FORWARD -i $LAN_IFACE -o $INET_IFACE -s $IP -j QUEUE
done
$IPTABLES -D FORWARD -m state --state ESTABLISHED,RELATED -i $INET_IFACE -o $LAN_IFACE -d $IP -j QUEUE
while [ $? -eq 0 ]
do
$IPTABLES -D FORWARD -m state --state ESTABLISHED,RELATED -i $INET_IFACE -o $LAN_IFACE -d $IP -j QUEUE
done
echo "D `date +%Y.%m.%d-%H.%M.%S` $IP $CASH" >> /var/stargazer/users/$LOGIN/connect.log
-----------------------------------------------------------------------------------------------
rules
-----------------------------------------------------------------------------------------------
ALL 127.0.0.0/8 NULL
TCP 192.168.1.7:3128 DIR1
ALL 192.168.0.0/16 NULL
ALL 0.0.0.0/0 DIR0
---------------------------------------------------------------------------------------------
Заранее спасибо!