模拟软件:GNS3

拓扑图:

wKioL1jR276gTUwuAABB-Mfvav8282.jpg-wh_50

PC1> ip:192.168.1.2

     mask: 255.255.255.0

     gateway: 192.168.1.1

PC2> ip:192.168.2.2

     mask:255.255.255.0

     gateway:192.168.2.1

R1> f0/0 ip:192.168.1.1/24

    f0/1 ip:192.168.3.1/24

R2> f0/0 ip:192.168.3.2/24

    f0/1 ip:192.168.2.1/24


配置如下:

PC1:

pc1>ip 192.168.1.2 255.255.255.0 192.168.1.1


PC2:

pc2>ip 192.168.2.2 255.255.255.0 192.168.2.1


R1:

R1>en

R1#conf t

R1(config)#int f0/0

R1(config-if)#ip add 192.168.1.1 255.255.255.0

R1(config-if)#no shut

R1(config)#exit

R1(config)#int f0/1

R1(config-if)#ip add 192.168.3.1 255.255.255.0

R1(config-if)#no shut

R1(config)#exit

R1(config)#router ospf 100

R1(config-router)#net 192.168.1.0 0.0.0.255 area 1

R1(config-router)#net 192.168.3.0 0.0.0.255 area 1

R1(config-router)#exit

 

R2:

R2>en

R2#conf t

R2(config)#int f0/0

R2(config-if)#ip add 192.168.3.2 255.255.255.0

R2(config-if)#no shut

R2(config)#exit

R2(config-if)#int f0/1

R2(config-if)#ip add 192.168.2.1 255.255.255.0

R2(config-if)#no shut

R2(config-if)#exit

R2(config)#router ospf 100

R2(config-router)#net 192.168.3.0 0.0.0.255 area 1

R2(config-router)#net 192.168.2.0 0.0.0.255 area 1

R2(config-router)#exit


以上PC1 ping通 PC2 就可以了。