標準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