个人对
×××
的理解
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
×××
:虚拟的专用网络,与
mpLS
的核心
×××
不同,只是一种客户端的接入技术。用于加密隧道、加密数据、保护
INTERNET
流量、保护内部流量不被******和建立私有的网络。有两种模式:
一:传输模式:连接用于在设备的真正源与目标
IP
地址之间传输数据叶使用。用于两台主机之间,保护上层协议,在
IP
头和上层协议头之间插入
IPSec
头,如:〔
IP
头〕
〔
IPSec
头〕〔上层协议〕。
二:隧道模式
(tunnel)
保护整个
IP
包,只要安全联盟的任意一端是安全网关,就必须使用隧道模式。在其外部添加
IPSec
头,加密验证原
IP
包,然后用外部
IP
头封装整个处理过的数据包。如:〔外部
IP
头〕〔
IPSec
头〕〔内部
IP
头〕〔上层协议〕。在这种模式中,实际的源与目标设备通常不保护流量,相反某些中间设备用于保护这些流量。每一个位置的两台路由器可以负责
×××
的保护,代表其他设备提供
×××
保护的设备通常被称为
×××
网关。
验证:设备验证:共享密钥(不好的地方是双方互联,每增加一个密钥则手动添加,增加
CPU
负担)
RSA
签名(第三方加密如银行卡)一般用共享密钥就可
用户验证:提供帐户和密码与设备加密同用。设备比较和校验,采用用户验证提供登录。
封装方法;二
层的,三层的和应用层的
数据加密:对称:明文与密文(橙汁),只有一把密钥。
非对称:一把公钥,一把私钥
数据包的完整性:签名技术(切割签名来标记这个分开的包的完整性)
密钥管理:动态(一边为动一边为适应)
静态(两边一起为静态)
抗抵赖性:在
×××
加密以后,再次
CA
的一种校验模式,比如银行卡的电子商务
启用程序协议的支持:可支持以下的协议进行――
IP
、
IPX
、
APPTALLK
地址的管理(远程
×××
)用
AAA
与
DHCP
为远程客户分配地址。
×××
联网须考虑的:被保护和非保护流量、
×××
冗余、碎片。
哪些协议可以实施这类
×××
??
GRE
、(
CISCO
)
IPSEC
(
IEEE
)
PPTP
、
L2TP
(
WINDOWS
)
MPLS
、
SSL
(
IETF
)
IPSEC
介绍:
只支持
IP
,只单播,三层的。有两种安全保护:
AH
(头部验证加密明文)
ESP
(压缩校验密文)
使用
UTP500
的端口。
ISAKMP
/IKE;ISAKMP
――定义消息的格式和密钥交换协议的机制。
IKE
――定义了密钥的产生和共享密钥管理。
IKE
用
DH
算法产生对称的
KEY
,建立一个
SA
ISAKMP
,
IKE
分两个阶段。一是管理通道,
UTP500
来通信;第二个是数据信道(起用
IPSEC
的)用两个安全协议来保护在
ISAKMAPIKE
阶段
2
的数据连接中传输的数据:
AH
:协议号为
51
,
SPI
就在其中的
LCV
中,它保护整个数据包,由于
NAT
会改变源和目的
IP
,但是
AH
在建立
ICV
的值时,使用这些字段进行
HMAP
运算,所以会产生变化,只能用于网络内部传输模式连接中。
ESP
:协议号为
50
,提供与
AH
类似的服务,但他会对用户数据的加密,验证和完整性只包括
ESP
头和有效负载,不包括外部的
IP
头。通过
NAT
没有问题。然而,却不能与
PAT
一起工作,这是因为
PAT
需要在外面的头中有
TCP
或者
UDP
的端口号,而
ESP
是一个第三层的协议,缺乏这项功能。有三个方案:
IPSEC OVER TCP
与
IPSEC OVER UDP
一个标准的
UDP
头总是插入到外部的
IP
头和
ESP
之间。默认为
10000
是
CISCO
私有的。
.NAT
-
T
,一个测试的
ESP
数据包在两台
IPSEC
设备之间发送,它在外部的
IP
头有一个标准的
UDP4500
端口号。
DIFFIEHELLMAN----DH(
密钥交换协议
)
放在
不同的组里产生的密码等级不一样。
r2(config-isakmp)#group ?
1 Diffie-Hellman group 1
2 Diffie-Hellman group 2
(
1024
个比特加密)
5 Diffie-Hellman group 5
SA
:在
IPSec
中,安全联盟
(SA)
就是两个
IPSec
系统之间的一个单向逻辑连接,是安全策略的具体化和实例化,它提供了保护通信的具体细节。通常用一个三元组唯一的表示:
<
安全参数索引
(SPI)
,
IP
目的地址,安全协议
(AH
和
ESP)
标识符
>
。
SA
规定了用于保密通信的一组安全参数,包括:验证算法、加密算法、协议模式、安全联盟的源地址、
SA
的生存期
(TTL)
和序列号计数器等。两个
SA
,每一个阶建立一个
SA
。第一个是起用
ISAKMP
产生的
SA
,第二个是
IPSEC
产生的
SA
:一系列加密的组件,相当于一个模型,用这个模型可以在数据来时直接套用。
HMAP
:数据包的签名,为了保护数据包的完整性和数据包的验证。在加密后的数据上再从
DH
里产生密钥进行
HMAP
运算,产生一系列数字符与数据一同发出,防止被中间人***。
常用加密算法:
DES
(
56
位)、
3DES
、
AES
代替
3DES
的比他更快更安全、
CAST
、
IDEA
、
RSA
(最大
2048
位加密)
HMAP
的签名方式有
MD5
与
SHA
。
lifetime: 86400 seconds, no volume limit
(默认是
86400
可改两边不一样)
SPI
:安全索引:进的一个出的一个,两边的刚好相反。也可以说是一系列的密码操作后产生的你们之间的一个系列号码,代表你的所有加密。
inbound esp sas:
spi: 0x3E78AA1D(1048095261)
outbound esp sas:
spi: 0x6FD9D256(1876546134)
端对端的
IPSEC×××
试验:
R1
:
crypto isakmp policy 2
(配置
ISAKMP/IKE
阶段一)
encr 3des
(封装)
hash md5
(用哈西算法签名)
authentication pre-share
(设备验证用共享密钥)
group 2
(加密组为
2,
共三组,每组加密程度不一样
708
-
1024
-
2048
位)
crypto isakmp key 6 zxy address 172.16.1.2
(与对方建立对等邻居并设密码
ZXY
)
阶段二:(
IPSEC PHAES
)
crypto ipsec transform-set cisco esp-des esp-sha-hmac
(
定义IPSEC用的是压缩验证,启用IPSEC模式
配置
ISAKMP/IKE
阶段二)
crypto map cisco 12 ipsec-isakmp
(
建立一个映射,这个映射是跟对端去建立,他的名字叫cisco)
set peer 172.16.1.2
(建立对端的邻居)
set transform-set cisco
(调用上面的转换验证
CISCO
要与上面的一样)
set pfs group1
(
设置PFS字段,没有什么太大的意义,可以不设置)
match address 101
(这些配置调用建立的访控列表
101
)
interface Loopback0
ip address <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />1.1.1.1 255.255.255.0
interface FastEthernet0/0
ip address 172.16.1.1 255.255.255.0
duplex half
crypto map cisco
ip route 2.2.2.0 255.255.255.0 172.16.1.2
!
no ip http server
no ip http secure-server
access-list 101 permit ip 1.1.1.0 0.0.0.255 2.2.2.0 0.0.0.255
(列表
101
)
control-plane
R2
:
crypto isakmp policy 2
(配置
ISAKMP/IKE
阶段一)同R1
encr 3des
hash md5
authentication pre-share
group 2
crypto isakmp key 6 zxy address 172.16.1.1
crypto ipsec transform-set cisco esp-des esp-sha-hmac
(配置
ISAKMP/IKE
阶段二IPSEC)
!
crypto map cisco 12 ipsec-isakmp
set peer 172.16.1.1
set transform-set cisco
set pfs group1
match address 101
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 172.16.1.2 255.255.255.0
duplex half
crypto map cisco
(端口调用我们建立的一个列表映射)两边一定都要写,才能起来第一步
ip route 1.1.1.0 255.255.255.0 172.16.1.1
access-list 101 permit ip 2.2.2.0 0.0.0.255 1.1.1.0 0.0.0.255
r2#show crypto isakmp sa
dst src state conn-id slot status
172.16.1.1 172.16.1.2 QM_IDLE 2 0 ACTIVE
(第一个
SA
,若没有建立则会为
DELNET
)
r2#show crypto ipsec sa
(查看第二个
SA
也就是转发的
IPSEC
的
SA
)
interface: FastEthernet0/0
Crypto map tag: cisco, local addr 172.16.1.2
protected vrf: (none)
local ident (addr/mask/prot/port): (2.2.2.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (1.1.1.0/255.255.255.0/0/0)
current_peer 172.16.1.1 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 0, #pkts encrypt: 0, #pkts digest: 0
#pkts decaps: 0, #pkts decrypt: 0, #pkts verify: 0
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0
local crypto endpt.: 172.16.1.2, remote crypto endpt.: 172.16.1.1
path mtu 1500, ip mtu 1500
current outbound spi: 0x0(0)
inbound esp sas:
inbound ah sas:
inbound pcp sas:
outbound esp sas:
outbound ah sas:
outbound pcp sas:
2#show crypto isakmp sa
dst src state conn-id slot status
172.16.1.2 172.16.1.1 MM_NO_STATE 1 0 ACTIVE (deleted)
R1
:
r1#show crypto ipsec sa
interface: FastEthernet0/0
Crypto map tag: cisco, local addr 172.16.1.1
protected vrf: (none)
local ident (addr/mask/prot/port): (1.1.1.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (2.2.2.0/255.255.255.0/0/0)
current_peer 172.16.1.2 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 4, #pkts encrypt: 4, #pkts digest: 4
#pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0
local crypto endpt.: 172.16.1.1, remote crypto endpt.: 172.16.1.2
path mtu 1500, ip mtu 1500
current outbound spi: 0xEAF9BF46(3942235974)
inbound esp sas:
(进的方向的
SPI
与对方的出的方向一样)
spi: 0x4486A654(1149675092)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: cisco
sa timing: remaining key lifetime (k/sec): (4427044/3590)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
inbound ah sas:
inbound pcp sas:
outbound esp sas:
(出的方向与对方进的方向一样的
SPI
值
spi: 0xEAF9BF46(3942235974)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: cisco
sa timing: remaining key lifetime (k/sec): (4427044/3589)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
outbound ah sas:
R2
:
2#SHOW crypto ipsec sa
interface: FastEthernet0/0
Crypto map tag: cisco, local addr 172.16.1.2
protected vrf: (none)
local ident (addr/mask/prot/port): (2.2.2.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (1.1.1.0/255.255.255.0/0/0)
current_peer 172.16.1.1 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 4, #pkts encrypt: 4, #pkts digest: 4
#pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 1, #recv errors 0
local crypto endpt.: 172.16.1.2, remote crypto endpt.: 172.16.1.1
path mtu 1500, ip mtu 1500
current outbound spi: 0x4486A654(1149675092)
inbound esp sas:
spi: 0xEAF9BF46(3942235974)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: cisco
sa timing: remaining key lifetime (k/sec): (4390262/3431)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
inbound ah sas:
inbound pcp sas:
outbound esp sas:
spi: 0x4486A654(1149675092)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: cisco
sa timing: remaining key lifetime (k/sec): (4390262/3429)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
动态的
CRYPTO
-
MAP
R2
:
crypto isakmp policy 1
encr 3des
hash md5
authentication pre-share
group 5
crypto isakmp key 6 zxy address 0.0.0.0 0.0.0.0
(设置的对等体为任意一个)
!
!
crypto ipsec transform-set zxy esp-des esp-sha-hmac
!
crypto dynamic-map cisco 15
(先建立一个动态的
MAP
)
set transform-set zxy
set pfs group1
(不用访控列表)
!
crypto map cisco
15 ipsec-isakmp dynamic cisco
(调用那个动态的
! MAP
访控列表为
CISCO 15
要先再一个静态的,在里面调用那个动态的再用在端口)
!
!interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 172.16.1.2 255.255.255.0
duplex half
crypto map cisco
!
interface Serial1/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/1
ip route 1.1.1.0 255.255.255.0 172.16.1.1
只有当
R1
访问
R2
时他们才会建立连续结,不能用动态的与拔叫静态的。
Ipsec over gre:
用管道来运载动态路由,因为
IPSEC
不支持动态路由。但一般都会用动态路由的,所以采用管道技术:
其余操作一样,只是在起链路时要建立两边的管道,并动态发布出去。然后除了在接口上应用
MAP
外还要在管道下运用。就是这一点区别!!
r1#show crypto ipsec sa
interface: FastEthernet0/0
Crypto map tag: zzz, local addr 172.16.1.1
protected vrf: (none)
local ident (addr/mask/prot/port): (1.1.1.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (20.20.20.0/255.255.255.0/0/0)
current_peer 172.16.1.2 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 4, #pkts encrypt: 4, #pkts digest: 4
#pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0
local crypto endpt.: 172.16.1.1, remote crypto endpt.: 172.16.1.2
path mtu 1500, ip mtu 1500
current outbound spi: 0x1A3A32AE(440021678)
inbound esp sas:
spi: 0x3E7908F3(1048119539)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: zzz
sa timing: remaining key lifetime (k/sec): (4494433/3548)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
inbound ah sas:
inbound pcp sas:
outbound esp sas:
spi: 0x1A3A32AE(440021678)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: zzz
sa timing: remaining key lifetime (k/sec): (4494433/3547)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
outbound ah sas:
outbound pcp sas:
interface: Tunnel1
Crypto map tag: zzz, local addr 172.16.1.1
protected vrf: (none)
local ident (addr/mask/prot/port): (1.1.1.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (20.20.20.0/255.255.255.0/0/0)
current_peer 172.16.1.2 port 500
PERMIT, flags={origin_is_acl,}
#pkts encaps: 4, #pkts encrypt: 4, #pkts digest: 4
#pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
#pkts compressed: 0, #pkts decompressed: 0
#pkts not compressed: 0, #pkts compr. failed: 0
#pkts not decompressed: 0, #pkts decompress failed: 0
#send errors 0, #recv errors 0
local crypto endpt.: 172.16.1.1, remote crypto endpt.: 172.16.1.2
path mtu 1500, ip mtu 1500
current outbound spi: 0x1A3A32AE(440021678)
inbound esp sas:
spi: 0x3E7908F3(1048119539)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2001, flow_id: SW:1, crypto map: zzz
sa timing: remaining key lifetime (k/sec): (4494433/3546)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
inbound ah sas:
inbound pcp sas:
outbound esp sas:
spi: 0x1A3A32AE(440021678)
transform: esp-des esp-sha-hmac ,
in use settings ={Tunnel, }
conn id: 2002, flow_id: SW:2, crypto map: zzz
sa timing: remaining key lifetime (k/sec): (4494433/3546)
IV size: 8 bytes
replay detection support: Y
Status: ACTIVE
转载于:https://blog.51cto.com/zxy911/95994