首页 > 其他分享 >15-1 ACL实验

15-1 ACL实验

时间:2023-09-20 16:33:58浏览次数:36  
标签:AR1 AR3 15 GigabitEthernet0 192.168 ACL 实验 packet 2.1

实验一(基本ACL的应用)

学会配置基础的ACL

拓扑

在AR1对应位置配置ACL,使PC1禁止访问PC2

配置

PC1配置,PC2参考PC1

AR1配置

<Huawei>sys
[Huawei]sys AR1
[AR1]inte gi 0/0/0
[AR1-GigabitEthernet0/0/0]ip addr 192.168.1.254 255.255.255.0
[AR1-GigabitEthernet0/0/0]inte gi 0/0/1
[AR1-GigabitEthernet0/0/1]ip addr 192.168.2.254 255.255.255.0
[AR1-GigabitEthernet0/0/1]q
[AR1]acl 2000   //创建一个基本的ACL
[AR1-acl-basic-2000]rule deny source 192.168.1.1 0.0.0.0   //添加一条规则拒绝来自192.168.1.1的流量
[AR1-acl-basic-2000]q
[AR1]inte gi 0/0/0  
[AR1-GigabitEthernet0/0/0]traffic-filter inbound acl 2000  //给GE0/0/0的入流量设置ACL规则

测试

PC1 ping PC2(无法通信)

PC>ping 192.168.2.1

Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!

--- 192.168.2.1 ping statistics ---
  3 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss

查看ACL规则匹配次数

[AR1]dis acl 2000
Basic ACL 2000, 1 rule
Acl's step is 5
 rule 5 deny source 192.168.1.1 0 (3 matches)   \\规则匹配了三次,成功阻拦了PC1 和 PC2的通信

PC1和网关的通信(无法通信)

因为ACL规则应用在GE0/0/0的入流量中,所以流量无法进入到接口到达路由器,所以网关也无法通信,接下来更改规则的应用位置,在GE0/0/1的出流量中应用此规则

PC>ping 192.168.1.254

Ping 192.168.1.254: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!

--- 192.168.1.254 ping statistics ---
  2 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss

AR1配置

[AR1-GigabitEthernet0/0/0]undo traffic-filter inbound
[AR1-GigabitEthernet0/0/0]inte gi 0/0/1
[AR1-GigabitEthernet0/0/1]traffic-filter outbound acl 2000

此时再测试PC1和网关的通信(通信成功),PC1和PC2的通信(无法通信)

PC>ping 192.168.2.1

Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!

--- 192.168.2.1 ping statistics ---
  2 packet(s) transmitted
  0 packet(s) received
  100.00% packet loss

PC>ping 192.168.1.254

Ping 192.168.1.254: 32 data bytes, Press Ctrl_C to break
From 192.168.1.254: bytes=32 seq=1 ttl=255 time=16 ms
From 192.168.1.254: bytes=32 seq=2 ttl=255 time=15 ms

--- 192.168.1.254 ping statistics ---
  2 packet(s) transmitted
  2 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 15/15/16 ms

实验2

学会配置高级ACL

拓扑

配置AR3为telnet服务器
配置ACL规则禁止AR2使用telnet远程控制AR3,但可以ping通AR3

配置

PC1配置
image
AR2配置

<Huawei>sys
[Huawei]sys AR2
[AR2]inte gi 0/0/0
[AR2-GigabitEthernet0/0/0]ip addr 192.168.1.1 255.255.255.0
[AR2-GigabitEthernet0/0/0]q
[AR2]ip route-static 0.0.0.0 0 192.168.1.254

AR3配置

<Huawei>sys
[Huawei]sys AR3
[AR3]inte gi 0/0/0
[AR3-GigabitEthernet0/0/0]ip addr 192.168.2.1 255.255.255.0
[AR3-GigabitEthernet0/0/0]q
[AR3]ip route-static 0.0.0.0 0 192.168.2.254
[AR3]user-interface vty 0 4
[AR3-ui-vty0-4]authentication-mode password
Please configure the login password (maximum length 16):abc.123
[AR3-ui-vty0-4]protocol inbound telnet
[AR3-ui-vty0-4]user privilege level 15

AR1配置

<Huawei>sys
[Huawei]sys AR1
[AR1]inte gi 0/0/0
[AR1-GigabitEthernet0/0/0]ip addr 192.168.1.254 255.255.255.0
[AR1-GigabitEthernet0/0/0]inte gi 0/0/1
[AR1-GigabitEthernet0/0/1]ip addr 192.168.2.254 255.255.255.0
[AR1]acl name telnent_deny 3000   //创建高级ACL,名为telnet_deny
[AR1-acl-adv-telnent_deny]rule deny tcp source 192.168.1.1 0 destination 192.168
.2.1 0 destination-port eq 23  //设置规则,禁止192.168.1.1访问192.168.2.1的23端口(telnet服务)
[AR1-acl-adv-telnent_deny]q
[AR1]inte gi 0/0/0
[AR1-GigabitEthernet0/0/0]traffic-filter inbound acl 3000

测试

AR1 ping AR3

