标准ACLide
流量控制工具
ACL : access control list , 访问 控制 列表 。
-做用
基于必定的规则,进行数据流量的匹配。
仅仅是用于流量的匹配。
对这些规则的后续处理动做,是由调用ACL的工具来决定的。
-分类
标准ACL:在匹配流量时,只能匹配流量的源IP地址;
扩展ACL:在匹配流量时,能够同时匹配流量的源IP地址、
目标IP地址、TCP/UDP+端口号
标准ACL离源ip最近扩展ACL离目标最近
-表示
ID:经过数字来表示不一样的ACL;
name:经过名字来表示不一样的ACL;
-原理
一个ACL,就是一套规则。
一个ACL中,就有多个不一样的细分条目;
不一样的条目之间,是经过编号进行区分的;
经过ACL匹配流量时,是按照编号从小到大的顺序,依次检查
每一个“细分条目”的:
若是能匹配住,则执行前面的动做(deny/permit);
若是不能,则继续检查下一个“细分条目”
若是到最后都没有匹配住,则执行 ACL 最后一个
默认的“细分条目” --- 拒绝全部(deny any )!
注意:
任何一种类型的ACL,最后都有一个“拒绝全部”的条目工具
-配置步骤:
#定义ACL
R4:
ip acces-list standard deny-ping
10 deny 192.168.12.0 0.0.0.255
20 permit any
#调用ACL
R4:
interface fas0/1
ip access-group deny-ping in
#验证ACL
R4;
show ip access-list
#流量测试
在全部设备上: ping 10.10.4.4 ,
R1没法通 , 其余都通。oop
注意: 标准ACL匹配流量时,不够精确,因此咱们强烈建议: 将标准ACL调用在距离“目标”特别近的地方。
R1:
en
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int fas0/0
R1(config-if)#no shu
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#exi
R1(config)#int loopback 10
R1(config-if)#no shu
R1(config-if)#ip add 10.10.1.1 255.255.255.0
R1(config-if)#ex
R1(config)#ip routing
R1(config)#ip route 192.168.2.0 255.255.255.0 192.168.1.2
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#ip route 10.10.4.0 255.255.255.0 192.168.3.2
R1(config)#exit
R1#show ip route
R1#ping 10.10.4.4(ping不通)测试
R2:
en
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int f0/1
R2(config-if)#no shu
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#exit
R2(config)#int fas0/0
R2(config-if)#no shu
R2(config-if)#ip add 192.168.2.1 255.255.255.0
R2(config-if)#exit
R2(config)#ip routing
R2(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R2(config)#ip route 10.10.1.0 255.255.255.0 192.168.1.1
R2(config)#ip route 10.10.4.0 255.255.255.0 192.168.3.2
R2(config)#exit
R2#show ip route
R2#ping 10.10.4.4(ping通)code
R3:ip
en
R3#configure t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#int fas0/1
R3(config-if)#no shu
R3(config-if)#ip add 192.168.2.2 255.255.255.0
R3(config-if)#exit
R3(config)#int fas0/0
R3(config-if)#no shu
R3(config-if)#ip add 192.168.3.1 255.255.255.0
R3(config-if)#exit
R3(config)#ip routing
R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R3(config)#ip route 10.10.1.0 255.255.255.0 192.168.1.1
R3(config)#ip route 10.10.4.0 255.255.255.0 192.168.3.2
R3(config)#exit
R3#show ip route
R2#ping 10.10.4.4(ping通)terminal
R4:
R4>en
R4#conf
R4#configure t
R4#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int fas0/1
R4(config-if)#no shu
R4(config-if)#ip add 192.168.3.2 255.255.255.0
R4(config-if)#exit
R4(config)#interface loopback 20
R4(config-if)#no shu
R4(config-if)#ip add 10.10.4.4 255.255.255.0
R4(config-if)#exit
R4(config)#ip routing
R4(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
R4(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R4(config)#ip route 10.10.1.0 255.255.255.0 192.168.1.1
R4(config)#exit
R4#show ip route
R4(config)#ip access-list standard ab
R4(config-std-nacl)#10 deny 192.168.1.0 0.0.0.255 (拒绝192.168.1.0 网段)
R4(config-std-nacl)#20 permit any (容许全部)
R4(config-std-nacl)#exit
R4(config)#interface fas0/1
R4(config-if)#ip access-group ab in (fas0/1进入ACL)
R4(config-if)#exit
R4#show ip access-listsit