DS VPN实验

news2024/10/6 2:32:30

目录

DS VPN实验

1、首先为所有接口配置ip地址、回环地址:

2、为3-8这些设备配置一条缺省指向R2

3、在R1-R3-R4这三个设备之间搭建MGRE

4、配置OSPF让各个主机之间可以进行通信

5、修改隧道接口的网络类型为p2mp

6、在R1上开启重定向、在R3、R4上配置最短

7、现在需要在R3-R5-R6和R4-R7-R8这两个部分进行MGRE的搭建

8、现在就可以配置IPSEC了

9、测试

DS VPN实验

实验图拓扑:

 1、首先为所有接口配置ip地址、回环地址:

[R1]int gi 0/0/0
[R1-GigabitEthernet0/0/0]ip add 100.1.12.1 24
[R1]ip route-static 0.0.0.0 0 100.1.12.2

[R2]int g1/0/0
[R2-GigabitEthernet1/0/0]ip address 100.1.23.1 24
[R2-GigabitEthernet1/0/0]int gi 0/0/0
[R2-GigabitEthernet0/0/0]ip add 100.1.12.2 24 
[R2-GigabitEthernet0/0/0]in gi 0/0/2
[R2-GigabitEthernet0/0/2]ip add 100.1.24.1 24
[R2-GigabitEthernet0/0/2]int gi 2/0/0
[R2-GigabitEthernet2/0/0]ip add 100.1.26.1 24
[R2-GigabitEthernet2/0/0]int gi 3/0/0
[R2-GigabitEthernet3/0/0]ip add 100.1.27.1 24
[R2-GigabitEthernet3/0/0]int gi 4/0/0
[R2-GigabitEthernet4/0/0]ip add 100.1.28.1 24
[R2-GigabitEthernet4/0/0]int gi 1/0/0
[R2-GigabitEthernet1/0/0]ip add 100.1.25.1 24
[R2-GigabitEthernet1/0/0]int gi 0/0/1
[R2-GigabitEthernet0/0/1]ip add 100.1.23.1 24
[R2-GigabitEthernet0/0/1]int lo0
[R2-LoopBack0]ip add 10.2.2.2 24

[R3]int gi 0/0/0
[R3-GigabitEthernet0/0/0]ip add 100.1.23.2 24
[R3-LoopBack0]ip add 10.3.3.3 24
[R4]int gi 0/0/0
[R4-GigabitEthernet0/0/0]ip add 100.1.24.2 24
[R4-GigabitEthernet0/0/0]int lo0
[R4-LoopBack0]ip add 10.4.4.4 24
[R5]int gi 0/0/0
[R5-GigabitEthernet0/0/0]ip add 100.1.25.2 24
[R5-GigabitEthernet0/0/0]int lo0
[R5-LoopBack0]ip add 10.5.5.5 24
[R6]int gi 0/0/0
[R6-GigabitEthernet0/0/0]ip add 100.1.26.2 24
[R6-GigabitEthernet0/0/0]int lo0
[R6-LoopBack0]ip add 10.6.6.6 24
[R7]int gi0/0/0
[R7-GigabitEthernet0/0/0]ip add 100.1.27.2 24
[R7-GigabitEthernet0/0/0]int lo0
[R7-LoopBack0]ip add 10.7.7.7 24
[R8-GigabitEthernet0/0/0]ip add 100.1.28.2 24
[R8-GigabitEthernet0/0/0]int lo0
[R8-LoopBack0]ip add 10.8.8.8 24

 2、为3-8这些设备配置一条缺省指向R2

[R3]ip route-static 0.0.0.0 0 100.1.23.1
[R4]ip route-static 0.0.0.0 0 100.1.24.1
[R5]ip route-static 0.0.0.0 0 100.1.25.1
[R6]ip route-static 0.0.0.0 0 100.1.26.1
[R7]ip route-static 0.0.0.0 0 100.1.27.1
[R8]ip route-static 0.0.0.0 0 100.1.28.1

3、在R1-R3-R4这三个设备之间搭建MGRE

R1(中心站点):

[R1]int tunnel 0/0/0
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R1-Tunnel0/0/0]source g0/0/0
[R1-Tunnel0/0/0]ip add 10.0.0.1 24
[R1-Tunnel0/0/0]nhrp  network-id 100
[R1-Tunnel0/0/0]nhrp authentication cipher 123456 #nhrp 接口认证
[R1-Tunnel0/0/0]nhrp entry  multicast dynamic
[R1-Tunnel0/0/0]gre key 1 #grekey加强安全性

R3:

[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R3-Tunnel0/0/0]source g0/0/0
[R3-Tunnel0/0/0]gre key 1
[R3-Tunnel0/0/0]ip add 10.0.0.3 24
[R3-Tunnel0/0/0]nhrp  network-id 100
[R3-Tunnel0/0/0]nhrp entry 10.0.0.1 100.1.12.1 register 
[R3-Tunnel0/0/0]nhrp authentication cipher 123456 

