ipsec的配置

IPsec建立的5个步骤
1、Host A sends interesting traffic to host B
2、Routers A and B negotiate an IKE Phase 1 session.
3、Routers A and B negotiate an IKE Phase 2 session.
4、Information is exchanged via the IPsec tunnel.
5、The IPsec tunnel is terminated.
第一阶段:
兴趣流量一定要做扩展的;并且必须要对称;
第二阶段:
crypto isakmp policy
encryption
hash
authentication pre-share
group 2 (DH组)
lifetime 最大为86000
第三阶段:
crypto ipsec transform-set CCIE esp-aes-256 esp-hamac-md5
mode transport(默认tunnel)
第四阶段:
timeout到期后,IPsec的sa会终止,并重新生成新的SA,但邻居并不会down,网络会出现瞬间的中断;
Security Associations:包括三个方面
1、安全索引
2、SA database
Destination IP address
SPI
protocol(ESP or AH)
3、Security policy database(下面是辅助信息)
Encryption algorithm
Authentication algorithm
mode
key lifetime

设置site-to-site IPsec VPN的6个步骤:
1、Establish ISAKMP policy
2、Comfigure IPsec transform set
3、Comfigure crypto ACL
4、configure crypto map
5、apply crypto map to the interface
6、configure interface ACL

R4—R2—R1—R3—R5
配置接口地址R4是172.16.24.4,R5是192.168…35.5
R1R2R3运行eigrp
R2上启用nat
地址池:ip nat pool 12.1.1.24 12.1.1.24 netmask 255.255.255.0
ip access-list extended PAT
deny ip 172.16.24.0 0.0.0.255 192.168.35.0 0.0.0.255
permit ip 172.16.24.0 0.0.0.255 12.1.1.0 0.0.0.255
permit ip 172.16.24.0 0.0.0.255 13.1.1.0 0.0.0.255
permit ip 172.16.24.0 0.0.0.255 3.3.3.0 0.0.0.255

ip nat inside source list PAT pool 24 overload

interface ethernet 0/1
ip nat outside
interface ethernet 0/0
ip nat inside

在R3上做上面同样的步骤
然后在R2和R3上写静态指向对方的内网
然后就开始写IPsec
ip access-list extended crypto-acl
permit ip 172.16.24.0 0.0.0.255 192.168.35.0 0.0.0.255
然后创建设备认证预共享秘钥
crypto isakmp enable #不敲的话,第一阶段的isakmp就无法共享sa
crypto isakmp key CCIE address 13.1.1.3 0.0.0.0 (如果address 写0.0.0.0 0.0.0.0的话就是不匹配对方地址)
这种老的共享秘钥不能兼容vrf,如果要兼容vrf,必须敲新型的命令
crypto keyring cisco
pre-shared-key address 0.0.0.0 0.0.0.0 key CCIE
然后进入第一阶段sa设置
crypto isakmp policy 10
encryption aes 256
hash md5
authentication pre-share
group 24

R3上同样的配置
第一阶段结束后,可以开启一些特性
crypto isakmp keepalive 等等

然后进行第二阶段
crypto ipsec transform-set R2-R3 esp-ade 256 esp-md5-hmac
mode tunnel
R3上做同样的配置

crypto map CCIE 10 ipsec-isakmp
set peer 13.1.1.3
set transform-set R2-R3
match address crypto-acl
R3上同样的配置

int e0/0
crypto map CCIE

R3同样的配置

shwo crypto isakmp sa detail

3月21日 IPsec over GRE配置与 GRE over IPsec

crypto ipsec prefile CCIE
set transform-set CCIE

interface tunnel 23
trunnel pretection ipsec profile CCIE

你可能感兴趣的:(路由交换)