当前位置: 首页 > news >正文

网安学习NO.14

防火墙基础实验 

传统防火墙配置

实验拓扑图

 

PC:
ip 192.168.10.1 255.255.255.0 192.168.10.254
ip dns 114.114.114.114

二层交换机
vl 10
ex
int e0/0
sw mo ac
sw ac vl 10
ex
inr e0/1
sw tr en do
sw mo tr

三层交换机
vl 10
ex
int g0/0
sw tr en do
sw mo tr
ex
ip routing
int vl 10
ip address 192.168.10.254 255.255.255.0
no shutdown
int g0/1
no switchport
no shutdown
ip address 10.1.1.1 255.255.255.252
ex
ip route 0.0.0.0 0.0.0.0 10.1.1.2(下一跳为防火墙g0/2口)

路由器(作为服务器)
int e0/0
ip add 192.168.2.88 255.255.255.0
no shut    
ex
no ip routing(关闭路由功能)
ip default-gateway 192.168.2.1
ip name-server 114.114.114.114
ip http server
line vty 0 4
no login
transport input telnet
exit


防火墙
en
password:(无密码,回车)

int g0/2
nameif inside
security-level 100(定义安全级别)
ip add 10.1.1.2 255.255.255.252
no shut
exit

int g0/1(公网区域)
nameif outside
security-level 0
ip address dhcp setroute(配置为DHCP客户端,从net网络获取IP,并获得默认路由)
no shutdown
exit


int g0/0
no shutdown
nameif dmz(服务器区域)
security-level 50
ip add    192.168.2.1 255.255.255.0
ex


防火墙路由配置
方法一:静态路由
route inside 192.168.10.0 255.255.255.0 10.1.1.1
(默认路由已经由DHCP获得)

方法二:动态路由,就是防火墙与核心层交换机运行RIP、OSPF
router ospf 1
router-id 1.1.1.1
network 192.168.2.0 255.255.255.0 area 0
network 10.1.1.0 255.255.255.252 area 0


实现内网PC上公网,使用动态NAT及配置:

方法一:用出接口做PAT
object network inside (定义内网需要上网的网段)
subnet 192.168.10.0 255.255.255.0
nat (inside,outside) dynamic interface (这里使用outside区接口做PAT 上网)

方法二:定义地址池转换
object network inside
subnet 192.168.10.0 255.255.255.0
exit
object network outside-pool
range 192.168.116.138 192.168.116.139(为g0/1获得的网段)
ex
object network inside
nat (inside,outside) dynamic outside-pool


ASA防火墙默认不对ICMP做状态检测,需开启
policy-map global_policy(指的是在网络设备(如路由器、交换机等)配置中,定义一个名为 “global_policy” 的策略映射)
class inspection_default
inspect icmp
ex
(show xlate 查看防火墙的nat表)

配置使得服务器可以上公网
object network dmz(定义服务器需要上网的网段)
subnet 192.168.2.0 255.255.255.0
nat (dmz,outside) dynamic interface(用outside接口IP做PAT)

测试:在服务器端ping www.zhynet,net

实现服务器对外提供80端口和 23端口telnet 服务,使用静态NAT配置

方法一:静态NAT1对1
object network dmz1
host 192.168.2.88(指定服务器私网IP)
nat (dmz,outside) static 192.168.116.138

方法二:静态PAT(web和telnet对外提供访问)
object network dmz2
host 192.168.2.88
nat (dmz,outside) static 192.168.116.138 service tcp 23 23(前23代表内部服务器的开放端口,后23代表对外部用户访问的端口,也可以和内部开放的端口不一样)
object network dmz3(有多个端口需要映射时需要配置多个这样的配置)
host 192.168.2.88
nat (dmz,outside) static 192.168.116.138 service tcp 80 80

防火墙默认,不允许从低级别区域向高级别区域发起连接,需要手动放通

access-list webtel permit tcp any host 192.168.2.88 eq 80
access-list webtel permit tcp any host 192.168.2.88 eq 23
access-group webtel in interface outside

在公网PC上cmd测试
telnet 192.168.116.138
telnet 192.168.116.138 80

防火墙透明模式

实验拓扑图

 

PC:192.168.10.1 255.255.255.0 192.168.10.254 114.114.114.114

二层交换机

vl 10
ex

int e0/0
sw mo ac
sw ac vl 10
ex

int e0/1
sw tr en do
sw mo tr
ex


三层交换机

vl 10
ex

int g0/0
sw tr en do
sw mo tr
ex

ip routing

int vl 10
ip add    192.168.10.254 255.255.255.0
no shutdown

int g0/1
no switchport
no shut
ip add    10.1.1.1 255.255.255.0
ex 

ip route 0.0.0.0 0.0.0.0 10.1.1.2(配置缺省路由,下一跳为边界路由器e0/1接口)


路由器配置
int e0/1
ip add    10.1.1.2 255.255.255.0
no shut
ex
int e0/0
no shut
ip add    dhcp
ex
ip route 192.168.10.0 255.255.255.0 10.1.1.1


int e0/0
ip nat outside
int e0/1
ip nat inside
ex

access-list 1 permit 192.168.10.0 0.0.0.255
ip nat inside source list 1 int e0/0 overload


