第一步:R1上的配置 R1(config)#int lo0 R1(config-if)#ip add 1.1.1.1 255.255.255.0 R1(config-if)#int s2/1 R1(config-if)#ip add 12.1.1.1 255.255.255.0 R1(config-if)#no sh

R1(config)#router ospf 11 R1(config-router)#net 12.1.1.1 0.0.0.255 area 0 R1(config-router)#net 1.1.1.1 0.0.0.255 area 1 R1(config-router)#end 第二步:R2上的配置 R2(config)#int s2/1 R2(config-if)#ip add 12.1.1.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#int s2/2 R2(config-if)#ip add 23.1.1.1 255.255.255.0

R2(config)#router ospf 11 R2(config-router)#net 12.1.1.2 0.0.0.255 area 0 R2(config-router)#net 23.1.1.1 0.0.0.255 area 0 R2(config-router)#end 第三步:R3上的配置 R3(config)#int lo0 R3(config-if)#ip add 3.3.3.3 255.255.255.0 R3(config-if)#int s2/1 R3(config-if)#ip add 23.1.1.3 255.255.255.0 R3(config-if)#no sh

R3(config-router)#net 3.3.3.3 0.0.0.255 area 3 R3(config-router)#net 23.1.1.3 0.0.0.255 area 0 第四步:查看R1、R2、R3的路由表 R1#sh ip rou ……………… 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 3.0.0.0/32 is subnetted, 1 subnets O IA 3.3.3.3 [110/129] via 12.1.1.2, 00:00:16, Serial2/1 23.0.0.0/24 is subnetted, 1 subnets O 23.1.1.0 [110/128] via 12.1.1.2, 00:00:16, Serial2/1 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, Serial2/1 R1#

R2#sh ip rou ……………… 1.0.0.0/32 is subnetted, 1 subnets O IA 1.1.1.1 [110/65] via 12.1.1.1, 00:00:41, Serial2/1 3.0.0.0/32 is subnetted, 1 subnets O IA 3.3.3.3 [110/65] via 23.1.1.3, 00:00:41, Serial2/2 23.0.0.0/24 is subnetted, 1 subnets C 23.1.1.0 is directly connected, Serial2/2 12.0.0.0/24 is subnetted, 1 subnets C 12.1.1.0 is directly connected, Serial2/1 R2#

R3#sh ip rou ……………… 1.0.0.0/32 is subnetted, 1 subnets O IA 1.1.1.1 [110/129] via 23.1.1.1, 00:00:38, Serial2/1 3.0.0.0/24 is subnetted, 1 subnets C 3.3.3.0 is directly connected, Loopback0 23.0.0.0/24 is subnetted, 1 subnets C 23.1.1.0 is directly connected, Serial2/1 12.0.0.0/24 is subnetted, 1 subnets O 12.1.1.0 [110/128] via 23.1.1.1, 00:00:38, Serial2/1 第五步:ping测试全网是否连通 R1#ping Protocol [ip]: Target IP address: 3.3.3.3 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 1.1.1.1 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: Packet sent with a source address of 1.1.1.1 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 52/56/64 ms R1#