Ipsec over gre 实验报告
实验拓扑:
拓扑分析:
由4台路由组成,R1和R4的e0/1口分别模拟两端局域网的pc1和pc2
R2和R3模拟Internet
实验目的:
两端局域网可以相互通信,并且可以运行动态路由协议;
两端局域网流量加密;
两端局域网可以访问Internet
实验分析:
两端流量加密使用IpSec
局域网可以运行动态路由协议,则须在局域网路由器上运行GRE
局域网可以访问Internet,则局域网路由器上须运行NAT
注:
运行动态路由协议的前提是组播更新,而IpSec使用的是单播地址,所以只运行了IpSec的路由上不能运行动态路由协议,因此可以使用GRE的Tunnel来运行动态路由协议,因为GRE使用的是组播地址,并支持多种协议。采用分流的方法将公网流量和私网流量分离,公网从公网接口进入Internet,私网流量通过Tunnel相互通信,这样加密的只是私网的流量,则定义的map应该应用在Tunnel口。
==================================================================
R1
crypto isakmp policy 1
encr 3des
authentication pre-share
group 2
crypto isakmp key 6 cisco address 30.1.1.2
!
crypto ipsec transform-set set ah-sha-hmac esp-3des
!
crypto map mymap 1 ipsec-isakmp
set peer 30.1.1.2
set transform-set set
set pfs group2
match address 100
!
interface Tunnel1
ip address 10.1.1.1 255.255.255.0 //Tunnel地址为任意
tunnel source 100.1.1.1 //源公网地址
tunnel destination 30.1.1.2 //目的公网地址
crypto map mymap
// 需将map应用到tunnel口,
!
interface Ethernet0/0
ip address 100.1.1.1 255.255.255.0
ip nat outside
ip virtual-reassembly
half-duplex
!
interface Ethernet0/1
ip address 192.168.1.1 255.255.255.0
ip nat inside
ip virtual-reassembly
half-duplex
!
router eigrp 1
//在局域网间运行动态路由协议
network 10.0.0.0 //发布Tunnel的地址网段
network 192.168.1.0 //发布私网地址网段
auto-summary
no ip http secure-server
!p http server
ip route 0.0.0.0 0.0.0.0 Ethernet0/0 //局域网默认路由指向公网接口
!
ip nat inside source list 1 interface Ethernet0/0 overload
//overload使局域网内部地址使用接入公网的地址的不同端口访问Internet
!
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 100 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 //允许私网流量相互访问
================================================================
R4
crypto isakmp policy 1
encr 3des
authentication pre-share
group 2
crypto isakmp key 6 cisco address 100.1.1.1
!
crypto ipsec transform-set set ah-sha-hmac esp-3des
!
crypto map mymap 1 ipsec-isakmp
set peer 100.1.1.1
set transform-set set
set pfs group2
match address 100
!
interface Tunnel1
ip address 10.1.1.2 255.255.255.0
tunnel source 30.1.1.2
tunnel destination 100.1.1.1
crypto map mymap
!
interface Ethernet0/0
ip address 30.1.1.2 255.255.255.0
ip nat outside
ip virtual-reassembly
half-duplex
!
interface Ethernet0/1
ip address 192.168.2.1 255.255.255.0
ip nat inside
ip virtual-reassembly
half-duplex
!
router eigrp 1
network 10.0.0.0
network 192.168.2.0
auto-summary
ip route 0.0.0.0 0.0.0.0 Ethernet0/0
!
ip nat inside source list 1 interface Ethernet0/0 overload
!
access-list 1 permit 192.168.2.0 0.0.0.255
access-list 100 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255
转载于:https://blog.51cto.com/dj35240/608678