网站首页 语言 会计 电脑 医学 资格证 职场 文艺体育 范文
当前位置:书香门第 > IT认证 > 思科认证

思科IPSec基本命令汇总

栏目: 思科认证 / 发布于: / 人气:5.88K

“Internet 协议安全性 (IPSec)”是一种开放标准的框架结构,通过使用加密的安全服务以确保在 Internet 协议 (IP) 网络上进行保密而安全的通讯。那么思科怎么配置IPSec呢?配置命令如何?下面跟yjbys小编一起来看看吧!

思科IPSec基本命令汇总

  一、IPSec一些基本命令。

R1(config)#crypto ?

dynamic-map Specify a dynamic crypto map template

//创建或修改一个动态加密映射表

ipsec Configure IPSEC policy

//创建IPSec安全策略

isakmp Configure ISAKMP policy

//创建IKE策略

key Long term key operations

//为路由器的SSH加密会话产生加密密钥。后面接数值,是key modulus size,单位为bit

map Enter a crypto map

//创建或修改一个普通加密映射表

Router(config)#crypto dynamic-map ?

WORD Dynamic crypto map template tag

//WORD为动态加密映射表名

Router(config)#crypto ipsec ?

security-association Security association parameters

// ipsec安全关联存活期,也可不配置,在map里指定即可

transform-set Define transform and settings

//定义一个ipsec变换集合(安全协议和算法的一个可行组合)

Router(config)#crypto isakmp ?

client Set client configuration policy

//建立地址池

enable Enable ISAKMP

//启动IKE策略,默认是启动的

key Set pre-shared key for remote peer

//设置密钥

policy Set policy for an ISAKMP protection suite

//设置IKE策略的优先级

Router(config)#crypto key ?

generate Generate new keys

//生成新的密钥

zeroize Remove keys

//移除密钥

Router(config)#crypto map ?

WORD Crypto map tag

//WORD为map表名

  二、一些重要命令。

Router(config)#crypto isakmp policy ?

<1-10000> Priority of protection suite

//设置IKE策略,policy后面跟1-10000的数字,这些数字代表策略的优先级。

Router(config)#crypto isakmp policy 100//进入IKE策略配置模式,以便做下面的配置

Router(config-isakmp)#encryption ?//设置采用的加密方式,有以下三种

3des Three key triple DES

aes AES - Advanced Encryption Standard

des DES - Data Encryption Standard (56 bit keys).

Router(config-isakmp)#hash ? //采用的散列算法,MD5为160位,sha为128位。

md5 Message Digest 5

sha Secure Hash Standard

Router(config-isakmp)#authentication pre-share//采用预共享密钥的认证方式

Router(config-isakmp)#group ?//指定密钥的位数,越往下安全性越高,但加密速度越慢

1 Diffie-Hellman group 1

2 Diffie-Hellman group 2

5 Diffie-Hellman group 5

Router(config-isakmp)#lifetime ? //指定安全关联生存期,为60-86400秒

<60-86400> lifetime in seconds

Router(config)#crypto isakmp key *** address

//设置IKE交换的密钥,***表示密钥组成,表示对方的IP地址

Router(config)#crypto ipsec transform-set zx ?

//设置IPsec交换集,设置加密方式和认证方式,zx是交换集名称,可以自己设置,两端的名字也可不一样,但其他参数要一致。

ah-md5-hmac AH-HMAC-MD5 transform

ah-sha-hmac AH-HMAC-SHA transform

esp-3des ESP transform using 3DES(EDE) cipher (168 bits)

esp-aes ESP transform using AES cipher

esp-des ESP transform using DES cipher (56 bits)

esp-md5-hmac ESP transform using HMAC-MD5 auth

esp-sha-hmac ESP transform using HMAC-SHA auth

例:Router(config)#crypto ipsec transform-set zx esp-des esp-md5-hmac

Router(config)#crypto map map_zx 100 ipsec-isakmp