R4:

[R4]int tu0/0/0
[R4-Tunnel0/0/0]tunnel-protocol gre  p2mp 
[R4-Tunnel0/0/0]source gi0/0/0
[R4-Tunnel0/0/0]gre key 1
[R4-Tunnel0/0/0]ip add 10.0.0.4 24
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]nhrp entry 10.0.0.1 100.1.12.1 register 
[R4-Tunnel0/0/0]nhrp authentication cipher 123456

可以在R1上查看注册信息:

 4、配置OSPF让各个主机之间可以进行通信

R1:

[R1]ospf 1 router-id  1.1.1.1
[R1-ospf-1-area-0.0.0.0]network  10.0.0.0 0.255.255.255

R3:

[R3]ospf 1 ro	
[R3]ospf 1 router-id  3.3.3.3
[R3-ospf-1] area 0.0.0.0 
[R3-ospf-1-area-0.0.0.0]  network 10.0.0.0 0.255.255.255 

R4:

[R4]ospf 1 router-id  4.4.4.4
[R4-ospf-1] area 0.0.0.0 
[R4-ospf-1-area-0.0.0.0]  network 10.0.0.0 0.255.255.255 

5、修改隧道接口的网络类型为p2mp

[R1]int tu0/0/0
[R1-Tunnel0/0/0]ospf network-type p2mp
[R3]int t0/0/0
[R3-Tunnel0/0/0]ospf network-type p2mp
[R4]int Tunnel 0/0/0
[R4-Tunnel0/0/0]ospf network-type p2mp

6、在R1上开启重定向、在R3、R4上配置最短

[R1-Tunnel0/0/0]nhrp redirect
[R3-Tunnel0/0/0]nhrp shortcut 
[R4-Tunnel0/0/0]nhrp  shortcut

这时候可以使用trace 10.0.0.4查看访问的路径;

注:这里可以看出来访问路径已经不是先去10.0.0.1,而是直接去访问10.0.0.4

7、现在需要在R3-R5-R6和R4-R7-R8这两个部分进行MGRE的搭建

R3(中心站点):

[R3]int t0/0/0
[R3-Tunnel0/0/0]nhrp entry multicast dynamic 
[R3-Tunnel0/0/0]nhrp  redirect

R5:

[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R5-Tunnel0/0/0]source gi0/0/0
[R5-Tunnel0/0/0]gre  key  1
[R5-Tunnel0/0/0]ip address  10.0.0.5 24
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp authentication cipher 123456
[R5-Tunnel0/0/0]nhrp entry 10.0.0.3 100.1.23.2 register 
[R5-Tunnel0/0/0]nhrp shortcut 
[R5-Tunnel0/0/0]ospf network-type p2mp
[R5]ospf 1 router-id 5.5.5.5 
[R5-ospf-1-area-0.0.0.0]network 10.0.0.0 0.255.255.255

R6:

[R6]int Tunnel 0/0/0
[R6-Tunnel0/0/0] tunnel-protocol gre p2mp
[R6-Tunnel0/0/0] gre key 1
[R6-Tunnel0/0/0] ospf network-type p2mp
[R6-Tunnel0/0/0] nhrp shortcut
[R6-Tunnel0/0/0] nhrp network-id 100
[R6-Tunnel0/0/0] nhrp entry 10.0.0.3 100.1.23.2 register
[R6-Tunnel0/0/0]nhrp authentication cipher 123456
[R6-Tunnel0/0/0]ip add 10.0.0.6 24
[R6]ospf 1 router-id  6.6.6.6
[R6-ospf-1-area-0.0.0.0]network  10.0.0.0 0.255.255.255

R4(中心站点:)

[R4-Tunnel0/0/0]nhrp entry multicast dynamic 
[R4-Tunnel0/0/0]nhrp redirect

R7:

[R7]int t0/0/0
[R7-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R7-Tunnel0/0/0]source gi0/0/0
[R7-Tunnel0/0/0]gre key 1
[R7-Tunnel0/0/0]ip add 10.0.0.7 24
[R7-Tunnel0/0/0]nhrp network-id 100
[R7-Tunnel0/0/0]nhrp authentication cipher 123456
[R7-Tunnel0/0/0]nhrp  entry 10.0.0.4 100.1.24.2 register 
[R7-Tunnel0/0/0]nhrp shortcut 
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]area 0
[R7-ospf-1-area-0.0.0.0]network 10.0.0.0 0.255.255.255
[R7-ospf-1-area-0.0.0.0]int tu0/0/0
[R7-Tunnel0/0/0]ospf network-type p2mp

R8:

