首先要在各个路由上运行路由协议,以保证各个路由能相互ping通。
 
要求:
1. 只允许 R3 R2 通信,不允许 R1 R2 通信。   
R0(config)#access-list 1 deny host 192.168.1.2<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

R0(config)#access-list permit any

R0(config)#int s0/1

R0(config-if)#ip access-group 1 out

 

2. 只允许 R3 可以 telnet 访问 R2 ,不允许 R1 telnet 访问 R2      R2(config)#line vty 0 4

R2(config-line)#password cisco

R2(config-line)#login

R2(config-line)#end

R2#conf t

R2(config)#access-list 101 permit tcp host 192.168.3.2 host 192.168.2.2 eq telnet

R2(config)#int s0/0/0

R2(config-if)#ip acce

R2(config-if)#ip access-group <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />101 in

R2(config-if)#end

 

3. 只允许 R3 可以 telnet R2 ,但是不可以 ping R2 ,不允许 R1 telnet R2, 但是要求可以 ping 通。

R2#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#line vty 0 4

R2(config-line)#password cisco

R2(config-line)#login

R2(config-line)#exit

R2(config)#access-list 101 permit tcp host 192.168.3.2 host 192.168.2.2 eq telnet

R2(config)#access-list 101 permit icmp host 192.168.1.2 host 192.168.2.2

R2(config)#end

R2(config)#int s0/0/0

R2(config-if)#ip access-group 101 in

R2(config-if)#end