The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Cisco IPSec методом RSA (ipsec security tunnel cisco)


<< Предыдущая ИНДЕКС Правка src / Печать Следующая >>
Ключевые слова: ipsec, security, tunnel, cisco,  (найти похожие документы)
From: Сгибнев Михаил <http://dreamcatcher.ru>; Date: Sun, 24 Nov 2006 17:02:14 +0000 (UTC) Subject: Cisco IPSec методом RSA Оригинал: http://dreamcatcher.ru/docs/cisco_ipsec.html Это обычное HOW-TO, не несущее в себе никаких теоретических моментов. В идеале, для работы необходимо поставить свои IP адреса и имена доменов/хостов. Прошлое наше занятие мы закончили с такой конфигурацией (ну, примерно такой): ! version 12.4 no service pad service timestamps debug datetime msec service timestamps log datetime msec service password-encryption ! hostname dream ! boot-start-marker boot system flash sb101-k9oy6-mz.124-5a.bin boot-end-marker ! logging buffered 51200 warnings enable secret megasecret ! no aaa new-model ! resource policy ! ip rcmd rcp-enable ip rcmd rsh-enable ip rcmd remote-host cisco 192.168.1.2 cisco enable ! ! ip cef no ip domain lookup ip domain name home.dreamcatcher.ru ip host mixa 192.168.1.2 ip host hpux 192.168.1.3 ip host note 192.168.1.4 ip name-server 217.72.144.76 ip inspect name Internet ftp timeout 3600 ip inspect name Internet h323 timeout 3600 ip inspect name Internet http timeout 3600 ip inspect name Internet smtp timeout 3600 ip inspect name Internet tcp timeout 3600 ip inspect name Internet udp timeout 3600 ! ! username mixa privilege 15 secret megapassword username cisco password megacisco ! interface Ethernet0 description --- Inner Interface --- ip address 192.168.1.1 255.255.255.0 ip access-group Output-Traf in ip nat inside ip inspect Internet in ! interface Ethernet1 description --- Outer Interface --- mac-address 0011.2fe3.d6d5 bandwidth 128 ip address 10.1.1.28 255.255.255.0 ip access-group Input-Traf in ip nat outside duplex auto fair-queue no cdp enable ! ip route 0.0.0.0 0.0.0.0 10.1.1.100 no ip http server no ip http secure-server ! ip nat translation tcp-timeout never ip nat inside source list 10 interface Ethernet1 overload ! ! ip access-list extended Input-Traf permit icmp any host 10.1.1.28 unreachable permit icmp any host 10.1.1.28 echo-reply permit icmp any host 10.1.1.28 packet-too-big permit icmp any host 10.1.1.28 time-exceeded permit icmp any host 10.1.1.28 traceroute permit icmp any host 10.1.1.28 administratively-prohibited permit icmp any host 10.1.1.28 echo deny ip any any ip access-list extended Output-Traf remark ----- Permit out trafic ----- permit tcp 192.168.1.0 0.0.0.255 any permit icmp 192.168.1.0 0.0.0.255 any permit udp 192.168.1.0 0.0.0.255 any deny ip any any access-list 10 permit 192.168.1.0 0.0.0.255 snmp-server community secret RO 10 ! control-plane ! banner motd * Dreamcatcher Home * ! line con 0 login local no modem enable transport output all line aux 0 transport output all line vty 0 4 access-class 10 in privilege level 15 password megacisco login local transport input ssh transport output all ! scheduler max-task-time 5000 end Теперь перед нами стоит другая задача - необходимо соединить этот маршрутизатор с маршрутизатором в Головном Офисе по защищенному каналу. Разберем метод RSA. Как и все (или почти все) остальное в IOS, реализация туннеля легка и незамысловата: Генерируем ключи: dream#conf t Enter configuration commands, one per line. End with CNTL/Z. dream(config)#crypto key generate rsa general-keys exportable % You already have RSA keys defined named dream.home.dreamcatcher.ru. % Do you really want to replace them? [yes/no]: y Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus [[ :1024]] % Generating 1024 bit RSA keys, keys will be exportable...[OK] *Mar 1 02:18:59.051: %SSH-5-ENABLED: SSH 1.99 has been enabled Посмотреть ключи можно командой show crypto key mypubkey rsa Теперь к нашей конфигурации добавляем следущее: ! ip host cisco.golovnoy-ofis.ru 192.168.255.26 ! crypto keyring VPN rsa-pubkey address 192.168.255.26 address 192.168.255.26 key-string 30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00F5904E 0B9594D8 EEBDB0DA B539E03F C3A10D86 39A15549 9E90307F CCF234B6 63914E50 03D83A47 1C072384 01A1610A A0B01D37 5F36AEB1 328AD730 409024D3 E7965700 E3A54A3F 5F83D341 4CBE4FAB DD8A21D0 106E1246 082F3C0D D0A98281 57644546 5D562A4E E90CFE25 2F070F8C DFAB2E68 14819777 D77164AD 6BD22A4C 6B020301 0001 quit ! crypto isakmp policy 30 encr 3des hash md5 group 2 crypto isakmp identity hostname crypto isakmp keepalive 120 20 crypto isakmp profile VPN keyring VPN match identity host cisco.golovnoy-ofis.ru match identity address 192.168.255.26 ! ! ! crypto ipsec transform-set VPN esp-3des esp-sha-hmac mode transport ! crypto ipsec profile VPN set security-association level per-host set transform-set VPN set isakmp-profile VPN ! ! crypto map VPN 30 ipsec-isakmp set peer 192.168.255.26 set transform-set VPN set isakmp-profile VPN match address Golovnoy_Offis ! ! ! interface Tunnel0 bandwidth 1024 ip address 192.168.246.254 255.255.255.252 ip mtu 1380 ip tcp adjust-mss 1380 tunnel source Ethernet1 tunnel destination 192.168.255.26 tunnel protection ipsec profile VPN ! ip classless ip route 192.168.255.26 255.255.255.255 Ethernet1 10.1.1.100 permanent ip route 192.168.246.253 255.255.255.255 Tunnel0 permanent ! ip access-list extended Golovnoy_Offis permit gre host 10.1.1.28 host 192.168.255.26 Для второго маршрутизатора конфигурация будет зеркальной: ! ip host cisco.remote-ofis.ru 10.1.1.28 ! crypto keyring VPN rsa-pubkey address 10.1.1.28 address 10.1.1.28 key-string 30819F30 0D06092A 864886F7 0D100101 05000381 8D003081 89028181 0096086B 9EDFC43B F60F95BA 3271CCD4 AB36804B 036A781C 3586F932 6A34FCB6 521CDCCB 3D477896 32F21D60 B1F99FB9 700D08EF 9AAF9B46 F24ECF27 00CCB7B7 AA1A96F2 FACDE6FC 3842FA60 7290CBCF 49D2C6B1 6FF5BB36 0749E39F 7680D6C9 65C14BC3 5F9A25BE AD2A0374 72D23F93 82B0C211 7A9B3113 FF8EB7E8 31351D09 0F020301 0001 quit ! ! crypto isakmp policy 30 encr 3des hash md5 group 2 crypto isakmp identity hostname crypto isakmp keepalive 120 20 crypto isakmp profile VPN keyring VPN match identity host cisco.remote-ofis.ru match identity address 10.1.1.28 ! ! crypto ipsec transform-set VPN esp-3des esp-sha-hmac mode transport ! crypto ipsec profile VPN set security-association level per-host set transform-set VPN set isakmp-profile VPN ! ! crypto ipsec profile VPN set security-association level per-host set transform-set VPN set isakmp-profile VPN ! ! crypto map VPN 130 ipsec-isakmp set peer 10.1.1.28 set transform-set VPN set isakmp-profile VPN match address Remote_Offis ! ! interface Tunnel0 bandwidth 1024 ip address 192.168.246.253 255.255.255.252 ip mtu 1380 ip tcp adjust-mss 1380 tunnel source Ethernet1 tunnel destination 10.1.1.28 tunnel protection ipsec profile VPN ! ! ip access-list extended Remote_Offis permit gre host 192.168.255.26 host 10.1.1.28 Необходимо внести следущие изменения в наши списки доступа: ip access-list extended Input-Traf remark --- Remote-VPN ---------------------------- permit esp any host 10.1.1.28 permit ahp any host 10.1.1.28 permit gre any host 10.1.1.28 permit udp any host 10.1.1.28 eq isakmp permit udp any host 10.1.1.28 eq non500-isakmp remark ----- Deny incoming trafic ----- permit icmp any host 10.1.1.28 unreachable permit icmp any host 10.1.1.28 echo-reply permit icmp any host 10.1.1.28 packet-too-big permit icmp any host 10.1.1.28 time-exceeded permit icmp any host 10.1.1.28 traceroute permit icmp any host 10.1.1.28 administratively-prohibited permit icmp any host 10.1.1.28 echo deny ip any any И настроить маршрутизацию. Я большой противник статики, так как она неизбежно забывается и недокументируется. Данный маршрутизатор поддерживает только RIP, но советую настроить хотя бы его примерно следующим образом: ! router rip version 2 passive-interface default no passive-interface Tunnel0 network 192.168.1.0 network 192.168.246.0 ! Учтите, что если один из маршрутизаторов заходится за NAT, то необходимо указывать crypto isakmp identity hostname и использовать при этом адрес, которым роутер отображается в Интернет (внешний реальный адрес). Особое внимаение обратите на соответствие записей ip host, hosname и ip domain, так как в этом случае используется FQDN. Более подробно почитать о механизме установки защищенного соединения можно здесь: Configuring IPSec Network Security. Проверить состояние соединения можно командами: dream#ping 192.168.246.253 source 192.168.246.254 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.246.253, timeout is 2 seconds: Packet sent with a source address of 192.168.246.254 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 8/8/12 ms dream#sh crypto isakmp sa detail Codes: C - IKE configuration mode, D - Dead Peer Detection K - Keepalives, N - NAT-traversal X - IKE Extended Authentication psk - Preshared key, rsig - RSA signature renc - RSA encryption C-id Local Remote I-VRF Status Encr Hash Auth DH Lifetime Cap. 1 10.1.1.28 192.168.255.26 ACTIVE 3des md5 rsig 2 23:55:46 D Connection-id:Engine-id = 1:1(software) Команды отладки: * debug crypto isakmp вывод отладочной информации. При настройке туннеля настоятельно рекомендую включать до полной победы. * show crypto isakmp sa detail отображает все Internet Key Exchange (IKE) security associations (SA) с нашим маршрутизатором. * show crypto ipsec sa отображает настройки для текущих SA. * show crypto engine connections active покажет сводку конфигурационной информации. По материалам: Configuring IPSec Router-to-Router, Pre-shared, NAT Overload Between a Private and a Public Network Configuring an IPSec Router Dynamic LAN-to-LAN Peer and VPN Clients Router-to-Router IPSec (RSA Keys) on GRE Tunnel with RIP Configuration Example Расшифровка используемых адресов: * 10.1.1.28 IP адрес нашего маршрутизатора * 192.168.246.252/30 сеть туннеля * 192.168.255.26 IP адрес удаленного маршрутизатора

<< Предыдущая ИНДЕКС Правка src / Печать Следующая >>

 Добавить комментарий
Имя:
E-Mail:
Заголовок:
Текст:




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру