共計 3380 個字符,預計需要花費 9 分鐘才能閱讀完成。
丸趣 TV 小編給大家分享一下標準 ACL 配置的示例分析,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
訪問控制列表(一)結構:
一. 訪問控制列表概述:訪問控制列表(ACL)
1. 讀取第三層、第四層包頭信息
2. 根據預先定義好的規則對包進行過濾
二. 訪問控制類表的工作原理訪問控制列表在接口應用的方向:
出:已經過路由器的處理,正離開路由器接口的數據包
入:已達到路由器接口的數據包,將被路由器處理
列表應用到接口方向與數據方向有關訪問控制列表的處理過程:
ACL 規則:匹配為自上而下逐條匹配,默認隱含的拒絕是拒絕所有(any)白名單:
允許 1.2
允許 1.3
拒絕所有(不寫)
黑名單:
拒絕 1.2
拒絕 1.3
允許所有(必須寫)
三.ACL 訪問控制列表的類型:標準訪問控制列表:
1. 基于 IP 地址過濾數據包
2. 標準訪問控制列表的訪問控制列表號是 1~99
擴展訪問控制列表:
1. 基于源 IP、目標 IP 地址、指定協議、端口和標志來過濾數據包
2. 擴展訪問控制列表的訪問控制列表號是 100~199
命名訪問控制列表(包含標準和擴展):
1. 命名訪問控制列表允許在標準和擴展訪問控制列表中使用名稱待敵表號
可靈活調整策略
四. 標準訪問控制列表的配置創建 ACL:
Router(config)#access-list accsee-list-number
{ permit 允許數據包通過 | deny 拒絕數據包通過 } source [ source-wildcard ] 可對源 IP 進行控制
刪除 ACL:
Router(config)#no access-list access-list-number
應用實例:
Router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
Router(config)# access-list 1 permit 192.168.2.2 0.0.0.0
允許 192.168.1.0/24 和主機 192.168.2.2 的流量通過
隱含的拒絕語句:
Router(config)# access-list 1 deny 0.0.0.0 255.255.255.255
關鍵字:
host/any
Demo1:標準 ACL 的配置實例
交換機:sw#conf t
sw(config)#no ip routing
sw(config)#int f1/0
sw(config-if)#speed 100
sw(config-if)#dup full
路由器:R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no shut
客戶機配置 IP 地址:PC1 ip 192.168.10.2 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1
PC2 ip 192.168.10.3 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.3 255.255.255.0 gateway 192.168.10.1
PC3
PC3 ip 192.168.20.2 192.168.20.1
Checking for duplicate address...
PC1 : 192.168.20.2 255.255.255.0 gateway 192.168.20.1
驗證互通:PC1 ping 192.168.20.2
192.168.20.2 icmp_seq=1 timeout
84 bytes from 192.168.20.2 icmp_seq=2 ttl=63 time=15.676 ms
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=17.680 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=21.956 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=12.700 ms
PC2 ping 192.168.20.2
192.168.20.2 icmp_seq=1 timeout
192.168.20.2 icmp_seq=2 timeout
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=17.735 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=14.069 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=14.960 ms
// 此時全網段互通
全局模式下在 R1 上定義規則
R1(config-if)#access-list 1 deny host 192.168.10.2
R1(config)#do show access-list
R1(config)#access-list 1 permit any
R1(config)#int f0/0
R1(config-if)#ip access-group 1 in
PC1pingPC3 顯示管理員拒絕:
PC1 ping 192.168.20.2
*192.168.10.1 icmp_seq=1 ttl=255 time=20.233 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=2 ttl=255 time=4.913 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=3 ttl=255 time=12.927 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=4 ttl=255 time=12.965 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=5 ttl=255 time=13.958 ms (ICMP type:3, code:13, Communication administratively prohibited)
PC1pingPC2 可以連通:
PC1 ping 192.168.10.3
84 bytes from 192.168.10.3 icmp_seq=1 ttl=64 time=0.000 ms
84 bytes from 192.168.10.3 icmp_seq=2 ttl=64 time=0.975 ms
84 bytes from 192.168.10.3 icmp_seq=3 ttl=64 time=0.997 ms
84 bytes from 192.168.10.3 icmp_seq=4 ttl=64 time=0.000 ms
84 bytes from 192.168.10.3 icmp_seq=5 ttl=64 time=1.731 ms
以上是“標準 ACL 配置的示例分析”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注丸趣 TV 行業資訊頻道!