路由器ACL配置

P120    实验13  ACL包过滤
01-ACL配置      https://www.h3c.com/cn/d_202305/1840988_30005_0.htm       

        ACL(Access Control List,访问控制列表)是一系列用于识别报文流的规则的集合。这里的规则是指描述报文匹配条件的判断语句,匹配条件可以是报文的源地址、目的地址、端口号等。设备依据ACL规则识别出特定的报文,并根据预先设定的策略对其进行处理,最常见的应用就是使用ACL进行报文过滤。此外,ACL还可应用于诸如路由、安全、QoS等业务中识别报文,对这些报文的具体处理方式由应用ACL的业务模块来决定。

01)  配置RTA路由器:

system-view
sysname RTA
interface gigabitethernet0/0
ip address 192.168.3.1 24
interface gigabitethernet0/1
ip address 192.168.1.1 24
rip
network 192.168.3.0
network 192.168.1.0

<RTA>system-view

System View: return to User View with Ctrl+Z.

[RTA]sysname RTA [RTA]interface gigabitethernet0/0      //GE0口不变,连接PC1

[RTA-GigabitEthernet0/0]ip address 192.168.3.1 24      //192.168.0.1已占用,换192.168.3.1

[RTA-GigabitEthernet0/0]interface gigabitethernet0/1      //GE1口代替S6/0,连接RTB

[RTA-GigabitEthernet0/1]ip address 192.168.1.1 24

[RTA-GigabitEthernet0/1]rip

[RTA-rip-1]network 192.168.3.0

[RTA-rip-1]network 192.168.1.0

上面显示,只有7条路由,都是默认的,没有增加。

02)  配置RTB路由器:
system-view
sysname RTB
interface gigabitethernet0/0
ip address 192.168.2.1 24
interface gigabitethernet0/1
ip address 192.168.1.2 24
rip
network 192.168.2.0
network 192.168.1.0

<H3C>system-view
System View: return to User View with Ctrl+Z.
[H3C]sysname RTB
[RTB]interface gigabitethernet0/0      //GE0口不变,连接PC2
[RTB-GigabitEthernet0/0]ip address 192.168.2.1 24
[RTB-GigabitEthernet0/0]interface gigabitethernet0/1      //GE1口代替S6/0,连接RTA
[RTB-GigabitEthernet0/1]ip address 192.168.1.2 24
[RTB-GigabitEthernet0/1]rip
[RTB-rip-1]network 192.168.2.0
[RTB-rip-1]network 192.168.1.0  

上面显示,只有7条路由,都是默认的,没有增加。

03)  配置PC机的IP地址
配置PC1的IP地址为192.168.3.16/24,网关为192.168.1.1;
配置PC2的IP地址为192.168.2.26/24,网关为192.168.2.1;

        上面显示,增加了3条路由,总数达到10条,192.168.2.0/24协议Direct接口GE0/0,192.168.2.1/32协议Direct接口InLoop0,192.168.2.255/32协议Direct接口GE0/0。

04)  RTA的GE1口用网线连到RTB的GE1口

        上面显示,又增加了4条路由,总数达到14条,192.168.1.0/24协议Direct接口GE0/1,192.168.1.2/32协议Direct接口InLoop0,192.168.1.255/32协议Direct接口GE0/1,还有一条192.168.3.0/24协议RIP接口GE0/1。

        PC1可以ping通PC2,反过来,PC2也可以ping通PC1。

05)  配置RTA路由器的ACL:

        这是RTA的路由表,与RTB基本相似。
[RTA]acl number 2001
[RTA-acl-ipv4-basic-2001]rule deny source 192.168.3.16 0.0.0.0
[RTA-acl-ipv4-basic-2001]rule deny source 192.168.3.26 0.0.0.0
[RTA-acl-ipv4-basic-2001]display acl 2001
Basic IPv4 ACL 2001, 4 rules,
ACL's step is 5
 rule 0 deny source 192.168.0.2 0
 rule 5 deny source 192.168.3.16 0      //显示了192.168.3.16
 rule 10 permit source 192.168.0.2 0
 rule 15 deny source 192.168.3.26 0

[RTA-acl-ipv4-basic-2001]undo rule deny source 192.168.3.16 0.0.0.0去掉192.168.3.16
[RTA-acl-ipv4-basic-2001]display acl 2001
Basic IPv4 ACL 2001, 3 rules,
ACL's step is 5
 rule 0 deny source 192.168.0.2 0      //
 rule 10 permit source 192.168.0.2 0
 rule 15 deny source 192.168.3.26 0


[RTA-acl-ipv4-basic-2001]interface gigabitethernet 0/1
[RTA-GigabitEthernet0/1]packet-filter 2001 outbound      //GE1口ACL2001的包,都过滤掉。

        PC1的IP地址为192.168.3.16/24,网关为192.168.1.1接在RTA的GE1口;ACL2001定义了源为192.168.3.16的任何目的地址IP包都deny。这时,PC1无法ping通PC2。

      RTA也无法ping通PC2。RTA可以ping通网关192.168.3.1。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值