суббота, 14 января 2017 г.

GNS3 - LAN-to-LAN IPsec туннель между двумя роутерами cisco.

Введение.

Приведенная схема показывает как организовать IPsec туннель между двумя роутерами cisco. Подобная схема позволяет организовывать защищенный корпоративный доступ между филиалами организации подключенных к сети Internet.

Инструменты.

Debian 3.16.36-1+deb8u2

GNS3 v. 0.8.7

c7200-adventerprisek9-mz.152-4.S3.image

Схема сети.



Конфигурация.

На роутерах RouterA и RouterB настроены виртуальные интерфейсы loopback 0, которые имитируются локальную сеть за роутерами(корпоративные офисы).

RouterA.




!
! Last configuration change at 20:33:46 UTC Thu Jan 12 2017
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname RouterA
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
no ip icmp rate-limit unreachable
!
!
!
!
!
!
no ip domain lookup
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
!
!
ip tcp synwait-time 5
!
!---Первая фаза IPsec, указываем параметры для взаимодействия LAN2LAN туннеля
!---в данном случае правило 10, шифрование md5, аутентификация по совместному ключу
!
crypto isakmp policy 10
hash md5
authentication pre-share
!
!---привязываем ключ шифрования к internet-адресу удаленного роутера
!
crypto isakmp key vpnuser address 10.0.0.2
!
!---Вторая фаза, создаем политику шифрования наших данных
!
crypto ipsec transform-set myset esp-des esp-md5-hmac
mode tunnel
!
!---Создаем карту шифрования, включает в себя адрес удаленного сервера,
!---настройки транспорта и access-list указывающий сети обмена
!
crypto map mymap 10 ipsec-isakmp
set peer 10.0.0.2
set transform-set myset
match address 100
!
!
!
!---Виртуальный интерфейс(сеть локальной сети за роутером RouterA)
!
interface Loopback0
ip address 10.1.1.1 255.255.255.0
!
!---Внешний интерфейс(в сторону internet). Здесь указываем crypto map.
!
interface FastEthernet0/0
ip address 172.16.1.1 255.255.255.0
speed auto
duplex auto
crypto map mymap
!
interface FastEthernet0/1
no ip address
shutdown
speed auto
duplex auto
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!---Интернет шлюз(маршрут) по умолчанию
!
ip route 0.0.0.0 0.0.0.0 172.16.1.2
!
!---Access-list разрешающий обмениваться сетям нашему офису(10.1.1.0/24) с
!---адресацией второго офиса(172.16.2.0/24). Указывает обратная маска.
!
access-list 100 permit ip 10.1.1.0 0.0.0.255 172.16.2.0 0.0.0.255
!
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line vty 0 4
login
!
!
end





 

Internet




!
!

!
! Last configuration change at 20:18:30 UTC Thu Jan 12 2017
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname internet
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
no ip icmp rate-limit unreachable
!
!
!
!
!
!
no ip domain lookup
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
!
!
ip tcp synwait-time 5
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
speed auto
duplex auto
!
interface FastEthernet0/1
ip address 172.16.1.2 255.255.255.0
speed auto
duplex auto
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line vty 0 4
login
!
!
end





 

RouterB




!

!
! Last configuration change at 20:36:43 UTC Thu Jan 12 2017
!
version 15.2
service timestamps debug datetime msec
service timestamps log datetime msec
!
hostname RouterB
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
no ip icmp rate-limit unreachable
!
!
!
!
!
!
no ip domain lookup
ip cef
no ipv6 cef
!
!
multilink bundle-name authenticated
!
!
!
!
!
!
!
!
!
!
!
!
ip tcp synwait-time 5
!
!
!---Первая фаза IPsec, указываем параметры для взаимодействия LAN2LAN туннеля
!---в данном случае правило 10, шифрование md5, аутентификация по совместному ключу
!
crypto isakmp policy 10
hash md5
authentication pre-share
!
!---привязываем ключ шифрования к internet-адресу удаленного роутера
!
crypto isakmp key vpnuser address 172.16.1.1
!
!---Вторая фаза, создаем политику шифрования наших данных
!
crypto ipsec transform-set myset esp-des esp-md5-hmac
mode tunnel
!
!---Создаем карту шифрования, включает в себя адрес удаленного сервера,
!---настройки транспорта и access-list указывающий сети обмена
!
crypto map mymap 10 ipsec-isakmp
set peer 172.16.1.1
set transform-set myset
match address 100
!
!
!
!---Виртуальный интерфейс(сеть локальной сети за роутером RouterB)
!
interface Loopback0
ip address 172.16.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 10.0.0.2 255.255.255.0
speed auto
duplex auto
crypto map mymap
!
interface FastEthernet0/1
no ip address
shutdown
speed auto
duplex auto
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
ip route 0.0.0.0 0.0.0.0 10.0.0.1
!
access-list 100 permit ip 172.16.2.0 0.0.0.255 10.1.1.0 0.0.0.255
!
!
!
control-plane
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
stopbits 1
line vty 0 4
login
!
!
end





Решение проблем.

show crypto ipsec sa - покажет настройки безопасности активной сессии SAs

show crypto isakmp sa - покажет прямые соединения IKE SAs

debug crypto ipsec

debug crypto isakmp

debug crypto engine

 

Комментариев нет:

Отправить комментарий