[R8]int Tunnel 0/0/0
[R8-Tunnel0/0/0] ip address 10.0.0.7 255.255.255.0 
[R8-Tunnel0/0/0] tunnel-protocol gre p2mp
[R8-Tunnel0/0/0] source GigabitEthernet0/0/0
[R8-Tunnel0/0/0] gre key 1
[R8-Tunnel0/0/0] ospf network-type p2mp
[R8-Tunnel0/0/0] nhrp authentication cipher %$%${"@cGFyLlVmL@4G,4=J.,.2n%$%$
[R8-Tunnel0/0/0] nhrp shortcut
[R8-Tunnel0/0/0] nhrp network-id 100
[R8-Tunnel0/0/0] nhrp entry 10.0.0.4 100.1.24.2 register
[R8-Tunnel0/0/0]nhrp authentication cipher 123456
[R8-Tunnel0/0/0]ip add 10.0.0.8 24
[R8-Tunnel0/0/0]q
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]area 0
[R8-ospf-1-area-0.0.0.0]network 10.0.0.0 0.255.255.255

这时候可以尝试在R6上tracertR7:

 8、现在就可以配置IPSEC了

R3:

[R3]ike proposal 1
[R3-ike-proposal-1]authentication-method pre-share 
[R3-ike-proposal-1]encryption-algorithm aes-cbc-128
[R3-ike-proposal-1]dh group5 
[R3-ike-proposal-1]authentication-algorithm md5 

[R3]ike peer dsvpn v1 
[R3-ike-peer-dsvpn]exchange-mode aggressive 
[R3-ike-peer-dsvpn]pre-shared-key cipher 123456
[R3-ike-peer-dsvpn]ike-proposal 1
[R3-ike-peer-dsvpn]remote-name dsvpn
[R3]ike local-name dsvpn

[R3]ipsec proposal dsvpn
[R3-ipsec-proposal-dsvpn]transform ah-esp 
[R3-ipsec-proposal-dsvpn]encapsulation-mode transport 
[R3-ipsec-proposal-dsvpn]ah authentication-algorithm sha1
[R3-ipsec-proposal-dsvpn]esp encryption-algorithm aes-128
[R3-ipsec-proposal-dsvpn]esp authentication-algorithm md5 

[R3]ipsec profile dsvpn
[R3-ipsec-profile-dsvpn]ike-peer dsvpn 
[R3-ipsec-profile-dsvpn]proposal dsvpn 
[R3-ipsec-profile-dsvpn]q

[R3]in tu0/0/0
[R3-Tunnel0/0/0]ipsec profile dsvpn 

注:其他设备的配置与R3相同,这里就不再赘述

查看R3和R4的ospf邻居表:

 

 9、测试

 然后可以抓包查看:

 从抓包的结果可以看出现在传输的数据已经被加密了

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/860863.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

WDT看门狗寄存器实验

WDT寄存器 作用:监控CPU是否出现错误,出现错误向CPU发送复位信号 工作原理:向WDT写入一个100的值,递减,正常程序执行时会定时向WDT发送一个比较大的定时数,这样就不会减到零 有两种功能: 1. 当…

2.利用matlab建立符号函数和符号方程(matlab程序)

1.简述 一、引言 符号函数是Matlab的一个非常重要的功能,可以用来表示数学上的函数,同时也是进行数值计算。创建符号函数的方法有多种,本文给出了四种生成符号函数的方法及求符号函数函数值的方法。 四种生成符号函数的方法:有利用…

【Linux】gcc编译器的使用和介绍

目录 一,GCC简介 二,GCC的主要组件 三,GCC的工作流程 四,GCC的一些重要特性和功能 五,GCC常用的编译选项 六,GCC的输入输出选项的具体用法 七,GCC的参考文档 一,GCC简介 GCC&…

预测性维护如何改变设备管理部门的工作方式?

