目录
HTTP概述
HTTP实验
HTTPS 实验
HTTP概述
HTTP(HyperText Transfer Protocol,超文本传输协议),设计HTTP最初的目的是为了提供一种发布和接收HTML页面的方法。
-
HTTP定义了多种请求方法,常用的包括:
-
GET:请求资源。
-
POST:提交数据。
-
PUT:更新资源。
-
DELETE:删除资源。
HTTP实验
我们使用一个路由器来模拟客户端
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname Client
[Client]interface G0/0/0
[Client-GigabitEthernet0/0/0]ip address 192.168.1.1 24
Server配置
选择文件根目录,然后启动HTTP服务
使用路由器去发送GET请求
[Client]http get url 192.168.1.2Http getting 192.168.1.2[192.168.1.2]: 1:packets interaction time 20 ms,the link reachable2:packets interaction time 90 ms,the link reachable3:packets interaction time 110 ms,the link reachable4:packets interaction time 90 ms,the link reachable5:packets interaction time 90 ms,the link reachable--- http get result statistics ---Http Get 5 time(s),succeed 5 time(s),failed 0 time(s).round-trip min/avg/max = 90/80/110 ms.
测试访问是没问题的。
但是http是明文传输,所以接口抓包,我们就能看到
我们能直接看到HTTP的,传输的页面内容。
我还可以访问我的一个文件试一试(路径填写你的HTTP服务器,目录下有的文件)
[Client]http get url 192.168.1.2/desktop.iniHttp getting 192.168.1.2/desktop.ini[192.168.1.2]: 1:packets interaction time 60 ms,the link reachable2:packets interaction time 90 ms,the link reachable3:packets interaction time 90 ms,the link reachable4:packets interaction time 100 ms,the link reachable5:packets interaction time 90 ms,the link reachable--- http get result statistics ---Http Get 5 time(s),succeed 5 time(s),failed 0 time(s).round-trip min/avg/max = 90/86/100 ms.
再来看看看抓包
传输的文件内容,都是明文的,验证了HTTP是明文传输。
HTTPS 实验
明文传输,那么肯定是不安全的,所以我们通常使用HTTPS(Hypertext Transfer Protocol Secure,超文本传输安全协议)的协议进行安全传输。
在HTTP的基础上加上TLS(Transport Layer Security)协议。
对于HTTPS的传输验证,我们可以使用ENSP中的USG6000V防火墙,防火墙的WEB管理页面就是HTTPS协议进行访问。
G0/0/0 默认配置IP地址是192.168.0.1
Username:admin # 用户名 admin
Password: # 密码Admin@123
The password needs to be changed. Change now? [Y/N]: Y # Y 确认修改密码
Please enter old password: # 旧密码Admin@123
Please enter new password: # 新密码
Please confirm new password: # 确认新密码Info: Your password has been changed. Save the change to survive a reboot.
*************************************************************************
* Copyright (C) 2014-2018 Huawei Technologies Co., Ltd. *
* All rights reserved. *
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
*************************************************************************
防火墙的接口,默认有接口访问控制,访问防火墙自身的https协议,需要接口下开启
<USG6000V1>system-view
Enter system view, return user view with Ctrl+Z.
[USG6000V1]interface G0/0/0
[USG6000V1-GigabitEthernet0/0/0]service-manage https permit
Cloud设置(我是自己添加了一个环回网卡,地址配置成192.168.0.2/24,和防火墙接口地址在同一个网段)
我们使用浏览器登录防火墙(https://192.168.0.1:8443)(用户名是admin,密码是刚才修改的)
抓包查看报文交互
现在报文内容已经被加密了。