华为路由器 IPSec VPN 配置
需求:
通过 IPSecVPN 实现上海与成都内网互通
拓扑图如下:
一、首先完成网络配置
1、R1 路由器设置
<Huawei>sys
[Huawei]sys R1
[R1]un in en# 开启DHCP
[R1]dhcp enable# 设置内网接口
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip addr 10.0.10.254 24
[R1-GigabitEthernet0/0/0]dhcp select int
[R1-GigabitEthernet0/0/0]quit# 设置外网接口
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip addr 100.0.0.2 24
[R1-GigabitEthernet0/0/1]quit# 设置 NAT
[R1]acl 3000# 配置 NO-NAT
[R1-acl-adv-3000]rule 5 deny ip source 10.0.10.0 0.0.0.255 destination 10.0.20.0 0.0.0.255[R1-acl-adv-3000]rule 10 permit ip source 10.0.10.0 0.0.0.255
[R1-acl-adv-3000]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 3000# 设置默认路由
[R1-GigabitEthernet0/0/1]ip route-static 0.0.0.0 0 100.0.0.1
2、R2路由器设置
# 重命名并关闭提示
<Huawei>sys
[Huawei]sys R2
[R2]un in en# 开启DHCP
[R2]dhcp enable# 配置内网地址
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip addr 10.0.20.254 24
[R2-GigabitEthernet0/0/0]dhcp select int
[R2-GigabitEthernet0/0/0]quit# 配置外网接口
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip addr 200.0.0.2 24
[R2-GigabitEthernet0/0/1]quit# 配置 NAT
[R2]acl 3000# 配置 NO-NAT
[R2-acl-adv-3000]rule 5 deny ip source 10.0.20.0 0.0.0.255 destination 10.0.10.0 0.0.0.255[R2-acl-adv-3000]rule 10 permit ip source 10.0.20.0 0.0.0.255
[R2-acl-adv-3000]int g0/0/1
[R2-GigabitEthernet0/0/1]nat outbound 3000# 配置默认路由
[R2-GigabitEthernet0/0/1]ip route-static 0.0.0.0 0 200.0.0.1
3、测试
PC1能访问 R2 的外网地址
PC1>ping 200.0.0.2Ping 200.0.0.2: 32 data bytes, Press Ctrl_C to break
From 200.0.0.2: bytes=32 seq=1 ttl=253 time=31 ms
From 200.0.0.2: bytes=32 seq=2 ttl=253 time=31 ms
From 200.0.0.2: bytes=32 seq=3 ttl=253 time=32 ms
From 200.0.0.2: bytes=32 seq=4 ttl=253 time=15 ms
From 200.0.0.2: bytes=32 seq=5 ttl=253 time=15 ms--- 200.0.0.2 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 15/24/32 ms
PC2能访问 R1 的外网地址
PC2>ping 100.0.0.2Ping 100.0.0.2: 32 data bytes, Press Ctrl_C to break
From 100.0.0.2: bytes=32 seq=1 ttl=253 time=78 ms
From 100.0.0.2: bytes=32 seq=2 ttl=253 time=31 ms
From 100.0.0.2: bytes=32 seq=3 ttl=253 time=32 ms
From 100.0.0.2: bytes=32 seq=4 ttl=253 time=31 ms
From 100.0.0.2: bytes=32 seq=5 ttl=253 time=31 ms--- 100.0.0.2 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 31/40/78 ms
PC1 不能访问 PC2,反之也是
PC1>ping 10.0.20.253Ping 10.0.20.253: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
Request timeout!
Request timeout!
Request timeout!--- 10.0.20.253 ping statistics ---5 packet(s) transmitted0 packet(s) received100.00% packet loss
上面的网络情况跟生产环境基本一致。我们要在 R1 跟 R2 之间配置 IPSec VPN,实现上海与成都两地内网互通
二、配置 IPSec
1、R1 路由器设置
(1)IKE 第一阶段 建立 IKE(ISAKMP)SA
# 配置 ike 提议
[R1]ike proposal 1
[R1-ike-proposal-1]encryption-algorithm aes-cbc-256
[R1-ike-proposal-1]authentication-algorithm sha1
[R1-ike-proposal-1]authentication-method pre-share
[R1-ike-proposal-1]dh group14
[R1-ike-proposal-1]sa duration 1200
[R1-ike-proposal-1]quit# 配置 ike 对等体,使用 v2 协议
[R1]ike peer 1 v2# 共享密码
[R1-ike-peer-1]pre-shared-key simple 123456# 引用 ike 提议
[R1-ike-peer-1]ike-proposal 1# 配置远程地址
[R1-ike-peer-1]remote-address 200.0.0.2
(2)IKE 第二阶段 建立 IPSec SA
# 配置兴趣流
[R1-ike-peer-1]acl 3001
[R1-acl-adv-3001]rule permit ip source 10.0.10.0 0.0.0.255 destination 10.0.20.00.0.0.255
[R1-acl-adv-3001]quit# 配置 ipsec 提议
[R1]ipsec proposal 1# 认证算法
[R1-ipsec-proposal-1]esp authentication-algorithm sha1# 加密算法
[R1-ipsec-proposal-1]esp encryption-algorithm aes-256# 缺省情况下,IPSec安全提议采用安全协议为ESP协议
[R1-ipsec-proposal-1]transform esp
[R1-ipsec-proposal-1]quit# 配置 ipsec 策略
[R1]ipsec policy 1 1 isakmp# 引用 acl
[R1-ipsec-policy-isakmp-1-1]security acl 3001# 引用 ike 对等体
[R1-ipsec-policy-isakmp-1-1]ike-peer 1# 引用 ipsec 提议
[R1-ipsec-policy-isakmp-1-1]proposal 1
[R1-ipsec-policy-isakmp-1-1]quit# 接口绑定策略
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ipsec policy 1
2、R2 路由器设置
# 配置 ike 提议
[R2]ike proposal 1
[R2-ike-proposal-1]encryption-algorithm aes-cbc-256
[R2-ike-proposal-1]authentication-algorithm sha1
[R2-ike-proposal-1]authentication-method pre-share
[R2-ike-proposal-1]dh group14
[R2-ike-proposal-1]sa duration 1200
[R2-ike-proposal-1]quit# 配置 ike 对等体
[R2]ike peer 1 v2
[R2-ike-peer-1]pre-shared-key simple 123456
[R2-ike-peer-1]ike-proposal 1
[R2-ike-peer-1]remote-address 100.0.0.2# 配置兴趣流
[R2-ike-peer-1]acl 3001
[R2-acl-adv-3001]rule permit ip source 10.0.20.0 0.0.0.255 destination 10.0.10.0 0.0.0.255
[R2-acl-adv-3001]quit# 配置 ipsec 提议
[R2]ipsec proposal 1
[R2-ipsec-proposal-1]esp authentication-algorithm sha1
[R2-ipsec-proposal-1]esp encryption-algorithm aes-256
[R2-ipsec-proposal-1]transform esp
[R2-ipsec-proposal-1]quit# 配置 ipsec 策略
[R2]ipsec policy 1 1 isakmp
[R2-ipsec-policy-isakmp-1-1]security acl 3001
[R2-ipsec-policy-isakmp-1-1]ike-peer 1
[R2-ipsec-policy-isakmp-1-1]proposal 1
[R2-ipsec-policy-isakmp-1-1]quit# 接口绑定策略
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ipsec policy 1
3、我们再次测试 pc1 访问 pc2,这次发现通了,说明 IPSec 通了
PC1>ping 10.0.20.253Ping 10.0.20.253: 32 data bytes, Press Ctrl_C to break
From 10.0.20.253: bytes=32 seq=1 ttl=127 time=16 ms
From 10.0.20.253: bytes=32 seq=2 ttl=127 time=31 ms
From 10.0.20.253: bytes=32 seq=3 ttl=127 time=32 ms
From 10.0.20.253: bytes=32 seq=4 ttl=127 time=46 ms
From 10.0.20.253: bytes=32 seq=5 ttl=127 time=16 ms--- 10.0.20.253 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 16/28/46 ms
4、我们在 R1 路由器 g0/0/1 接口抓包
(1)我们在 pc1 上面 ping pc2
通过上面得出当 10.0.10.0 网段访问 10.0.20.0 网段时,的确走VPN隧道协议,并且目的地址也变成了外网地址。
(2)我们再拿 PC1 访问 成都的外网地址 200.0.0.2,然后进行抓包
通过上面得出走的就是常规的路由了,至于为什么我拿 PC1的地址去 访问 200.0.0.2,抓包显示的原地址是 100.0.0.2,是因为我们在R1上面配了 NAT,所以都以 100.0.0.2 出去
华为路由器 IPSec VPN 配置相关推荐
- GRE over IPsec VPN配置
GRE over IPsec VPN配置 [实验目的] 理解GRE Tunnel的概念. 理解GRE over IPsec VPN的概念. 掌握GRE Tunnel的配置. 掌握GRE over IP ...
- 华为路由器连接三层交换机配置
华为路由器连接三层交换机配置 sw1配置: [Huawei]dhcp enable //开启dhcp功能 [Huawei]vlan batch 88 100 //创建vlan88和vlan100 [H ...
- 华为路由器、交换机配置命令
计算机命令.路由器命令.交换机命令.动静态命令都将在文中提到,主要针对华为路由器.交换机配置命令,熟练掌握下面的华为路由器.交换机配置的知识点,你只需花几分钟的时间,就能明白华为路由器.交换机配置. ...
- 华为路由器静态路由配置
1.ensp环境 关注注册不成功的问题:在没有放置设备的情况下注册,如果注册不成功可以查看C:\Users\Administrator中是否有.virtualbox,有则删除: 关于出现多个###的问 ...
- 华为路由器静态路由协议配置
华为路由器配置静态路由 静态路由 静态路由,一种路由的方式,路由项)由手动配置,而非动态决定.与动态路由不同,静态路由是固定的,不会改变,即使网络状况已经改变或是重新被组态.一般来说,静态路由是由网络 ...
- 华为设备IPsec简单配置
IPsec VPN 一.IPsec是什么? 1.1 定义 1.2 封装模式(传输模式.隧道模式) 1.3 安全协议(AH.ESP) 1.4 秘钥交换协议(IKE) 二.IPsec有什么用? 2.1 通 ...
- 华为路由器交换机eNSP配置命令
华为交换机基础配置命令参考 交换机可以隔离冲突域,路由器可以隔离广播域,这两种设备在企业网络中应用越来越广泛.随着越来越多的终端接入到网络中,网络设备的负担也越来越重,这时网络设备可以通过华为专有的V ...
- PPPOE拨号之六:华为路由器 PPPoE拨号配置(包含Client+NAT与服务器配置)
掌握目标 1.在华为路由器上PPPOE服务器的配置 2.在华为路由器上PPPOE 客户端的配置(工作上常用) 3.配置NAT(上网使用) 4.默认路由配置 拓扑图 1.在华为路由器上PPPOE服务器的 ...
- 华为路由器的NAT配置
一个公司通过华为路由器的地址转换功能连接到广域网.要求该公司能够通过华为路由器串口3/0/0访问internet,公司内部对外提供www.ftp和mail服务,而且提供两台www的服务器.公司内部网址 ...
最新文章
- 浪潮服务器怎么装虚拟机,VMware 6.7系统安装步骤
- flex--unable to transcode image
- python json库函数_python基础之JSON标准库
- c语言的舞蹈机器人开题报告范文,现代舞编创手法在拉丁表演舞中的应用研究—本科开题报告...
- npm设置http代理
- 14004.xilinx自动打包image.ub脚本
- linux的挂载的问题,重启后就挂载就没有了
- python图像resize_Python图像resize前后颜色不一致问题
- Python笔记---错误笔记
- android极光推送声音,Android 极光推送JPush---自定义提示音
- Jsp基本指令和动作
- 在 Mac 上的“字体册”中如何安装和验证字体?
- Ubunt 12.04 中的QT中配置Tyin mini210 的交叉编译环境
- 3726.调整数组-AcWing题库
- 乘风破浪,遇见未来新能源汽车(Electric Vehicle)之特斯拉提车必须知道的十个流程
- 后6位数密码字典生成
- FPGA + labwindows/CVI 2017 串口通信 电子钟
- RC时间常数 积分微分 耦合
- c语言 long double 输出格式,c++ 什么是`long double`的格式说明符
- 也谈SAP系统优缺点