在现代工业中,设备管理部门面临着日益复杂的挑战。维护工作的准确性和高效性变得愈发重要,特别是在资产技术日益复杂的背景下。预测性维护(PdM)作为一种革命性的方法,通过实时评估运营数据并利用人工智能(A…

Android Studio 拉取代码后 git显示大量文件被修改

参考: 在 Git 中正确设置 CRLF、LF 换行符转换 现象 拉取后再Android Studio 中显示正常,但是 run 之后,所有的文件在git 中显示 modify。 查看具体变更发现是所有的内容先显示删除 - ,在显示添加 Beyond Compare 文本比较显…

Visdom安装避坑

VIsdom,与tensorboard作用类似 通过以下命令安装Visdom, pip install visdom 启动visdom服务 python -m visdom.server 运行一直卡在Downloading scripts, this may take a little while,某些资源因为网络问题难以下载,导致一…

利用SCCM进行横向移动

01SCCM介绍 SCCM全名为System Center Configuration Manager,从版本1910开始,微软官方将其从Microsoft System Center产品移除,重新命名为Microsoft Endpoint Configuration Manager(ConfigMgr),其可帮助 …

W6100-EVB-PICO 做TCP Server进行回环测试(六)

前言 上一章我们用W6100-EVB-PICO开发板做TCP 客户端连接服务器进行数据回环测试,那么本章将用开发板做TCP服务器来进行数据回环测试。 TCP是什么?什么是TCP Server?能干什么? TCP (Transmission Control Protocol) 是一种面向连…

实现分布式事务:Java与MySQL的XA事务协调

目录 一、什么是XA事务 二、Java中的XA事务支持 三、MySQL的XA事务协调 四、注意事项和最佳实践 五、基于 java 语言的开发工具 六、小结 分布式事务是在跨多个数据库或服务之间保持一致性的重要机制。Java与MySQL的XA(eXtended Architecture)事务…

获取接口的所有实现

一、获取接口所有实现类 方法1:JDK自带的ServiceLoader实现 ServiceLoader是JDK自带的一个类加载器,位于java.util包当中,作为 A simple service-provider loading facility。 (1)创建接口 package com.example.dem…

Lua 数据类型 —— 字符串

一、字符串 Lua 使用 八个比特位来存储 字符。(一个字节 八个比特位) Lua 最好使用 UTF-8 编码。 字符串是不可变值,和 java 和 kotlin 相似,修改其中某一个字符,都是创建一个新的字符串。 Lua 对字符串会进行自动…

Python进阶(二)

前言:本篇博客主要记录Python进程的创建、进程间的通信、进程池的使用、线程的创建、多线程的执行、同步和互斥、协程的创建和应用。 目录 思维导图 基本概念 进程 进程的创建 进程间的通信 进程池 线程 线程的创建 子线程的执行顺序 同步&互斥 互斥…

惊讶,日本用“Excel”作画,中国却用“Excel”造“另类”软件

精益求精 表格是一项伟大的创造,它的出现改变了人类记录、分析和展示数据的方式。 随着科技的日益月异的更新,从最早的纸质表格到现代化的电子表格,人类对表格的改造也在不断的升级和进步。 最初的纸质表格的简单记录,无法进行复…

企业权限管理(八)-登陆使用数据库认证

Spring Security 使用数据库认证 在 Spring Security 中如果想要使用数据进行认证操作,有很多种操作方式,这里我们介绍使用 UserDetails 、 UserDetailsService来完成操作。 UserDetails public interface UserDetails extends Serializable { Collecti…

汇聚行业精英,共探创新之道:首届NDI生态系统行业峰会即将登陆北京!

IP化和轻量化是媒体制播技术发展的主要趋势。为了推进媒体行业的IP制播技术应用发展,提供一个专业、全面的媒体技术交流平台,长沙千视电子科技有限公司将联合NDI官方、NDI生态产品厂家和NDI技术应用媒体单位于2023年8月22日在北京举办国内首届NDI生态系统…

嵌入式开发学习(STC51-11-中断系统)

内容 外部中断-使用独立按键K3控制LED亮灭; 定时器(中断)-通过定时器0中断控制D1指示灯间隔1秒闪烁; 串口通信(中断)-通过串口(UART)实现与PC机对话,51单片机的串口收…

Leetcode算法递归类—合并两个有序链表

目录 21. 合并两个有序链表 题解: 代码: 将两个升序链表合并为一个新的 升序 链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例 1: 输入:l1 [1,2,4], l2 [1,3,4] 输出:[1,1,2,3,4,4]示例 2&a…

logstash 采集 docker 日志

1、nginx容器部署 参考:nginx容器部署 将容器内的nginx日志文件映射到宿主机/home/logs/nginx目录下 注意:并且需要需要将日志的输出格式修改为json 2、编辑vim /opt/logstash-7.4.2/config/nginx-log-es.conf 文件,收集docker nginx容器日…

【时间格式引发的事故】

时间格式引发的事故 背景实战演示结论 背景 前不久写了一个删除数据接口,条件是根据时间删除时间后面的数据。入参是 时间字符串。后台的时间格式 是 yyyyMMdd。然后当时前端传参数的时候,随意的传了2023-07-31的时间,然后将该表的数据全部删…

CCLINK IE转MODBUS-TCP网关modbus tcp协议详解

你是否曾经遇到过需要同时处理CCLINK IE FIELD BASIC和MODBUS两种数据协议的情况?捷米的JM-CCLKIE-TCP网关可以帮助你解决这个问题。 捷米JM-CCLKIE-TCP网关可以分别从CCLINK IE FIELD BASIC一侧和MODBUS一侧读写数据,然后将数据存入各自的缓冲区。接着…