IPSec概述

IPSec是一个工业标准网络安全协议,为 IP 网络通信提供透明的安全服务,保护 TCP通信免遭窃听和篡改,可以有效抵御网络***,同时保持易用性。

IPSec工作原理
 
IPSec 协议不是一个单独的协议,它给出了应用于IP层上网络数据安全的一整套体系结构,包括网络认证协议(AH)、封装安全载荷协议(ESP)、**管理协议(IKE)和用于网络认证及加密的一些算法等。
IPSec 规定了如何在对等层之间选择安全协议、确定安全算法和**交换,向上提供了访问控制、数据源认证、数据加密等网络安全服务
 
案例:
 
实验目的:利用ipsec实现***虚拟链路,总部能通过虚拟链路访问到分公司1和分公司2.使其实现网络间的通信。
实验设备:三台路由器 一台交换机(模拟Internet网络)
实验拓扑图:

ipsec在企业网中的应用

实验步骤:
 实验说明:网络中心的三层交换机用来模仿internet
r1路由器配置
1.配置ip地址和默认路由
[Router] ip route 0.0.0.0 0 1.1.1.2  (为了能够访问到因特网)
2.流量筛选

  1. [Router] acl 3000  
  2. [Router-acl-3000] rule permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255  
  3. [Router-acl-3000] rule deny ip source any destination any  
  4. [Router] acl 3001  
  5. [Router-acl-3001] rule permit ip source 192.168.1.0 0.0.0.255 destination 192.168.3.0 0.0.0.255  
  6. [Router-acl-3001] rule deny ip source any destination any  
3.安全提议(想法)

  1. [Router] ipsec proposal tran1(安全提议的名称)  
  2. [Router-ipsec-proposal-tran1] encapsulation-mode tunnel(选择隧道模式封装)  
  3. [Router-ipsec-proposal-tran1] transform esp-new(选择安全协议)
  4. [Router-ipsec-proposal-tran1] esp-new encryption-algorithm des(设置des加密算法)  
  5. [Router-ipsec-proposal-tran1] esp-new authentication-algorithm md5 (设置md5校验方法)  

 4.安全策略

  1. [Router] ipsec policy policy1(表格名称)10(第10条规则) isakmp(安全策略靠动态生成)  
  2. [Router-ipsec-policy-policy1-10] security acl 3000  
  3. [Router-ipsec-policy-policy1-10] proposal tran1(符合条目3000的走安全提议tran1)  
  4. [Router-ipsec-policy-policy1-10] tunnel remote 1.1.2.1(ip地址为对方分公司1的地址)  
  5. [Router] ipsec policy policy1 20 isakmp  
  6. [Router-ipsec-policy-policy1-10] security acl 3001  
  7. [Router-ipsec-policy-policy1-10] proposal tran1  
  8. [Router-ipsec-policy-policy1-10] tunnel remote 1.1.3.1  

 5.身份验证(一阶段协商需要)

  1. [Router] ike pre-shared-key abcdefg(域共享**) remote 1.1.2.1  
  2. [Router] ike pre-shared-key abcdefgh(域共享**) remote 1.1.3.1  
  3. [Router] int eth0  (外出接口)
  4. [Router-Serial0/1] ipsec policy policy1(在端口上应用安全策略组)  
 
实验结果:
 
总部r1的配置:

  1. [r1]dis cu  
  2.   Now create configuration...  
  3.   Current configuration  !  
  4. version 1.74  
  5. local-user user1 service-type administrator password simple 123  
  6.     sysname r1  
  7. firewall enable  
  8. aaa-enable  
  9. aaa accounting-scheme optional!  
  10. ike pre-shared-key abcdefgh remote 192.168.3.1  
  11. ike pre-shared-key abcdefg remote 192.168.2.1  
  12. !  
  13.   acl 3000 match-order auto  
  14. rule normal permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255  
  15. !  
  16. acl 3001 match-order auto  
  17.     rule normal permit ip source 192.168.1.0 0.0.0.255 destination 192.168.3.0 0.0.0.255  
  18.   !  
  19.   ipsec proposal tran1  
  20.   !  
  21.   ipsec policy policy1 10 isakmp  
  22.     security acl 3000                       
  23.     proposal tran1  
  24.     tunnel remote 1.1.2.1  
  25.   !  
  26.   ipsec policy policy1 20 isakmp  
  27.     security acl 3001  
  28.     proposal tran1  
  29.     tunnel remote 1.1.3.1  
  30.   !  
  31.   interface Aux0   
  32.     async mode flow  
  33.     link-protocol ppp  
  34.   !  
  35.   interface Ethernet0   
  36.     ip address 192.168.101.5 255.255.255.0  
  37.   !  
  38.   interface Ethernet1   
  39.     ip address 1.1.1.1 255.255.255.0  
  40.     ipsec policy policy1   
  41.   !  
  42.   interface Serial0   
  43.     link-protocol ppp  
  44. quit  
  45.   ip route-static 0.0.0.0 0.0.0.0 1.1.1.2 preference 60   
  46.   !  
  47.   return  
