设备及拓扑,如图所示: <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

   1:使得PC1可以访问Internet,PC2禁止访问Inernet..

   2:使Internet外的PC3能与局域网内部访问.

配置步骤:

PC1: 192.168.1.2/24  gw:192.168.1.1

PC2: 192.168.1.3/24  gw:192.168.1.1

PC3: 192.168.0.2/24  gw:192.168.0.1

R1:

Router>

Router>en

Router#confi t

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

Router(config)#host  R1

R1(config)#username  R2  password  cisco

R1(config)#access-list 1 deny 192.168.1.3 0.0.0.0 

R1(config)#int s0

R1(config-if)#ip add 10.0.0.1 255.255.255.0

R1(config-if)#encap ppp

R1(config-if)#ppp auth chap

R1(config-if)#clock rate 6400

R1(config-if)#ip access 1 in

R1(config-if)#no shut

R1(config-if)#exit

R1(config)#route rip

R1(config-router)#ip route 192.168.0.0 255.255.255.0 10.0.0.2

R1(config)#int e0

R1(config-if)#ip add 192.168.1.1 255.255.255.0

R1(config-if)#no shut

R1(config-if)#end

R1#

R2:

Router>

Router>en

Router#con t

Router(config)#ho R2

R2(config)#username R1 password cisco

R2(config)#int s0

R2(config-if)#ppp auth chap

R2(config-if)#encap ppp

R2(config-if)#clock rate 6400

R2(config-if)#ip add 10.0.0.2 255.255.255.0

R2(config-if)#no shut

R2(config-if)#end

R2#ping 10.0.0.1

Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

R2#config t

R2(config)#int e0

R2(config-if)#ip add 192.168.0.1 255.255.255.0

R2(config-if)#no shut

R2(config-if)#exit

R2(config)#route rip

R2(config-router)#ip route 192.168.1.0 255.255.255.0 10.0.0.1

R2(config)#end

运行结果:

PC1->PC3:

C:>ping 192.168.0.2

Pinging 192.168.0.1 with 32 bytes of data:

Reply from 192.168.0.1: bytes=32 time=60ms TTL=241

Reply from 192.168.0.1: bytes=32 time=60ms TTL=241

Reply from 192.168.0.1: bytes=32 time=60ms TTL=241

Reply from 192.168.0.1: bytes=32 time=60ms TTL=241

Reply from 192.168.0.1: bytes=32 time=60ms TTL=241

PC2->PC3:

C:>pin 192.168.0.2

Pinging 192.168.0.2 with 32 bytes of data:

Request timed out.

Request timed out.

Request timed out.

Request timed out.

Request timed out.