ACL:access control list ,訪問 控制 列表
-做用:
匹配感興趣的流量。
-實現:
#規則
#動做(容許/拒絕)
#事件
-表示:
-類型:
#標準ACL/基本ACL
ID
name
#擴展ACL/高級ACL
ID
nameweb
ACL的配置思路: 0、確保原有數據的連通性(基於現網須要來肯定); 在沒有實施ACL以前,全部PC 之間是互通的; 一、查看設備上已經存在的ACL [R1] display acl [2000] | all 二、建立ACL [R1] acl 2000 [match-order {config} | {auto} ] [R1-acl-basic-2000] rule [id] deny source 192.168.1.x 0.0.0.0 三、調用ACL [R1]interface gi0/0/0 [R1-gi0/0/0]tranffic-filter inbound acl 2000 四、驗證、測試、保存 display acl 2000 //查看ACL的配置條目信息; display traffic-filter applied-record //查看ACL的調用信息; display traffic-filter statistics interface GigabitEthernet 0/0/0 inbound //查看特定端口上調用的ACL的使用信息; 基本ACL -僅僅關注IP頭部中的 source-ip ; 高級ACL -能夠同時關注 source 和 destination , 而且,還能夠關注 IP 頭部後面的內容, 好比 TCP/UDP 刪除ACL: 一、正確的刪除姿式 #首先解除 ACL 調用關係 Interface gi0/0/0 undo traffic-filter inbound #其次刪除 ACL 條目自己 undo acl 2000 #最後刪除的最終結果 二、當調用一個不存在的 ACL 時,表示的是容許全部; 注意: 一、同一個端口的,同一個方向,只能同時存在一個 ACL ; 二、若是想更改端口上調用的 ACL ,必須: 首先,刪除端口上的 ACL 調用命令; 再次,從新調用一個新的 ACL ; 三、端口上的 ACL ,不容許直接覆蓋; 四、華爲中的ACL,沒有匹配住的流量,默認是容許的; 五、基本ACL/標準ACL,強烈建議調用在「距離目標設備」近的地方; ---------------------------------------------------------------------------------------------- 一、命名的ACL在建立的時候,須要指定類型; 二、在ACL中,若是不寫 source 或者不寫 destination ,則表示全部源或目標 三、在配置ACL的過程當中,若是在輸入 source 或 destination 的時候,直接回車 則表明「全部」; 祕訣: 想要控制流量,必須先認識流量的封裝方式、使用的協議; 想要控制流量,必須先認識流量的轉發路徑和方向; ******拓撲圖******
配置步驟app
[R2]ip route-static 172.60.20.0 255.255.255.0 172.60.10.2 ip route-static 192.168.3.0 255.255.255.0 172.60.10.2 ip route-static 192.168.4.0 255.255.255.0 172.60.10.2 acl name pc1-pc2 3999 rule 1 deny ip source 192.168.1.2 0 destination 192.168.2.2 0 interface GigabitEthernet0/0/0 ip address 172.60.10.1 255.255.255.0 interface GigabitEthernet0/0/1 ip address 192.168.1.254 255.255.255.0 interface GigabitEthernet0/0/2 ip address 192.168.2.254 255.255.255.0 traffic-filter outbound acl name pc1-pc2 [R1]ip route-static 192.168.1.0 255.255.255.0 172.60.10.1 ip route-static 192.168.2.0 255.255.255.0 172.60.10.1 ip route-static 192.168.3.0 255.255.255.0 172.60.20.2 acl name pc3-server1 3998 rule 4 deny udp source 192.168.3.2 0 destination 192.168.4.1 0 destination-port eq dns acl name client1-server1 3999 rule 2 deny icmp source 192.168.1.1 0 destination 192.168.4.1 0 interface GigabitEthernet0/0/0 ip address 172.60.10.2 255.255.255.0 interface GigabitEthernet0/0/1 ip address 172.60.20.1 255.255.255.0 traffic-filter inbound acl name pc3-server1 interface GigabitEthernet0/0/2 ip address 192.168.4.254 255.255.255.0 traffic-filter outbound acl name client-server1 [R3]ip route-static 172.60.10.0 255.255.255.0 172.60.20.1 ip route-static 192.168.1.0 255.255.255.0 172.60.20.1 ip route-static 192.168.2.0 255.255.255.0 172.60.20.1 ip route-static 192.168.4.0 255.255.255.0 172.60.20.1 acl name pc2-pc3 3999 rule 2 deny ip source 192.168.2.2 0 destination 192.168.3.2 0 interface GigabitEthernet0/0/1 ip address 172.60.20.2 255.255.255.0 interface GigabitEthernet0/0/2 ip address 192.168.3.254 255.255.255.0 traffic-filter outbound acl name pc2-pc3
**測試與驗證**
一、PC-1與PC-2之間的任何類型的流量都沒法互通;
二、PC-3能夠 ping 192.168.4.1(server-1),可是沒法 ping www.zjk.com
三、PC-2與PC-3之間的任何類型的流量都沒法互通
四、Client-1 沒法 ping www.ntd1711.com,可是經過http能夠打開
Server-1中的 web 功能(即,www.zjk.com)ide
全部實驗驗證已完成,歡迎一塊兒學習交流。