IPSec概述:
IPSec是一个工业标准网络安全协议,为 IP 网络通信提供透明的安全服务,保护 TCP通信免遭窃听和篡改,可以有效抵御网络***,同时保持易用性。
IPSec工作原理:
IPSec 协议不是一个单独的协议,它给出了应用于IP层上网络数据安全的一整套体系结构,包括网络认证协议(AH)、封装安全载荷协议(ESP)、**管理协议(IKE)和用于网络认证及加密的一些算法等。
IPSec 规定了如何在对等层之间选择安全协议、确定安全算法和**交换,向上提供了访问控制、数据源认证、数据加密等网络安全服务
案例:
实验目的:利用ipsec实现***虚拟链路,总部能通过虚拟链路访问到分公司1和分公司2.使其实现网络间的通信。
实验设备:三台路由器 一台交换机(模拟Internet网络)
实验拓扑图:
实验步骤:
实验说明:网络中心的三层交换机用来模仿internet
r1路由器配置
1.配置ip地址和默认路由
[Router] ip route 0.0.0.0 0 1.1.1.2 (为了能够访问到因特网)
2.流量筛选
- [Router] acl 3000
- [Router-acl-3000] rule permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255
- [Router-acl-3000] rule deny ip source any destination any
- [Router] acl 3001
- [Router-acl-3001] rule permit ip source 192.168.1.0 0.0.0.255 destination 192.168.3.0 0.0.0.255
- [Router-acl-3001] rule deny ip source any destination any
3.安全提议(想法)
- [Router] ipsec proposal tran1(安全提议的名称)
- [Router-ipsec-proposal-tran1] encapsulation-mode tunnel(选择隧道模式封装)
- [Router-ipsec-proposal-tran1] transform esp-new(选择安全协议)
- [Router-ipsec-proposal-tran1] esp-new encryption-algorithm des(设置des加密算法)
- [Router-ipsec-proposal-tran1] esp-new authentication-algorithm md5 (设置md5校验方法)
4.安全策略
- [Router] ipsec policy policy1(表格名称)10(第10条规则) isakmp(安全策略靠动态生成)
- [Router-ipsec-policy-policy1-10] security acl 3000
- [Router-ipsec-policy-policy1-10] proposal tran1(符合条目3000的走安全提议tran1)
- [Router-ipsec-policy-policy1-10] tunnel remote 1.1.2.1(ip地址为对方分公司1的地址)
- [Router] ipsec policy policy1 20 isakmp
- [Router-ipsec-policy-policy1-10] security acl 3001
- [Router-ipsec-policy-policy1-10] proposal tran1
- [Router-ipsec-policy-policy1-10] tunnel remote 1.1.3.1
5.身份验证(一阶段协商需要)
- [Router] ike pre-shared-key abcdefg(域共享**) remote 1.1.2.1
- [Router] ike pre-shared-key abcdefgh(域共享**) remote 1.1.3.1
- [Router] int eth0 (外出接口)
- [Router-Serial0/1] ipsec policy policy1(在端口上应用安全策略组)
实验结果:
总部r1的配置:
- [r1]dis cu
- Now create configuration...
- Current configuration !
- version 1.74
- local-user user1 service-type administrator password simple 123
- sysname r1
- firewall enable
- aaa-enable
- aaa accounting-scheme optional!
- ike pre-shared-key abcdefgh remote 192.168.3.1
- ike pre-shared-key abcdefg remote 192.168.2.1
- !
- acl 3000 match-order auto
- rule normal permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255
- !
- acl 3001 match-order auto
- rule normal permit ip source 192.168.1.0 0.0.0.255 destination 192.168.3.0 0.0.0.255
- !
- ipsec proposal tran1
- !
- ipsec policy policy1 10 isakmp
- security acl 3000
- proposal tran1
- tunnel remote 1.1.2.1
- !
- ipsec policy policy1 20 isakmp
- security acl 3001
- proposal tran1
- tunnel remote 1.1.3.1
- !
- interface Aux0
- async mode flow
- link-protocol ppp
- !
- interface Ethernet0
- ip address 192.168.101.5 255.255.255.0
- !
- interface Ethernet1
- ip address 1.1.1.1 255.255.255.0
- ipsec policy policy1
- !
- interface Serial0
- link-protocol ppp
- quit
- ip route-static 0.0.0.0 0.0.0.0 1.1.1.2 preference 60
- !
- return
总部ping两个分公司:
- r1]ping 192.168.2.1
- PING 192.168.2.1: 56 data bytes, press CTRL_C to break
- Reply from 192.168.2.1: bytes=56 Sequence=0 ttl=255 time = 3 ms
- Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=255 time = 3 ms
- Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=255 time = 3 ms
- Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=255 time = 3 ms
- Reply from 192.168.2.1: bytes=56 Sequence=4 ttl=255 time = 3 ms
- --- 192.168.2.1 ping statistics ---
- 5 packets transmitted
- 5 packets received
- 0.00% packet loss
- round-trip min/avg/max = 3/3/3 ms
- [r1]ping 192.168.3.1
- PING 192.168.3.1: 56 data bytes, press CTRL_C to break
- Reply from 192.168.3.1: bytes=56 Sequence=0 ttl=255 time = 3 ms
- Reply from 192.168.3.1: bytes=56 Sequence=1 ttl=255 time = 3 ms
- Reply from 192.168.3.1: bytes=56 Sequence=2 ttl=255 time = 3 ms
- Reply from 192.168.3.1: bytes=56 Sequence=3 ttl=255 time = 3 ms
- Reply from 192.168.3.1: bytes=56 Sequence=4 ttl=255 time = 3 ms
- --- 192.168.3.1 ping statistics ---
分公司1的配置:
- R2]dis cu
- Now create configuration...
- Current configuration
- !
- version 1.74
- local-user user1 service-type administrator password simple 123
- sysname R2
- undo pos-server addr-switch
- firewall enable
- aaa-enable
- aaa accounting-scheme optional
- !
- ike pre-shared-key abcdefg remote 1.1.1.1
- !
- acl 3000 match-order auto
- rule normal permit ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
- rule normal deny ip source any destination any
- !
- ipsec proposal tuan1
- !
- ipsec policy policy2 10 isakmp
- security acl 3000
- proposal tuan1
- tunnel remote 192.168.1.1
- !
- interface Aux0
- async mode flow
- link-protocol ppp
- !
- interface Ethernet0
- ip address 192.168.101.2 255.255.255.0
- ipsec policy policy2
- !
- interface Ethernet1
- ip address 1.1.2.1 255.255.255.0
- ipsec policy policy2
- quit
- ip route-static 0.0.0.0 0.0.0.0 1.1.2.2 preference 60
- !
- return
分公司2ping总部:
- R2]ping 192.168.1.1
- PING 192.168.1.1: 56 data bytes, press CTRL_C to break
- Reply from 192.168.1.1: bytes=56 Sequence=0 ttl=255 time = 4 ms
- Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time = 4 ms
- Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time = 4 ms
- Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time = 4 ms
- Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time = 4 ms
- --- 192.168.1.1 ping statistics ---
- 5 packets transmitted
- 5 packets received
- 0.00% packet loss
- round-trip min/avg/max = 4/4/4 ms
分公司2的配置:
- [R3]dis cu
- Now create configuration...
- Current configuration
- !
- version 1.74
- sysname R3
- undo pos-server addr-switch
- firewall enable
- aaa-enable
- aaa accounting-scheme optional
- !
- ike pre-shared-key abcdefgh remote 1.1.1.1
- !
- acl 3001 match-order auto
- rule normal permit ip source 192.168.3.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
- !
- ipsec proposal tran3
- !
- ipsec policy policy3 20 isakmp
- security acl 3001
- proposal tran3
- tunnel remote 1.1.1.1
- !
- interface Aux0
- async mode flow
- link-protocol ppp
- !
- interface Ethernet0
- !
分公司2ping总部:
- [R3]ping 192.168.1.1
- PING 192.168.1.1: 56 data bytes, press CTRL_C to break
- Reply from 192.168.1.1: bytes=56 Sequence=0 ttl=255 time = 3 ms
- Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time = 3 ms
- Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time = 3 ms
- Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time = 3 ms
- Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time = 3 ms
- --- 192.168.1.1 ping statistics ---
- 5 packets transmitted
- 5 packets received
- 0.00% packet loss
- round-trip min/avg/max = 3/3/3 ms
三层交换机的配置:
- interface Vlan-interface1
- ip address 192.168.101.32 255.255.255.0
- #
- interface Vlan-interface2
- #
- interface Vlan-interface10
- ip address 1.1.1.2 255.255.255.0
- #
- interface Vlan-interface20
- ip address 1.1.2.2 255.255.255.0
- #
- interface Vlan-interface30
- ip address 1.1.3.2 255.255.255.0
- #
- interface Aux0/0
- #
- interface Ethernet0/5
- port access vlan 10
- #
- interface Ethernet0/6
- port access vlan 20
- #
- interface Ethernet0/7
- port access vlan 30
- #
- interface Ethernet0/8
转载于:https://blog.51cto.com/yz406/959190