>> Есть NAT для локальной сети? Если да, не могли бы показать правила?
>
>лучше вы покажите свои а вам укажут на их недостатки "Классическая", судя по гуглю, грабля с совмещением, за одним IP, NAT и ipsec.
Когда убирается NAT, работает IPsec туннель (между двумя офисами, в другом тоже NAT)
Когда NAT возвращается, Ipsec больше не работает.
[root@XXX network-scripts]# cat ifcfg-ipsec1
#IPSEC iface
DEVICE=ipsec1
TYPE=IPsec
IKE_METHOD=PSK
IKE_PSK=***
ONBOOT=no
SRCNET=10.XX.2.0/24
DSTNET=10.XX.3.0/24
DST=XX.XX.XX.XX
IPV6INIT=no
Где DST удаленный сервер с LAN 10.XX.3.0/24
[root@XXX network-scripts]# cat /etc/racoon/racoon.conf
# Racoon IKE daemon configuration file.
# See 'man racoon.conf' for a description of the format and entries.
path include "/etc/racoon";
path pre_shared_key "/etc/racoon/psk.txt";
path certificate "/etc/racoon/certs";
sainfo anonymous
{
pfs_group 2;
lifetime time 1 hour ;
encryption_algorithm 3des, blowfish 448, rijndael ;
authentication_algorithm hmac_sha1, hmac_md5 ;
compression_algorithm deflate ;
}
Причем, достаточно отключить NAT только с той стороны, с которой пытаемся подключиться по IPSec:
===================
# Generated by iptables-save v1.3.5 on Fri Jul 9 16:42:38 2010
*mangle
:PREROUTING ACCEPT [2308398:1423237106]
:INPUT ACCEPT [173359:34702081]
:FORWARD ACCEPT [2134460:1388509687]
:OUTPUT ACCEPT [175649:19916950]
:POSTROUTING ACCEPT [2310109:1408426637]
COMMIT
# Completed on Fri Jul 9 16:42:38 2010
# Generated by iptables-save v1.3.5 on Fri Jul 9 16:42:38 2010
*nat
:PREROUTING ACCEPT [81100:4924860]
:POSTROUTING ACCEPT [2158:106381]
:OUTPUT ACCEPT [6000:364839]
-A PREROUTING -d YY.YY.YY.YY -i eth0 -p udp -m udp --dport 3333 -j DNAT --to-destination 10.XX.2.3:3333
-A POSTROUTING -o eth0 -j SNAT --to-source YY.YY.YY.YY
COMMIT
# Completed on Fri Jul 9 16:42:38 2010
# Generated by iptables-save v1.3.5 on Fri Jul 9 16:42:38 2010
*filter
:INPUT DROP [2709:353265]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [174990:19866804]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s XX.XX.XX.XX -i vmbr0 -j ACCEPT
-A INPUT -s XX.XX.XX.XX -i eth0 -j ACCEPT
-A INPUT -s ZZ.ZZ.ZZ.ZZ -i vmbr0 -j ACCEPT
-A INPUT -s ZZ.ZZ.ZZ.ZZ -i eth0 -j ACCEPT
-A INPUT -s 10.XX.3.0/255.255.255.0 -i vmbr0 -j ACCEPT
-A INPUT -s 10.XX.3.0/255.255.255.0 -i eth0 -j ACCEPT
-A INPUT -s 10.XX.2.0/255.255.255.0 -i vmbr0 -j ACCEPT
-A INPUT -s 10.XX.2.0/255.255.255.0 -i eth0 -j ACCEPT
-A INPUT -d YY.YY.YY.YY -p udp -m udp --dport 113 -j ACCEPT
-A INPUT -d YY.YY.YY.YY -p tcp -m tcp --dport 113 -j ACCEPT
-A INPUT -s XX.XX.XX.XX -i ipsec1 -j ACCEPT
-A FORWARD -s 10.XX.2.2 -o eth0 -p tcp -m tcp --dport 25 -j DROP
-A FORWARD -s 10.XX.2.2 -j ACCEPT
-A FORWARD -d 10.XX.2.2 -j ACCEPT
-A FORWARD -s 10.XX.2.3 -o eth0 -p tcp -m tcp --dport 25 -j DROP
-A FORWARD -s 10.XX.2.3 -j ACCEPT
-A FORWARD -d 10.XX.2.3 -j ACCEPT
-A FORWARD -s 10.XX.2.1 -o eth0 -p tcp -m tcp --dport 25 -j DROP
-A FORWARD -s 10.XX.2.1 -j ACCEPT
-A FORWARD -d 10.XX.2.1 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s XX.XX.XX.XX -i vmbr0 -j ACCEPT
-A FORWARD -s XX.XX.XX.XX -i eth0 -j ACCEPT
-A FORWARD -s ZZ.ZZ.ZZ.ZZ -i vmbr0 -j ACCEPT
-A FORWARD -s ZZ.ZZ.ZZ.ZZ -i eth0 -j ACCEPT
-A FORWARD -s 10.XX.3.0/255.255.255.0 -i vmbr0 -j ACCEPT
-A FORWARD -s 10.XX.3.0/255.255.255.0 -i eth0 -j ACCEPT
-A FORWARD -s 10.XX.2.0/255.255.255.0 -i vmbr0 -j ACCEPT
-A FORWARD -s 10.XX.2.0/255.255.255.0 -i eth0 -j ACCEPT
-A FORWARD -s 10.XX.2.0/255.255.255.0 -d 10.XX.3.0/255.255.255.0 -j ACCEPT
-A FORWARD -s 10.XX.3.0/255.255.255.0 -d 10.XX.2.0/255.255.255.0 -j ACCEPT
-A FORWARD -s 10.XX.2.0/255.255.255.0 -i vmbr0 -p tcp -m tcp --dport 25 -j DROP
-A FORWARD -s 10.XX.3.0/255.255.255.0 -i vmbr0 -p tcp -m tcp --dport 25 -j DROP
-A FORWARD -s 10.XX.2.0/255.255.255.0 -i vmbr0 -p ! icmp -m state --state INVALID -j DROP
-A FORWARD -d 10.XX.2.0/255.255.255.0 -o vmbr0 -p ! icmp -m state --state INVALID -j DROP
-A FORWARD -s 10.XX.2.0/255.255.255.0 -i vmbr0 -o eth0 -j ACCEPT
-A FORWARD -d 10.XX.2.0/255.255.255.0 -i vmbr0 -p icmp -j ACCEPT
-A FORWARD -s 10.XX.2.0/255.255.255.0 -o vmbr0 -p icmp -j ACCEPT
-A FORWARD -s 10.XX.3.0/255.255.255.0 -i vmbr0 -p ! icmp -m state --state INVALID -j DROP
-A FORWARD -d 10.XX.3.0/255.255.255.0 -o vmbr0 -p ! icmp -m state --state INVALID -j DROP
-A FORWARD -s 10.XX.3.0/255.255.255.0 -i vmbr0 -o eth0 -j ACCEPT
-A FORWARD -d 10.XX.3.0/255.255.255.0 -i vmbr0 -p icmp -j ACCEPT
-A FORWARD -s 10.XX.3.0/255.255.255.0 -o vmbr0 -p icmp -j ACCEPT
-A FORWARD -s 10.XX.2.0/255.255.255.0 -d 10.XX.2.1 -j ACCEPT
-A FORWARD -s 10.XX.2.1 -d 10.XX.2.0/255.255.255.0 -j ACCEPT
-A FORWARD -s 10.XX.2.1 -o eth0 -j ACCEPT
-A FORWARD -s 10.XX.2.1 -j DROP
-A FORWARD -d 10.XX.2.1 -j DROP
-A FORWARD -d 10.XX.2.3 -p udp -m udp --dport 3333 -j ACCEPT
-A FORWARD -s 10.XX.2.0/255.255.255.0 -d 10.XX.2.3 -j ACCEPT
-A FORWARD -s 10.XX.2.3 -d 10.XX.2.0/255.255.255.0 -j ACCEPT
-A FORWARD -s 10.XX.2.3 -o eth0 -j ACCEPT
-A FORWARD -s 10.XX.2.3 -j DROP
-A FORWARD -d 10.XX.2.3 -j DROP
-A FORWARD -s 10.XX.2.0/255.255.255.0 -d 10.XX.2.2 -j ACCEPT
-A FORWARD -s 10.XX.2.2 -d 10.XX.2.0/255.255.255.0 -j ACCEPT
-A FORWARD -s 10.XX.2.2 -o eth0 -j ACCEPT
-A FORWARD -s 10.XX.2.2 -j DROP
-A FORWARD -d 10.XX.2.2 -j DROP
COMMIT
# Completed on Fri Jul 9 16:42:38 2010
eth0 Link encap:Ethernet HWaddr *******
inet addr:YY.YY.YY.YY Bcast:** Mask:255.255.255.224
inet6 addr: *** Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1188158 errors:0 dropped:0 overruns:0 frame:0
TX packets:1233850 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:841302073 (802.3 MiB) TX bytes:638793363 (609.2 MiB)
Interrupt:233 Base address:0xe000
eth1 Link encap:Ethernet HWaddr ******
inet6 addr: *** Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:925132 errors:0 dropped:0 overruns:0 frame:0
TX packets:885383 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:585542509 (558.4 MiB) TX bytes:755864016 (720.8 MiB)
Memory:f3180000-f31a0000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5410 errors:0 dropped:0 overruns:0 frame:0
TX packets:5410 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:679230 (663.3 KiB) TX bytes:679230 (663.3 KiB)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:321997 errors:0 dropped:0 overruns:0 frame:0
TX packets:277237 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:102789055 (98.0 MiB) TX bytes:113665818 (108.4 MiB)
veth101.0 Link encap:Ethernet HWaddr *****
inet6 addr: *** Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:363 errors:0 dropped:0 overruns:0 frame:0
TX packets:27757 errors:0 dropped:14 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:55524 (54.2 KiB) TX bytes:4915275 (4.6 MiB)
vmbr0 Link encap:Ethernet HWaddr *****
inet addr:10.XX.2.5 Bcast:10.XX.2.255 Mask:255.255.255.0
inet6 addr: *** Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:903585 errors:0 dropped:0 overruns:0 frame:0
TX packets:885284 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:568370681 (542.0 MiB) TX bytes:755850406 (720.8 MiB)
В общем-то, думала уже все сделать на OpenVPN, так как использовать для NAT и ipsec разные IP-адреса технически сложно: обе машины, OpenVZ системы, а в OVZ с venet сетью для default gateway куча заморочек, если шлюзов больше одного, но если подскажете, буду благодарна.