总部ping两个分公司:

  1. r1]ping 192.168.2.1  
  2.   PING 192.168.2.1: 56  data bytes, press CTRL_C to break  
  3.     Reply from 192.168.2.1: bytes=56 Sequence=0 ttl=255 time = 3 ms  
  4.     Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=255 time = 3 ms  
  5.     Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=255 time = 3 ms  
  6.     Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=255 time = 3 ms  
  7.     Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=255 time = 3 ms  
  8.   --- 192.168.2.1 ping statistics ---  
  9.     5 packets transmitted  
  10.     5 packets received  
  11.     0.00% packet loss  
  12.     round-trip min/avg/max = 3/3/3 ms  
  13. [r1]ping 192.168.3.1  
  14.   PING 192.168.3.1: 56  data bytes, press CTRL_C to break  
  15.     Reply from 192.168.3.1: bytes=56 Sequence=0 ttl=255 time = 3 ms  
  16.     Reply from 192.168.3.1: bytes=56 Sequence=1 ttl=255 time = 3 ms  
  17.     Reply from 192.168.3.1: bytes=56 Sequence=2 ttl=255 time = 3 ms  
  18.     Reply from 192.168.3.1: bytes=56 Sequence=3 ttl=255 time = 3 ms  
  19.     Reply from 192.168.3.1: bytes=56 Sequence=4 ttl=255 time = 3 ms  
  20.   --- 192.168.3.1 ping statistics ---  
分公司1的配置:

  1. R2]dis cu  
  2.   Now create configuration...  
  3.   Current configuration  
  4.   !  
  5.     version 1.74  
  6.     local-user user1 service-type administrator password simple 123  
  7.     sysname R2  
  8.     undo pos-server addr-switch  
  9.     firewall enable  
  10.     aaa-enable  
  11.     aaa accounting-scheme optional  
  12.   !  
  13.   ike pre-shared-key abcdefg remote 1.1.1.1  
  14.   !  
  15.   acl 3000 match-order auto  
  16.     rule normal permit ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0 0.0.0.255  
  17.     rule normal deny ip source any destination any  
  18.   !  
  19.   ipsec proposal tuan1  
  20.   !  
  21.   ipsec policy policy2 10 isakmp  
  22.     security acl 3000  
  23.     proposal tuan1  
  24.     tunnel remote 192.168.1.1               
  25.   !  
  26.   interface Aux0   
  27.     async mode flow  
  28.     link-protocol ppp  
  29.   !  
  30.   interface Ethernet0   
  31.     ip address 192.168.101.2 255.255.255.0  
  32.     ipsec policy policy2   
  33.   !  
  34.   interface Ethernet1   
  35.     ip address 1.1.2.1 255.255.255.0  
  36.     ipsec policy policy2   
  37. quit  
  38.   ip route-static 0.0.0.0 0.0.0.0 1.1.2.2 preference 60   
  39.   !  
  40.   return  


分公司2ping总部:

  1. R2]ping 192.168.1.1  
  2.   PING 192.168.1.1: 56  data bytes, press CTRL_C to break  
  3.     Reply from 192.168.1.1: bytes=56 Sequence=0 ttl=255 time = 4 ms  
  4.     Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time = 4 ms  
  5.     Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time = 4 ms  
  6.     Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time = 4 ms  
  7.     Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time = 4 ms  
  8.   --- 192.168.1.1 ping statistics ---  
  9.     5 packets transmitted  
  10.     5 packets received  
  11.     0.00% packet loss  
  12.     round-trip min/avg/max = 4/4/4 ms  
分公司2的配置:

  1. [R3]dis cu  
  2.   Now create configuration...  
  3.   Current configuration  
  4.   !  
  5.     version 1.74  
  6.     sysname R3  
  7.     undo pos-server addr-switch  
  8.     firewall enable  
  9.     aaa-enable  
  10.     aaa accounting-scheme optional  
  11.   !  
  12.   ike pre-shared-key abcdefgh remote 1.1.1.1  
  13.   !  
  14.   acl 3001 match-order auto  
  15.     rule normal permit ip source 192.168.3.0 0.0.0.255 destination 192.168.1.0 0.0.0.255  
  16.   !  
  17.   ipsec proposal tran3  
  18.   !  
  19.   ipsec policy policy3 20 isakmp  
  20.     security acl 3001  
  21.     proposal tran3  
  22.     tunnel remote 1.1.1.1  
  23.   !  
  24.   interface Aux0   
  25.     async mode flow                         
  26.     link-protocol ppp  
  27.   !  
  28.   interface Ethernet0   
  29.   !  
分公司2ping总部:

  1. [R3]ping 192.168.1.1  
  2.   PING 192.168.1.1: 56  data bytes, press CTRL_C to break  
  3.     Reply from 192.168.1.1: bytes=56 Sequence=0 ttl=255 time = 3 ms  
  4.     Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time = 3 ms  
  5.     Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time = 3 ms  
  6.     Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time = 3 ms  
  7.     Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time = 3 ms  
  8.   --- 192.168.1.1 ping statistics ---  
  9.     5 packets transmitted  
  10.     5 packets received  
  11.     0.00% packet loss  
  12.     round-trip min/avg/max = 3/3/3 ms  
 
三层交换机的配置:

  1. interface Vlan-interface1  
  2.  ip address 192.168.101.32 255.255.255.0  
  3. #  
  4. interface Vlan-interface2  
  5. #  
  6. interface Vlan-interface10  
  7.  ip address 1.1.1.2 255.255.255.0  
  8. #  
  9. interface Vlan-interface20  
  10.  ip address 1.1.2.2 255.255.255.0  
  11. #                                           
  12. interface Vlan-interface30  
  13.  ip address 1.1.3.2 255.255.255.0  
  14. #  
  15. interface Aux0/0  
  16. #  
  17.    
  18.  
  19. interface Ethernet0/5  
  20.  port access vlan 10  
  21. #  
  22. interface Ethernet0/6  
  23.  port access vlan 20  
  24. #  
  25. interface Ethernet0/7  
  26.  port access vlan 30  
  27. #                                           
  28. interface Ethernet0/8  
 

转载于:https://blog.51cto.com/yz406/959190

相关文章: