预配置:第一步:R1的预配置R1(config)#int lo0R1(config-if)#ip add 1.1.1.1 255.255.255.0R1(config-if)#int s1/2R1(c
.
预配置:
第一步:R1的预配置
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#int s1/2
R1(config-if)#ip add 10.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int s
R1(config-if)#int s1/3
R1(config-if)#ip add 10.1.2.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#^Z
R1#
第二步:R1的预配置
R2(config)#
R2(config)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#int lo1
R2(config-if)#ip add 172.16.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s2/1
R2(config-if)#ip add 10.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#^Z
第三步:R1的预配置
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#int lo1
R3(config-if)#ip add 192.168.1.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int s3/1
R3(config-if)#ip add 10.1.2.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#^Z
实验过程
第一步:在R1上配置ospf
R1(config)#router ospf 64 (在R1上开启ospf进程)
R1(config-router)#network 1.1.1.0 0.0.0.0 area 0 (宣告1.1.1.0到骨干区域area 0)
R1(config-router)#net 10.1.1.0 0.0.0.255 area 0
R1(config-router)#net 10.1.2.0 0.0.0.255 area 0
R1(config-router)#exit
R1(config)#^Z
第二步:在R2上配置ospf
R2(config)#router ospf 100
R2(config-router)#net 2.2.2.0 0.0.0.255 area 0
R2(config-router)#net 172.16.1.0 0.0.0.255 area 0
R2(config-router)#net 10.1.1.0 0.0.0.255 area 0
R2(config-router)#exit
R2(config)#
第三步:在R3上配置ospf
R3(config)#router ospf 101
R3(config-router)#net 3.3.3.0 0.0.0.255 area 0
R3(config-router)#net 192.168.1.0 0.0.0.255 area 0
R3(config-router)#net 10.1.2.0 0.0.0.255 area 0
R3(config-router)#exit
R3(config)#^Z
第四步:在R1上查看ospf配置
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default
U - per-user static route, o - ODR
T - traffic engineered route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 10.1.1.2, 00:00:15, Serial1/2
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 10.1.2.3, 00:00:15, Serial1/3
172.16.0.0/32 is subnetted, 1 subnets
O 172.16.1.2 [110/65] via 10.1.1.2, 00:00:15, Serial1/2
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.2.0 is directly connected, Serial1/3
C 10.1.1.0 is directly connected, Serial1/2
192.168.1.0/32 is subnetted, 1 subnets
O 192.168.1.3 [110/65] via 10.1.2.3, 00:00:15, Serial1/3
R1#
1#sh ip pro
Routing Protocol is "ospf 64"
Sending updates every 0 seconds
Invalid after 0 seconds, hold down 0, flushed after 0
Outgoing update filter list for all interfaces is
Incoming update filter list for all interfaces is
Redistributing: ospf 64
Routing for Networks: (查看R1上运行了ospf的接口)
1.1.1.0/32
10.1.1.0/24
10.1.2.0/24
Routing Information Sources:
Gateway Distance Last Update
192.168.1.3 110 00:00:42
172.16.1.2 110 00:00:42
Distance: (default is 110)
R1#
R1#sh ip ospf nei
Neighbor ID Pri State Dead Time Address Interface
172.16.1.2 1 FULL/ - 00:00:33 10.1.1.2 Serial1/2
192.168.1.3 1 FULL/ - 00:00:32 10.1.2.3 Serial1/3
R1#
R1#sh ip ospf inter (查看R1上运行ospf的接口)
Serial1/2 is up, line protocol is up
Internet Address 10.1.1.1/24, Area 0
Process ID 64, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:07
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 172.16.1.2
Suppress hello for 0 neighbor(s)
Serial1/3 is up, line protocol is up
Internet Address 10.1.2.1/24, Area 0
Process ID 64, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:03
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.1.3
Suppress hello for 0 neighbor(s)
R1#
R1#sho ip ospf da
OSPF Router with ID (1.1.1.1) (Process ID 64)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 277 0x80000005 0x8018 4
172.16.1.2 172.16.1.2 364 0x80000004 0x515 4
192.168.1.3 192.168.1.3 278 0x80000004 0xD534 4
R1#