擴充ACL:
能夠同時比對IP資料包的(源IP 目标IP) 傳輸層協定
實驗名稱:擴充ACL的原理與應用
實驗拓撲:
實驗需求:
R1可以ping通R4;
R1的 loopback 10 無法 telnet R4 ;
實驗步驟:
1、確定網絡互通
基于拓撲圖,配置裝置端口位址;
配置靜态路由,確定網段互通;
&預設路由: 0.0.0.0 0.0.0.0 -> 0.0.0.0/0 ,表示所有網絡。
!
或者
注意:
ACL不會對本地裝置發起的流量起作用,僅僅對穿越流量起作用;
實驗過程:
R1>en
R1#conf
R1#configure t
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#no shu
R1(config-if)#ip add 192.
Dec 11 20:51:01.215: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
Dec 11 20:51:02.215: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#exit
R1(config)#int l
R1(config)#int loopback 10
R1(config-if)#ip add 10.10.1.1 255.255.255.0
R1(config)#ip routing
R1(config)#ip route 192.168.23.0 255.255.255.0 192.168.12.2
R1(config)#no ip route 192.168.23.0 255.255.255.0 192.168.12.2
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.12.2
R1(config)#exit
R1#ping 192.168.34.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.34.4, timeout is 2 seconds:
...!!
Success rate is 40 percent (2/5), round-trip min/avg/max = 88/90/92 ms
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 100/135/192 ms
R1# telnet 10.10.4.4 /source-interface loopback 10
Trying 10.10.4.4 ...
% Connection timed out; remote host not responding
R2>
R2>en
R2#conf
R2#configure t
R2#configure terminal
R2(config)#int f0/1
R2(config-if)#no shu
R2(config-if)#ip add
Dec 11 20:55:18.379: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
Dec 11 20:55:19.379: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#exit
R2(config)#int f0/0
R2(config-if)#ip add 192.168.23.2 255.255.255.0
R2(config)#ip routing
R2(config)#ip route 192.168.34.0 255.255.255.0 192.168.23.3
R2(config)#ip route 10.10.1.0 255.255.255.0 192.168.23.3
R2(config)#ip route 10.10.4.0 255.255.255.0 192.168.23.3
R2(config)#exit
R2(config)#ip access-list extended deny-telnet(設定擴充ACL拒絕遠端通路)
R2(config-ext-nacl)#10 deny tcp 10.10.1.1 0.0.0.0 10.10.4.4 0.0.0.0 eq 23 (拒絕 tcp是第7層應用層,源主機 精确位數 目标主機 精确位數 eq是等于 協定telnet或23是知名端口)
R2(config-ext-nacl)#20 deny tcp 10.10.1.1 0.0.0.0 192.168.34.0 0.0.0.255 eq$ 10.10.1.1 0.0.0.0 192.168.34.0 0.0.0.255 eq 23
R2(config-ext-nacl)#30 permit ip any any(允許所有)
R2(config-ext-nacl)#exit
R2(config)#int fas0/1
R2(config-if)#ip acces
R2(config-if)#ip access-group deny-telnet in(對應端口)
R2(config)#
R3>en
R3#conf
R3#configure t
R3#configure terminal
R3(config)#int f0/1
R3(config-if)#no shu
R3(config-if)#ip add 192.168.23.3 255.255.255.0
R3(config-if)#exit
R3(config)#int f0/0
R3(config-if)#no shu
R3(config-if)#ip add 192.168.34.3 255.255.255.0
R3(config)#ip routing
R3(config)#ip route 192.168.12.0 255.255.255.0 192.168.23.2
R3(config)#ip route 10.10.1.0 255.255.255.0 192.168.23.2
R3(config)#ip route 10.10.4.0 255.255.255.0 192.168.34.4
R4>en
R4#conf
R4#configure t
R4#configure terminal
R4(config)#int f0/0
R4(config-if)#no shu
R4(config-if)#ip add 192.168.34.4 255.255.255.0
R4(config-if)#exit
R4(config)#int l
R4(config)#int loopback 20 (虛拟端口,回環)
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 0.0.0.0 0.0.0.0 192.168.34.3
R4(config)#ena
R4(config)#enable p
R4(config)#enable password 123
R4(config)#li
R4(config)#line vt
R4(config)#line vty 0 4 (設定遠端通路)
R4(config-line)#pass
R4(config-line)#password 123456
R4(config-line)#
本文轉自 linuxpp 51CTO部落格,原文連結:http://blog.51cto.com/13505118/2049982,如需轉載請自行聯系原作者