ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Artur Yakupov <artur@cint.ru>
To: ALT Linux Community <community@lists.altlinux.org>
Subject: Re: [Comm] iptables_settings
Date: Fri, 20 Oct 2006 16:41:56 +0400
Message-ID: <4538C414.8040206@cint.ru> (raw)
In-Reply-To: <op.thpycnae88vapp@glazunov.vrnoblgaz.local>

Глазунов Алексей Александрович пишет:
> Есть необходимость научить программу "Дипост" ходить в инет в обход proxy.
> Функцию прокси, помимо прочих, выполняет ALTLinux Master 2.2.
> На ALTLinux-сервере стоит 2 сетевые карты:
> eth0 - смотрит в инет с IP 213.129.97.250
> eth1 - смотрит в локалку с IP 192.168.0.0/255.255.255.0
> Все ходят в инет только через squid.
>
> Дипост рапотает с портами 25 и 110  и никаких настроек под прокси не имеет.
> Есть возможность другие порты указать. Решили, чтобы не сломать почту, что  
> нужно
> на сервере с локального компа 192.168.0.205 принимать запросы на порты  
> 3025 и 3110
> и передавать их далее на 195.98.64.73 в порты 25 и 110. Ответы с  
> 195.98.64.73
> соответвенно требуется переадресовать на 192.168.0.205.
> Сделал следующие настройки в iptables:
>
> # Example iptables config file.
> # Note the this file uses the format of iptables-save
> # What follows is an example of this output.  However,
> # the actual rule lines have been commented out.
> # DO NOT USE THE -t (table) OPTION IN THIS FILE!
> *mangle
> :PREROUTING ACCEPT [0:0]
> :OUTPUT ACCEPT [0:0]
> #-A PREROUTING -p tcp --dport 22 -j TOS --set-tos 0x10
> COMMIT
> *filter
> :INPUT ACCEPT [0:0]
> :FORWARD ACCEPT [0:0]
> :OUTPUT ACCEPT [0:0]
> #-A FORWARD -i eth0 -j ACCEPT
> COMMIT
> *nat
> :PREROUTING ACCEPT [0:0]
> #195.98.64.73 - ip-server_bank
> #-A PREROUTING -p tcp --dport 25 -j REDIRECT --to-ports 3128
> #-A PREROUTING -p tcp -d 192.168.0.205 --dport 3025 -j DNAT  
> --to-destination 195.98.64.73:25
> #-A PREROUTING -p tcp -d 192.168.0.205 --dport 3110 -j DNAT  
> --to-destination 195.98.64.73:110
>
>
>
> :POSTROUTING ACCEPT [0:0]
> #-A POSTROUTING -p tcp --dport 110 -o eth0 -j SNAT --to-source  
> 213.129.97.252
> #-A POSTROUTING -p tcp -s 192.168.0.205 -d 192.168.0.201 -o eth0 -j SNAT  
> --to-source 213.129.97.252:25
>
>
> :OUTPUT ACCEPT [0:0]
> #-A POSTROUTING -o eth0 -j MASQUERADE
> COMMIT
>
>
>
> "Дипост" так и не заработал :-(
> Как проверить правильно ли настроил iptables? Может еще чего-то нужно  
> подкрутить?
>
>   
Подправим так:

-A PREROUTING -p tcp -s 195.98.64.73 -d 213.129.97.252 --dport 25 -j DNAT  
--to-destination 192.168.0.205:3025
-A PREROUTING -p tcp -s 195.98.64.73 -d 213.129.97.252 --dport 110 -j DNAT  
--to-destination 192.168.0.205:3110
-A POSTROUTING -p tcp --dport 25 -s 192.168.0.205 -o eth0 -j SNAT --to-source  
213.129.97.252
-A POSTROUTING -p tcp --dport 110 -s 192.168.0.205 -o eth0 -j SNAT --to-source  
213.129.97.252

в /etc/sysctl.conf добавить
net.ipv4.ip_forward = 1

и чтобы не перегружаться
echo 1 > /proc/sys/net/ipv4/ip_forward

в настройках дипоста оставить адрес дипостного сервера 195.98.64.73

Так все вроде должно работать при условии сохранения policy ACCEPT в цепочке FORWARD.
 

-- 
------------
С уважением,
Артур Якупов

ЗАО Корпорация Интерсвязь

mailto:artur@cint.ru



  parent reply	other threads:[~2006-10-20 12:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20 12:01 Глазунов Алексей Александрович
2006-10-20 12:08 ` Дмитрий Ананьев
2006-10-20 12:10   ` Дмитрий Ананьев
2006-10-20 12:21     ` Глазунов Алексей Александрович
2006-10-20 12:27       ` Дмитрий Ананьев
2006-10-20 12:29       ` Artur Yakupov
2006-10-20 12:31       ` Artur Yakupov
2006-10-20 12:41 ` Artur Yakupov [this message]
2006-10-20 13:18   ` Глазунов Алексей Александрович
2006-10-20 14:09     ` Artur Yakupov
2006-10-20 13:14 ` Шенцев Алексей Владимирович
2006-10-20 13:28   ` Глазунов Алексей Александрович
2006-10-20 13:36     ` Дмитрий Ананьев

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4538C414.8040206@cint.ru \
    --to=artur@cint.ru \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git