防火墙配置
firewall transparent(切换到透明模式)#查看当前工作模式(show firewall);如果要重新返回路由模式(no firewall transparent)

int bvi 1
ip add    10.1.1.3 255.255.255.0

int g0/2
namif inside
security-level 100
no shut
bridge-group 1
exit

int g0/1
nameif outside
security-level 0
no shut
bridge-group 1
ex


policy-map global_policy
class inspection_default
inspect icmp
ex

然后测试内网PC是否可以上网
ping 114.114.114.114
ping www.baidu.com


防火墙应用代理

实验拓扑图

 

PC:192.168.10.1 255.255.255.0 192.168.10.254 114.114.114.114

二层交换机
vl 10
ex
int e0/0
sw mo ac
sw ac vl 10
ex

int e0/1
sw tr en do
sw mo tr

三层交换机
vl 10
ex
int g0/0
sw tr en do
sw mo tr
ex

ip routing

int vl 10
ip add    192.168.10.254 255.255.255.0
no shut    

int g0/1
no switchport
no shut
ip add    10.1.1.1 255.255.255.252
ex

ip route 0.0.0.0 0.0.0.0 10.1.1.2

防火墙配置

int g0/2
nameif inside
security-level 100
ip add    10.1.1.2 255.255.255.252
no shut
ex

int g0/1
nameif outside
security-level 0
ip add    dhcp setroute
no shut
ex

show ip int br

route inside 192.168.10.0 255.255.255.0 10.1.1.1

show route

object network inside

subnet 192.168.10.0 255.255.255.0
nat (inside,outside) dynamic interface(使用outside区接口做PAT上网)

policy-map global_policy
class inspection_default
inspect icmp
ex

接下来验证主机是否可以上网
ping www.baidu.com

配置应用代理防火墙的身份认证功能:
username zhongyuan password zhongyuan (创建用户名和密码)
access-list auth deny udp any any eq 53
access-list auth permit ip any any
aaa authentication match auth inside LOCAl(注意大写,开启内网认证,aaa是名称)

show uauth(查看认证通过的用户列表)

实现应用代理防火墙的URL过滤:
access-list aaa permit tcp any any eq 80
class-map aaa1
match access-list aaa
ex
regex urla"\.baidu\.com"(定义名称为urla的正则表达式,标识URL的扩展名是“baidu.com”)
class-map type regex math-any urla1
match regex urla
ex

class-map type inspect http urla2(创建class-map检查http流量)
match request hesder host regex class urls1(调用urla)

创建policy-map(策略映射)关联class-map
policy-map type inspect http policy1(创建policy-map检查http流量)
class urla2(调用class-map)
drop-connection log(drop数据包且关闭连接,并发送系统日志)

policy-map policy2(创建policy-map,应用到接口)
class aaa1(调用之前的class-map)
inspect http policy1(检查http流量)
service-policy policy2 interfce inside(注意一个接口只能应用一个policy-map)

http://www.dtcms.com/a/275232.html

相关文章:

  • 创意总监的动态视觉秘诀:用AE动态遮罩AI,轻松实现“人景分离”
  • 分割网络Segformer
  • 需求跟踪深度解析:架构师视角下的全链路追溯体系
  • Vue性能监控
  • PreparedStatement 实现分页查询详解
  • 你以为大数据只是存?其实真正的“宝藏”藏在这招里——数据挖掘!
  • 自动评论+AI 写作+定时发布,这款媒体工具让自媒体人躺赚流量
  • 卸载软件总留一堆“垃圾”?这款免费神器,一键扫清注册表和文件残留!
  • BLOB 数据的插入与读取详解
  • 9月22日跨境电商高峰会都说了啥?郑州跨境电商发展机遇在哪?
  • Nginx的配置与使用
  • 多元思维模型:数据分析需要具备的四大能力?
  • 傅里叶方法求解正方形偏微分方程
  • Redis缓存三兄弟:穿透、击穿、雪崩全解析
  • 张量与维度
  • Grid网格布局完整功能介绍和示例演示
  • 2023年全国青少年信息素养大赛C++编程初中组决赛真题+答案解析
  • RestTemplate动态修改请求的url
  • 第一周JAVA——选择结构、循环结构、随机数、嵌套循环、数组(一维、二维)、方法、形参实参
  • 《每日AI-人工智能-编程日报》--7月11日
  • python知识:正则表达式快速入门案例:提取文章中所有的单词、提取文章中所有的数字、提取百度热搜的标题、提取ip地址
  • Web攻防-SSTI服务端模版注入利用分类语言引擎数据渲染项目工具挖掘思路
  • Umi-OCR 的 Docker安装(win制作镜像,Linux(Ubuntu Server 22.04)离线部署)
  • 数据集相关类代码回顾理解 | StratifiedShuffleSplit\transforms.ToTensor\Counter
  • 数据结构-双链表
  • 数字产品的专利战:要么布局称王,要么维权忙?
  • ABP VNext + Microsoft YARP:自定义反向代理与请求路由
  • 文件上传漏洞1-文件上传漏洞详细原理讲解与利用方式
  • 设计模式 - 面向对象原则:SOLID最佳实践
  • scrapy框架