Router>enable Router# Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface FastEthernet0/0 Router(config-if)#ip address 10.0.0.1255.0.0.0 Router(config-if)# Router(config-if)#exit Router(config)#interface FastEthernet0/0 Router(config-if)#no shutdown
r2
1 2 3 4 5 6 7 8 9 10
Router>enable Router# Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface FastEthernet0/0 Router(config-if)#ip address 10.0.0.2255.0.0.0 Router(config-if)# Router(config-if)#exit Router(config)#interface FastEthernet0/0 Router(config-if)#no shutdown
测试连通性
r1 ping r2
1 2 3 4 5 6
Router#ping 10.0.0.2
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is2 seconds: !!!!! Success rate is100 percent (5/5), round-trip min/avg/max = 0/3/19 ms
r2 ping r1
1 2 3 4 5 6
Router#ping 10.0.0.1
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is2 seconds: !!!!! Success rate is100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
创建和部署 ACL,并验证实验效果
在r1上:
1 2 3
Router(config)access-list100 deny icmp 10.0.0.10.0.0.010.0.0.20.0.0.0 Router(config)#interface f0/0 Router(config-if)#ip access-group 100 out
部署完成后依旧可以正常ping
在r2上:
1 2 3
Router(config)access-list100 deny icmp 10.0.0.10.0.0.010.0.0.20.0.0.0 Router(config)#interface f0/0 Router(config-if)#ip access-group 100 in
部署完成后从PC1 ping PC2:
1 2 3 4 5 6
Router#ping 10.0.0.2
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.2, timeout is2 seconds: ..... Success rate is0 percent (0/5)
从PC2 ping PC1:
1 2 3 4 5 6
Router#ping 10.0.0.1
Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is2 seconds: UUUUU Success rate is0 percent (0/5)
Router(config)#access-list101 deny tcp host 10.0.0.110.0.0.20.0.0.0 eq telnet Router(config)#access-list101 permit ip any any Router(config)#int fa 0/0 Router(config-if)#ip access-group 101 in