<AR2>ping 192.168.2.1
  PING 192.168.2.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.1: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 192.168.2.1: bytes=56 Sequence=2 ttl=254 time=40 ms
    Reply from 192.168.2.1: bytes=56 Sequence=3 ttl=254 time=50 ms

  --- 192.168.2.1 ping statistics ---
    3 packet(s) transmitted
    3 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/43/50 ms

AR1 远程连接AR3

<AR2>telnet 192.168.2.1
  Press CTRL_] to quit telnet mode
  Trying 192.168.2.1 ...
  Error: Can't connect to the remote host

由于AR1做了在GE0/0/0的入流量的规则,限制了AR2访问AR3 telnet的流量,但没有限制ICMP,所以可以正常ping通,接下来去除ACL规则检测AR2远程连接AR3

AR1配置

[AR1]inte gi 0/0/0
[AR1-GigabitEthernet0/0/0]undo traffic-filter inbound 

再测试AR2 远程连接 AR3

<AR2>telnet 192.168.2.1
  Press CTRL_] to quit telnet mode
  Trying 192.168.2.1 ...
  Connected to 192.168.2.1 ...

Login authentication


Password:
<AR3>

标签:AR1,AR3,15,GigabitEthernet0,192.168,ACL,实验,packet,2.1
From: https://www.cnblogs.com/Metkey/p/17717394.html

相关文章

  • oracle数据库中查看表空间下各表占用表空间的大小
    背景:在做数据库巡检时,检查大表是必不可少的操作,可以查看各表占用表空间的大小,下面直接上例子,然后表空间名字我写成实际的了selectt.owner,t.segment_name,t.tablespace_name,bytes/1024/1024/1024assizes,q.num_rows,t.segment_typefromdba_segmentstleftjoindba_tablesq......
  • 15 ACL基础
    ACL可以通过对网络中报文流的精确识别,与其他技术结合,达到控制网络访问行为、防止网络攻击和提高网络带宽利用率的目的,从而切实保障网络环境的安全性和网络服务质量的可靠性。ACL组成ACL由若干条permit或deny语句组成。每条语句就是该ACL的一条规则,每条语句中的permit或deny......
  • 解决Oracle 11g在用EXP导出时,空表不能导出
    一、问题原因:  11G中有个新特性,当表无数据时,不分配segment,以节省空间  1、insert一行,再rollback就产生segment了。     该方法是在在空表中插入数据,再删除,则产生segment。导出时则可导出空表。   2、设置deferred_segment_creation参数     showpa......
  • Oracle定义DES加密解密及MD5加密函数示例
    (1)DES加密函数createorreplacefunctionencrypt_des(p_textvarchar2,p_keyvarchar2)returnvarchar2isv_textvarchar2(4000);v_encvarchar2(4000);raw_inputRAW(128);key_inputRAW(128);decrypted_rawRAW(2048);beginv_text:=rpad(p_text,(trunc(len......
  • 在Oracle中查询表的大小和表空间的大小
    有两种含义的表大小。一种是分配给一个表的物理空间数量,而不管空间是否被使用。可以这样查询获得字节数:selectsegment_name,bytes fromuser_segments wheresegment_type='TABLE'; 或者  SelectSegment_Name,Sum(bytes)/1024/1024FromUser_ExtentsGroupBySegment_......
  • 14-2 OSPF默认路由引入实验
    实验一会配置OSPF下发默认路由,一般在出口设备配置下发默认路由,出口连接运营商,通过下发默认路由将数据引导至出口设备,再转交给运营商拓扑AR2模拟运营商配置PC1配置LSW1配置<Huawei>sys[Huawei]sysLSW1[LSW1]vlanbatch1020[LSW1]integi0/0/2[LSW1-GigabitEth......
  • 即时通讯技术文集(第21期):后端架构设计基础入门系列 [共15篇]
    为了更好地分类阅读52im.net总计1000多篇精编文章,我将在每周三推送新的一期技术文集,本次是第21 期。[- 1 -] 新手入门:零基础理解大型分布式架构的演进历史、技术原理、最佳实践[链接] http://www.52im.net/thread-2007-1-1.html[摘要] 本文我们就来聊聊分布式架构的......
  • ORACLE日期时间函数大全
    ORACLE日期时间函数大全  TO_DATE格式(以时间:2007-11-02  13:45:25为例)         Year:            yytwodigits两位年               显示值:07       yyythreedigits三位年               显示值......
  • CF1599E Two Arrays
    Dq17y。考虑斐波那契通项公式,分别维护区间\(\left(\frac{1+\sqrt5}{2}\right)^{a_{1,i}+a_{2,i}}\)和\(\left(\frac{1-\sqrt5}{2}\right)^{a_{1,i}+a_{2,i}}\)的和。显然可以扩域,定义一个\(n=a+\sqrt5b\)的结构体即可。然后快速求斐波那契数列某项就可以直接快速幂了。......
  • Educational Codeforces Round 154 (Rated for Div. 2) A-D
    传送门:edu154/div2A.PrimeDeletion题意:给定一个0-9的排列,要求一个长度>=2的子序列,使得该子序列是质数做法:考虑31或者13即可。不过当时没有立刻想到,感觉1000以内的质数必有答案,打了暴力。用时就多了点。Code#include<bits/stdc++.h>usingnamespacestd;intpri[10......