LinuxForum.Fans
Тема

Соедененние CentOS и Dlink DL804HV ipsec

Автор: r0man00 4 сообщений 5407 просмотров
#50766

Добрый день, Уважаемые!
Возникла проблема при создания туннеля IPSEC между двумя офисами в разных городах, в сети "А" в роли шлюза выступает машина с CENTOS, в сети "Б" шлюз Dlink DL804HV, коннект не устанавливается.

Как настраивал
Сеть "А"
Центось настраивал по документации http://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-ipsec-net2net-cfg.html
Создал скрипт

text
/etc/sysconfig/network-scripts/ifcfg-ipsec0
TYPE=IPSEC
ONBOOT=yes
IKE_METHOD=PSK
SRCGW=192.168.1.3
DSTGW=192.168.4.100
SRCNET=192.168.1.0/24
DSTNET=192.168.4.0/24
DST=Внешний_IP_Сети"В"

Создал ключ

text
/etc/sysconfig/network-scripts/keys-ipsec0

подредактировал /etc/racoon/racoon.conf

text
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";

listen { isakmp Внешний IP Сети "А"; } timer { # These value can be changed per remote node. counter 5; # maximum trying count to send. interval 10 sec; # maximum interval to resend. persend 1; # the number of packets per send.

# maximum time to wait for completing each phase. phase1 30 sec; phase2 15 sec; } sainfo anonymous { pfs_group 2; lifetime time 1 hour ; encryption_algorithm 3des ; authentication_algorithm hmac_md5 ; compression_algorithm deflate ; }

в iptables добавил правила

text

-A INPUT -p udp --dport 500 -j ACCEPT
-A INPUT -p esp -j ACCEPT
-A INPUT -p ah -j ACCEPT

Сеть "Б"
Настройки длинка







Логи
На CenOS

text
Jun 11 16:14:47 gate racoon: INFO: ISAKMP-SA expired IP_Сети"А"[500]-IP_Сети"Б"[500] spi:93143411b022d098:fce3dd7d75bedb4c
Jun 11 16:14:48 gate racoon: INFO: ISAKMP-SA deleted IP_Сети"А"[500]-IP_Сети"Б"[500] spi:93143411b022d098:fce3dd7d75bedb4c
Jun 11 16:14:56 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:15:16 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:15:17 gate racoon: ERROR: ignore information because the message is too short
Jun 11 16:15:17 gate racoon: INFO: respond new phase 1 negotiation: IP_Сети"А"[500]<=>IP_Сети"Б"[500]
Jun 11 16:15:17 gate racoon: INFO: begin Identity Protection mode.
Jun 11 16:15:17 gate racoon: WARNING: SPI size isn't zero, but IKE proposal.
Jun 11 16:15:18 gate racoon: INFO: ISAKMP-SA established IP_Сети"А"[500]-IP_Сети"Б"[500] spi:5eb7240d00fbfd7c:8f3443ee8221db9b
Jun 11 16:15:23 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:15:38 gate last message repeated 2 times
Jun 11 16:15:39 gate racoon: INFO: ISAKMP-SA expired IP_Сети"А"[500]-IP_Сети"Б"[500] spi:61df15843f2c5489:c741efe5058078c0
Jun 11 16:15:40 gate racoon: INFO: ISAKMP-SA deleted IP_Сети"А"[500]-IP_Сети"Б"[500] spi:61df15843f2c5489:c741efe5058078c0
Jun 11 16:15:48 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:16:08 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:16:09 gate racoon: ERROR: ignore information because the message is too short
Jun 11 16:16:09 gate racoon: INFO: respond new phase 1 negotiation: IP_Сети"А"[500]<=>IP_Сети"Б"[500]
Jun 11 16:16:09 gate racoon: INFO: begin Identity Protection mode.
Jun 11 16:16:09 gate racoon: WARNING: SPI size isn't zero, but IKE proposal.
Jun 11 16:16:10 gate racoon: INFO: ISAKMP-SA established IP_Сети"А"[500]-IP_Сети"Б"[500] spi:298c96b5ea2d2d1d:984221a1c0162df7
Jun 11 16:16:15 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:16:30 gate last message repeated 2 times
Jun 11 16:16:31 gate racoon: INFO: ISAKMP-SA expired IP_Сети"А"[500]-IP_Сети"Б"[500] spi:924c422945750807:21b0ba6f4bd9689d
Jun 11 16:16:32 gate racoon: INFO: ISAKMP-SA deleted IP_Сети"А"[500]-IP_Сети"Б"[500] spi:924c422945750807:21b0ba6f4bd9689d
Jun 11 16:16:40 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:17:00 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:17:01 gate racoon: ERROR: ignore information because the message is too short
Jun 11 16:17:01 gate racoon: INFO: respond new phase 1 negotiation: IP_Сети"А"[500]<=>IP_Сети"Б"[500]
Jun 11 16:17:01 gate racoon: INFO: begin Identity Protection mode.
Jun 11 16:17:01 gate racoon: WARNING: SPI size isn't zero, but IKE proposal.
Jun 11 16:17:02 gate racoon: INFO: ISAKMP-SA established IP_Сети"А"[500]-IP_Сети"Б"[500] spi:cceacb95d1d3f58e:3da5dedb5ad4a88b
Jun 11 16:17:07 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].
Jun 11 16:17:22 gate last message repeated 2 times
Jun 11 16:17:23 gate racoon: INFO: ISAKMP-SA expired IP_Сети"А"[500]-IP_Сети"Б"[500] spi:f112137207ec2077:98fb8622ac1db93e
Jun 11 16:17:24 gate racoon: INFO: ISAKMP-SA deleted IP_Сети"А"[500]-IP_Сети"Б"[500] spi:f112137207ec2077:98fb8622ac1db93e
Jun 11 16:17:32 gate racoon: NOTIFY: the packet is retransmitted by IP_Сети"Б"[500].

