Подскажите пожалуйста, следующая ситуация:
Есть прокся ext_ip=83.X.X.X int_ip=192.168.0.1
Есть почтарь int_ip=192.168.0.5
Есть пользователm ip=192.168.0.xКак правильно сделать редирект пользователей на почтарь (внутрений ip), если они обращаются к внешнуму IP (83.X.X.X) на 110 и 25 порт? То есть у пользователя в почтовой программе адрес сервера стоит 83.X.X.X, а должен он получить с 192.168.0.5
Я скропал следующее правило, но оно не пашет 8-(
##########################################################
LO_IFACE="lo"
LO_IP="127.0.0.1"
LAN_IFACE="eth0"
IP_MTA_HOST="192.168.0.5" ## Mail server
LAN_IP_MY="192.168.0.1"
LAN_IP_RANGE="192.168.0.0/24" #192.168.1.0/24 = 192.168.1.0/255.255.255.0
LAN_IP_BROADCAST="192.168.0.255" #192.168.1.0/24 = 192.168.1.0/255.255.255.0
NET_IFACE="eth1"
NET_IP_ADSL="83.х.х.х"
IPTABLES="/usr/sbin/iptables"
##########################################################
## ##
##########################################################
# Flush,Clear and Zero iptables
$IPTABLES -t filter -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
$IPTABLES -t filter -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X
$IPTABLES -t filter -Z
$IPTABLES -t nat -Z
$IPTABLES -t mangle -Z
##########################################################
## ##
##########################################################
$IPTABLES -t mangle -P PREROUTING ACCEPT
$IPTABLES -t mangle -P INPUT ACCEPT
$IPTABLES -t mangle -P FORWARD ACCEPT
$IPTABLES -t mangle -P OUTPUT ACCEPT
$IPTABLES -t mangle -P POSTROUTING ACCEPT
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t nat -P OUTPUT ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t filter -P INPUT DROP
$IPTABLES -t filter -P OUTPUT ACCEPT
$IPTABLES -t filter -P FORWARD ACCEPT
$IPTABLES -t mangle -P PREROUTING ACCEPT
$IPTABLES -t mangle -P INPUT ACCEPT
$IPTABLES -t mangle -P FORWARD ACCEPT
$IPTABLES -t mangle -P OUTPUT ACCEPT
$IPTABLES -t mangle -P POSTROUTING ACCEPT
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t nat -P OUTPUT ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t filter -P INPUT DROP
$IPTABLES -t filter -P OUTPUT ACCEPT
$IPTABLES -t filter -P FORWARD ACCEPT
##########################################################
##
$IPTABLES -N input_iface_net
#
$IPTABLES -N input_tcp_packets
$IPTABLES -N input_udp_packets
$IPTABLES -N input_icmp_packets
##########################################################
$IPTABLES -A INPUT -i $LAN_IFACE -j ACCEPT
$IPTABLES -A INPUT -i $NET_IFACE -j input_iface_net
#$IPTABLES -A INPUT -i $NET_IFACE -j ACCEPT
# (localhost)
$IPTABLES -A INPUT -i $LO_IFACE -j ACCEPT
$IPTABLES -A INPUT -s $LO_IP -j ACCEPT
$IPTABLES -A INPUT -d $LO_IP -j ACCEPT
$IPTABLES -A INPUT -d $NET_IP_ADSL -p "TCP" -m "tcp" --sport "3128" -j ACCEPT
#$IPTABLES -A INPUT -p ALL -o $NET_IFACE -j ACCEPT
#$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $LAN_IP -j ACCEPT
#$IPTABLES -A INPUT -p ALL -i $LO_IFACE -s $NET_IP_ADSL -j ACCEPT
$IPTABLES -A INPUT -p ALL -s $LO_IP -j ACCEPT
#HTTP (Apache)
$IPTABLES -A input_iface_net -s 0/0 -p "TCP" --dport "80" -j ACCEPT
#$IPTABLES -A input_iface_net -s 0/0-p "TCP" --dport "80" -j ACCEPT
#WEBADMIN
#$IPTABLES -A input_iface_net -s 0/0 -d 0/0 -p "TCP" --dport "25" -j ACCEPT
#MAIL
$IPTABLES -A input_iface_net -s 0/0 -d 0/0 -p "TCP" --dport "25" -j ACCEPT
$IPTABLES -A input_iface_net -s 0/0 -d 0/0 -p "TCP" --dport "110" -j ACCEPT
#FTP
$IPTABLES -A input_iface_net -s 0/0 -d 0/0 -p "TCP" --dport "20" -j ACCEPT
$IPTABLES -A input_iface_net -s 0/0 -d 0/0 -p "TCP" --dport "21" -j ACCEPT
#
#$IPTABLES -t nat -A PREROUTING -i eth0 --protocol tcp --destination-port 25 -j DNAT --to-destination 192.168.0.5
#$IPTABLES -t nat -A PREROUTING -s 0/0 -d $NET_IP_ADSL -i $LAN_IFACE --protocol tcp --destination-port 80 -j DNAT --to-dest
# MAIL
$IPTABLES -t nat -A PREROUTING -s 0/0 -d $NET_IP_ADSL -i + --protocol tcp --destination-port 25 -j DNAT --to-destination 19
$IPTABLES -t nat -A PREROUTING -s 0/0 -d $NET_IP_ADSL -i + --protocol tcp --destination-port 110 -j DNAT --to-destination 1
# LAN -> SQUID
$IPTABLES -t nat -A PREROUTING -i $LAN_IFACE -s 192.168.0.0/24 -d ! $NET_IP_ADSL -p tcp --dport 80 -j REDIRECT --to-port 31
#FORWARD
$IPTABLES -A FORWARD -p tcp -s $IP_MTA_HOST --dport 25 -j ACCEPT
$IPTABLES -A FORWARD -p tcp -s $LAN_IP_RANGE --dport 25 -j LOG
$IPTABLES -A FORWARD -p tcp -s $LAN_IP_RANGE --dport 25 -j DROP
#$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
#$IPTABLES -A FORWARD -i $NET_IFACE -d $NET_IP_ADSL --dport "80" -j ACCEPT
#$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#DNS (Bind)
$IPTABLES -A input_iface_lan -s $LAN_IP_RANGE -p "UDP" -m "udp" --dport "53" -j ACCEPT
$IPTABLES -A INPUT -s 0/0 -d 0/0 -p "UDP" -m "udp" --dport "53" -j ACCEPT
#PROXY (Squid)
$IPTABLES -A INPUT -s $LAN_IP_RANGE -p "TCP" -m "tcp" --dport "3128" -j ACCEPT
#PING
$IPTABLES -A input_iface_lan -p "ICMP" -s "0/0" --icmp-type "0" -j ACCEPT
#ROUTING
$IPTABLES -t nat -A POSTROUTING -s 192.168.0.5 -j SNAT --to-source $NET_IP_ADSL
$IPTABLES -t nat -A POSTROUTING -o $NET_IFACE -j SNAT --to-source $NET_IP_ADSL