Cisco自反控制列表應用
文章從配置的整體過程詳細的介紹了自反訪問表的配置整體過程,同時給大家列出了SHOW RUN的配置結果,相信看完之后你會對自反列表有個清晰的配置過程。
自反訪問表實際上是擴展I P命名訪問表的一種附加特性或功能。你可以為所有想要創建反向的表項的協議,使用一條p e r m i t語句創建一個擴展I P命名訪問表。還要在每個p e r m i t語句中使用r e f l e c t關鍵字,用以表明訪問表中需要使用一個自反向開啟表項。除了需要在一個或多個p e r m i t語句中使用r e f l e c t關鍵字外,還必須考慮兩條相關的I O S語句。一條是e v a l u a t e語句,該語句要加在列表的結尾,以結束自反訪問表。另一條語句是i preflexice-list timeout命令,用于改變臨時自反訪問表表項的全局t i m e - o u t的值(默認是300s,可以在全局模式通過ip reflexive-list timeout修改全局超時時間也可以在相應的應用行設置超時時間,其優先于全局設置值 )。
自反列表的基本格式是:
ip access-list extended xxx
permit protocol source destination reflect name [time-out seconds]
ip access-list extended yyy
evaluate name (此關鍵字臨時創建內部通往外部的返回流量的開啟表項,兩標紅處須相同,意思我想就不用贅述了吧)
最后在接口啟用,這和普通列表的應用規則類似。
先查看一下測試前自反列表的配置:
R2#
R2#sh ip acce
Reflexive IP access list cisco
Extended IP access list infilter
10 permit ospf any any (33 matches)(顯示的定義允許ospf流量通過)
20 evaluate cisco
Extended IP access list outfilter
10 permit ospf any any (39 matches)
20 permit icmp any host 2.2.2.2 reflect cisco
30 permit icmp any host 30.1.1.1 reflect cisco
40 permit tcp any host 2.2.2.2 eq telnet reflect cisco
50 permit tcp any host 30.1.1.1 eq telnet reflect cisco
R2#
再查看一下測試后的自反列表的配置有什么不同:
Reflexive IP access list cisco
permit tcp host 2.2.2.2 eq telnet host 1.1.1.1 eq 13232 (73 matches) (time left 293)
permit icmp host 2.2.2.2 host 1.1.1.1 (19 matches) (time left 262) (這里就是動態創建的臨時開啟表項。默認時間是300s后刪除)
Extended IP access list infilter
10 permit ospf any any (100 matches)
20 evaluate cisco
Extended IP access list outfilter
10 permit ospf any any (105 matches)
20 permit icmp any host 2.2.2.2 reflect cisco (22 matches)
30 permit icmp any host 30.1.1.1 reflect cisco (11 matches)
40 permit tcp any host 2.2.2.2 eq telnet reflect cisco (245 matches)
50 permit tcp any host 30.1.1.1 eq telnet reflect cisco (138 matches)
R2#
然后我們查看一下在接口下的應用:
interface Serial1/0
ip address 2.2.2.1 255.255.255.0
ip access-group infilter in
clock rate 64000
!
interface Serial1/1
ip address 1.1.1.2 255.255.255.0
ip access-group outfilter in
注意:內外方向列表的應用不一定要在同一個接口下。
Ok,我們現在R1上測試一下ping結果:
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 136/213/268 ms
R1#ping 30.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 30.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/164/268 ms
R1#
#p#再測試一下telnet結果:
R1#
R1#telnet 2.2.2.2
Trying 2.2.2.2 ... Open
User Access Verification
Username: test
Password:
R3#
R1#telnet 30.1.1.1
Trying 30.1.1.1 ... Open
User Access Verification
Username: test
Password:
R3#(結果全部ok,符合題目要求)
我們再在R3執行相同的測試:
R3#
R3#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
R3#ping 10.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.1, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
R3#telnet 1.1.1.1
Trying 1.1.1.1 ...
% Destination unreachable; gateway or host down
R3#telnet 10.1.1.1
Trying 10.1.1.1 ...
% Destination unreachable; gateway or host down
R3#
【編輯推薦】