//建立加密映射表,zx为表名,可以自己定义,100为优先级(可选范围1-65535),如果有多个表,数字越小的越优先工作。

Router(config-crypto-map)#match address ?//用ACL来定义加密的通信

<100-199> IP access-list number

WORD Access-list name

Router(config-crypto-map)#set ?

peer Allowed Encryption/Decryption peer.//标识对方路由器IP地址

pfs Specify pfs settings//指定上面定义的密钥长度,即group

security-association Security association parameters//指定安全关联的生存期

transform-set Specify list of transform sets in priority order

//指定加密图使用的IPSEC交换集

router(config-if)# crypto map zx

//进入路由器的指定接口,应用加密图到接口,zx为加密图名。

  三、一个配置实验。

实验拓扑图:

1.R1上的配置。

Router>enable

Router#config terminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#hostname R1

//配置IKE策略

R1(config)#crypto isakmp enable

R1(config)#crypto isakmp policy 100

R1(config-isakmp)#encryption des

R1(config-isakmp)#hash md5

R1(config-isakmp)#authentication pre-share

R1(config-isakmp)#group 1

R1(config-isakmp)#lifetime 86400

R1(config-isakmp)#exit

//配置IKE密钥

R1(config)#crypto isakmp key 123456 address

//创建IPSec交换集

R1(config)#crypto ipsec transform-set zx esp-des esp-md5-hmac

//创建映射加密图

R1(config)#crypto map zx_map 100 ipsec-isakmp

R1(config-crypto-map)#match address 111

R1(config-crypto-map)#set peer

R1(config-crypto-map)#set transform-set zx

R1(config-crypto-map)#set security-association lifetime seconds 86400

R1(config-crypto-map)#set pfs group1

R1(config-crypto-map)#exit

//配置ACL

R1(config)#access-list 111 permit ip

//应用加密图到接口

R1(config)#interface s1/0

R1(config-if)#crypto map zx_map

2.R2上的配置。

与R1的配置基本相同,只需要更改下面几条命令:

R1(config)#crypto isakmp key 123456 address

R1(config-crypto-map)#set peer

R1(config)#access-list 111 permit ip

3.实验调试。

在R1和R2上分别使用下面的命令,查看配置信息。

R1#show crypto ipsec ?

sa IPSEC SA table

transform-set Crypto transform sets

R1#show crypto isakmp ?

policy Show ISAKMP protection suite policy

sa Show ISAKMP Security Associations

  四、相关知识点

对称加密或私有密钥加密:加密解密使用相同的'私钥

DES--数据加密标准 data encryption standard

3DES--3倍数据加密标准 triple data encryption standard

AES--高级加密标准 advanced encryption standard

一些技术提供验证:

MAC--消息验证码 message authentication code

HMAC--散列消息验证码 hash-based message authentication code

MD5和SHA是提供验证的散列函数

对称加密被用于大容量数据,因为非对称加密站用大量cpu资源

非对称或公共密钥加密:

RSA rivest-shamir-adelman

用公钥加密,私钥解密。公钥是公开的,但只有私钥的拥有者才能解密

两个散列常用算法:

HMAC-MD5 使用128位的共享私有密钥

HMAC-SHA-I 使用160位的私有密钥

ESP协议:用来提供机密性,数据源验证,无连接完整性和反重放服务,并且通过防止流量分析来限制流量的机密性,这些服务以来于SA建立和实现时的选择。

加密是有DES或3DES算法完成。可选的验证和数据完整性由HMAC,keyed SHA-I或MD5提供

IKE--internet密钥交换:他提供IPSEC对等体验证,协商IPSEC密钥和协商IPSEC安全关联

实现IKE的组件

1:des,3des 用来加密的方式

2:Diffie-Hellman 基于公共密钥的加密协议允许对方在不安全的信道上建立公共密钥,在IKE中被用来建立会话密钥。group 1表示768位,group 2表示1024位

3:MD5,SHA--验证数据包的散列算法。RAS签名--基于公钥加密系统