使用eve-ng中的cisco路由器实现DMVPN

Dynamic Multipoint VPN—DMVPN
用途:当一个总部有多个分部时,如果使用普通动态的GRE OVER IPSECVPN,那么就要在总部为每个终端建立一个隧道,如果分部成成百上千,工作量。。。。你自己相像一下。这时使用DMVPN,多个客户端(SPOKE)总部(HUB)的配置不用改变.
配置思路:
创建ipsec加密,与动态ipsecvpn类似,只是最后的关联不是到物理接口,而是隧道接口引用。
协商ike算法、设置共享密钥,
创建变换集
创建ipsec模板
创建MGRE隧道
两个概念,MGRE\nhrp

nhrp:下一跳地址解析协议,总部路由器(hub)是server ,分部路由器(spoke)是client.hub上有所有分部物理接口的学真实ip地址,这些地址形成一个数据库,通过数据库中的ip,建立起GRE,隧道建立由client发起建立关联。

MGRE:多点GRE协议,解决只能单点建立隧道的问题
拓扑:
在这里插入图片描述
说明:
R1\R3\R6为总、分公司出口路由器
内网分别为10.1.1.0,10.2.2.0,10.3.3.0
内网间使用动态路由协议,OSPF
R2S模拟公网路由器,只配置接口ip,实现透明通信

配置
R1:
enable
conf t
hostname r1
line con 0
exec-t 0 0
exit

int e0/0
ip add 12.1.1.2 255.255.255.0
no sh
int e0/1
ip add 10.1.1.1 255.255.255.0
no sh
exit
ip route 0.0.0.0 0.0.0.0 12.1.1.1

router ospf 1
net 10.1.1.0 0.0.0.255 area 1
net 172.16.1.0 0.0.0.255 a 1
exit

创建ike策略
crypto isakmp policy 1
encr 3des
authentication pre-share
group 5
hash sha
exit
!指定预共享密钥,这里用的是cisco123,对端地址用0.0.0.0表任意地址
crypto isakmp key 0 cisco123 address 0.0.0.0

!创建变换集,名为ccie ,指定封装、认证的算法
crypto ipsec transform-set ccie esp-3des esp-sha-hmac
exit

!设置动态ipsec模板,将变换集关联
crypto ipsec profile ciscodmvpn
set transform-set ccie
exit

!创建隧道,(注,这个要放在后面做,否则在关联ipsec模板时由于找不到会出错)
interface Tunnel1
ip add 172.16.1.1 255.255.255.0 !设置隧道ip地址
ip nhrp authen ccie123 !设置谁密码,一个mgre中所有点的要一样
ip nhrp map multicast dynamic !使用动态组播映射
ip nhrp network-id 1 !指定nhrp-id,所有点要一样
tunnel source e0/0 !指定隧道源接口(物理接口)
tunnel mode gre multipoint !设置gre类型,这里是MGRE
tunnel protection ipsec profile ciscodmvpn !关联到ipsec模板,提供保护
ip ospf net broadcast !这里使用的是ospf,要设置network类型
ip ospf prio 255 !设置hub的优先级,255为最高,即将这个设备设置为主设备(相当于DR,adpx其它设备通信要通过主设备)

===========R2
enable
conf t
hostname r2
line con 0
exec-t 0 0
exit

int e0/0
ip add 12.1.1.1 255.255.255.0
no sh
int e0/1
ip add 23.1.1.1 255.255.255.0
no sh
int e0/2
ip add 26.1.1.1 255.255.255.0
no sh
exit

!
ip dhcp excluded-address 26.1.1.1 26.1.1.10
ip dhcp excluded-address 23.1.1.1 23.1.1.10
ip dhcp pool net_r6
network 26.1.1.0 255.255.255.0
default-router 26.1.1.1
!
ip dhcp pool net_r3
network 23.1.1.0 255.255.255.0
default-router 23.1.1.1

=======R3
enable
conf t
hostname r3
line con 0
exec-t 0 0
exit

int e0/0
ip add dhcp
no sh
int e0/1
ip add 10.2.2.1 255.255.255.0
no sh
exit
ip route 0.0.0.0 0.0.0.0 23.1.1.1

crypto isakmp policy 1
encr 3des
authentication pre-share
group 5
hash sha
exit

crypto isakmp key 0 cisco123 address 0.0.0.0

crypto ipsec transform-set ccie esp-3des esp-sha-hmac
exit

crypto ipsec profile ciscodmvpn
set transform-set ccie
exit

!创建分部(spoke)端的隧道
int tunnel 1
ip add 172.16.1.2 255.255.255.0 !隧道地址,和hub端在一个网段
ip nhrp authen ccie123 !认证密钥和总部一样
ip nhrp map 172.16.1.1 12.1.1.2 !设置总部的隧道接口和公网接口的映射绑定
ip nhrp map multicast 12.1.1.2 !指定hub发送组播的地址
ip nhrp network-id 1m !nhrp网络id,要一样
ip nhrp nhs 172.16.1.1 !设置hub服务器地址
tunnel source e0/0
tunnel mode gre multipoint
tunnel protection ipsec profile ciscodmvpn
ip ospf net broadcast !ospf模式为广播,默认优先级为1,spoke不用设置也可
exit
router ospf 1
net 10.2.2.0 0.0.0.255 area 1
net 172.16.1.0 0.0.0.255 a 1
exit

=======R6
enable
conf t
hostname r6
line con 0
exec-t 0 0
exit

service dhcp
int e0/0
ip add dhcp
no sh
int e0/1
ip add 10.3.3.1 255.255.255.0
no sh
exit

ip route 0.0.0.0 0.0.0.0 26.1.1.1

crypto isakmp policy 1
encr 3des
authentication pre-share
group 5
hash sha
exit

crypto isakmp key 0 cisco123 address 0.0.0.0

crypto ipsec transform-set ccie esp-3des esp-sha-hmac
exit

crypto ipsec profile ciscodmvpn
set transform-set ccie
exit

int tunnel 1
ip add 172.16.1.3 255.255.255.0
ip nhrp authen ccie123
ip nhrp map 172.16.1.1 12.1.1.2
ip nhrp map multicast 12.1.1.2
ip nhrp network-id 1
ip nhrp nhs 172.16.1.1
tunnel source e0/0
tunnel mode gre multipoint
tunnel protection ipsec profile ciscodmvpn
ip ospf net broadcast
exit

验证:
r1 的IKE SA,可以看到有两个隧道对端
在这里插入图片描述

要总部内网ping测试到两个分部的通信
在这里插入图片描述
抓包查看,只看到esp封装,看不到内部。
在这里插入图片描述

  • 1
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值