实验环境:PT模拟器【5.3.0.0088】
拓扑图:
ACL配置注意要点:
1.每个端口,每个方向,每种协议只能应用一个ACL。
2.拒绝优先。
3.ACL对本身的数据流不起作用。
4.默认隐含一条deny..
5.就近原则,避免浪费路由资源。
6.在VLAN中应用,把VLAN虚拟端口当成硬件端口,数据流从左往右。
配置命令:
hostname Router
interface FastEthernet0/0
ip address 10.1.1.1 255.255.255.0
interface FastEthernet0/1
ip address 172.16.1.1 255.255.255.0
interface Serial0/0/0
ip address 192.168.12.1 255.255.255.0
router rip
version 2
network 10.0.0.0
network 172.16.0.0
network 192.168.12.0
no auto-summary
end
hostname Router1
enable password enable
interface Loopback0
ip address 2.2.2.2 255.255.255.0
interface Serial0/0/0
ip address 192.168.12.2 255.255.255.0
ip access-group 1 in
clock rate 64000
interface Serial0/0/1
ip address 192.168.23.1 255.255.255.0
clock rate 64000
router rip
version 2
network 192.168.12.0
network 192.168.23.0
no auto-summary
access-list 1 deny 172.16.1.0 0.0.0.255
access-list 1 permit any
access-list 2 permit host 172.16.3.2
line con 0
line vty 0 4
access-class 2 in
password telnet
login
end
hostname Router2
interface FastEthernet0/0
ip address 172.16.3.1 255.255.255.0
interface Serial0/0/0
ip address 192.168.23.2 255.255.255.0
router rip
version 2
network 172.16.0.0
network 192.168.23.0
no auto-summary
end
测试结果:
PC1可以PING路由器1。PC2不可以PING路由器1。PC3可以TELNET路由器1。PC1和PC2不可以TELNET路由器1。