Логи
На Dlink

text
Friday June 11, 2010 15:28:09 IKED re-TX : IDINIT to IP_Сети"А"
Friday June 11, 2010 15:28:09 Receive IKE M6(IDRESP) : IP_Сети"А" --> IP_Сети"Б"
Friday June 11, 2010 15:28:09 ID error
Friday June 11, 2010 15:28:14 IKED re-TX : IDINIT to IP_Сети"А"
Friday June 11, 2010 15:28:14 Receive IKE M6(IDRESP) : IP_Сети"А" --> IP_Сети"Б"
Friday June 11, 2010 15:28:14 ID error
Friday June 11, 2010 15:28:24 IKED re-TX : IDINIT to IP_Сети"А"
Friday June 11, 2010 15:28:24 Receive IKE M6(IDRESP) : IP_Сети"А" --> IP_Сети"Б"
Friday June 11, 2010 15:28:24 ID error
Friday June 11, 2010 15:28:34 IKED re-TX : IDINIT to IP_Сети"А"
Friday June 11, 2010 15:28:34 Receive IKE M6(IDRESP) : IP_Сети"А" --> IP_Сети"Б"
Friday June 11, 2010 15:28:34 ID error
Friday June 11, 2010 15:28:54 IKED re-TX : IDINIT to IP_Сети"А"
Friday June 11, 2010 15:28:54 Receive IKE M6(IDRESP) : IP_Сети"А" --> IP_Сети"Б"
Friday June 11, 2010 15:28:54 ID error
Friday June 11, 2010 15:28:55 Send IKE (INFO) : delete IP_Сети"Б" -> IP_Сети"А" phase 1
Friday June 11, 2010 15:28:55 IKE phase1 (ISAKMP SA) remove : IP_Сети"Б" <-> IP_Сети"А"
Friday June 11, 2010 15:28:55 Send IKE M1(INIT) : IP_Сети"Б" --> IP_Сети"А"
Friday June 11, 2010 15:28:55 Receive IKE M2(RESP) : IP_Сети"А" --> IP_Сети"Б"
Friday June 11, 2010 15:28:55 Try to match with ENC:3DES AUTH:PSK HASH:SHA1 Group:Group2

Не как не могу понять в чем проблема, может кто сталкивался?

#51511

Добился следующих результатов
Длинк не выдает никаких ошибок
на ЦентОС сыпятся следующие сообщения

text
Jun 15 15:36:55 gate racoon: ERROR: such policy already exists. anyway replace it: 192.168.4.0/24[0] 192.168.1.0/24[0] proto=any dir=fwd
Jun 15 15:36:57 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:000002b1
Jun 15 15:37:07 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:000002b1
Jun 15 15:37:12 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, b5286874ee9ef08b:adc354969d78e49e:0000cdbb
Jun 15 15:37:13 gate racoon: ERROR: unknown Informational exchange received.
Jun 15 15:37:13 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:0000103a
Jun 15 15:37:23 gate last message repeated 2 times
Jun 15 15:37:27 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:000002b1
Jun 15 15:37:28 gate racoon: ERROR: unknown Informational exchange received.
Jun 15 15:37:28 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:00000cc3
Jun 15 15:37:33 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:00000cc3
Jun 15 15:37:33 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:0000103a
Jun 15 15:37:38 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:00000cc3
Jun 15 15:37:43 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:0000103a
Jun 15 15:37:48 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:00000cc3
Jun 15 15:37:58 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:00000cc3
Jun 15 15:38:03 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:0000103a
Jun 15 15:38:04 gate racoon: ERROR: unknown Informational exchange received.
Jun 15 15:38:04 gate racoon: ERROR: can't start the quick mode, there is no ISAKMP-SA, 66910be5a66465a3:5d4797dcdc411b4c:0000083e
#52295

Ура! туннель поднялся!
Теперь возник вопрос по роутингу, из "сети Б" вся "сеть А" пингуется, а из "сети А" "Сеть Б" не пингуется совсем(
получаю

text
Обмен пакетами с 192.168.4.100 по с 32 байтами данных:
Ответ от 62.32.86.ХХХ: Заданный узел недоступен.
Ответ от 62.32.86.ХХХ: Заданный узел недоступен.
 

Куда копать?

#52418

r0man00, воспользуйтесь командой traceroute (в windows - tracert), чтобы узнать на каком из узлов проблема с маршрутизацией.

Войдите или зарегистрируйтесь, чтобы ответить.