本次实验是NBMA网络上,广播模式下的OSPF,网络拓扑是部分互联的。

 

 

R1配置:

interface Loopback1

 ip address 1.1.1.1 255.255.255.0

!

interface Loopback2

 ip address 1.1.2.1 255.255.255.0

!

interface Serial1/0

 ip address 10.0.1.1 255.255.255.0

 encapsulation frame-relay

 ip ospf network broadcast

!

router ospf 1

 router-id 1.1.1.1

 log-adjacency-changes

 network 1.1.1.0 0.0.0.255 area 0

 network 1.1.2.0 0.0.0.255 area 0

 network 10.0.1.0 0.0.0.255 area 0

!

R2配置:

interface Loopback1

 ip address 2.2.1.2 255.255.255.0

!

interface Loopback2

 ip address 2.2.2.2 255.255.255.0

!

interface Serial1/1

 ip address 10.0.1.2 255.255.255.0

 encapsulation frame-relay

 ip ospf network broadcast

!

router ospf 1

 router-id 2.2.2.2

 log-adjacency-changes

 network 10.0.1.0 0.0.0.255 area 0

 network 2.2.2.0 0.0.0.255 area 0

 network 2.2.1.0 0.0.0.255 area 0

!

R3配置:

interface Loopback1

 ip address 3.3.1.3 255.255.255.0

!

interface Loopback2

 ip address 3.3.2.3 255.255.255.0

!

interface Serial1/2

 ip address 10.0.1.3 255.255.255.0

 encapsulation frame-relay

 ip ospf network broadcast

!

router ospf 1

 router-id 3.3.2.3

 log-adjacency-changes

 network 3.3.1.0 0.0.0.255 area 0

 network 3.3.2.0 0.0.0.255 area 0

 network 10.0.1.0 0.0.0.255 area 0

!

 

各个路由器的邻居关系:

R1#show ip ospf neighbor 

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           1   FULL/DROTHER    00:00:34    10.0.1.2        Serial1/0

3.3.2.3           1   FULL/DR         00:00:39    10.0.1.3        Serial1/0

 

R2#show ip ospf neighbor 

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/BDR        00:00:32    10.0.1.1        Serial1/1

 

R3#show ip ospf neighbor 

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/BDR        00:00:35    10.0.1.1        Serial1/2

根据邻居关系可看出R3是DR,R2是DROTHER,R1是BDR

 

各个路由器路由表:

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, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

 

Gateway of last resort is not set

 

     1.0.0.0/24 is subnetted, 2 subnets

C       1.1.1.0 is directly connected, Loopback1

C       1.1.2.0 is directly connected, Loopback2

     3.0.0.0/32 is subnetted, 2 subnets

O       3.3.1.3 [110/782] via 10.0.1.3, 00:02:32, Serial1/0

O       3.3.2.3 [110/782] via 10.0.1.3, 00:02:32, Serial1/0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.0.1.0 is directly connected, Serial1/0

 

R2#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, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

 

Gateway of last resort is not set

 

     2.0.0.0/24 is subnetted, 2 subnets

C       2.2.1.0 is directly connected, Loopback1

C       2.2.2.0 is directly connected, Loopback2

     10.0.0.0/24 is subnetted, 1 subnets

C       10.0.1.0 is directly connected, Serial1/1

 

R3#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, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

 

Gateway of last resort is not set

 

     1.0.0.0/32 is subnetted, 2 subnets

O       1.1.1.1 [110/782] via 10.0.1.1, 00:03:17, Serial1/2

O       1.1.2.1 [110/782] via 10.0.1.1, 00:03:17, Serial1/2

     3.0.0.0/24 is subnetted, 2 subnets

C       3.3.1.0 is directly connected, Loopback1

C       3.3.2.0 is directly connected, Loopback2

     10.0.0.0/24 is subnetted, 1 subnets

C       10.0.1.0 is directly connected, Serial1/2

查看路由表发现存在问题。R3不知网络中有R2,R2不知网络中有R3。R3会将路由信息发给R1,而R1不会把路由信息发给R2,R1认为R3会把路由信息发给R2,因为R3是DR。结果导致R2学不到R1和R3的路由。我们可以通过手工配置DR来让它们互相学得路由。在R2和R3的接口模式下配置ip ospf priority 0使路由器R2和R3不进行选举DR或BDR,配置如下:

R2(config)#inter s1/1

R2(config-if)#ip ospf pr

R2(config-if)#ip ospf priority 0

 

R3(config)#inter s1/2

R3(config-if)#ip ospf pr

R3(config-if)#ip ospf priority 0

 

 

 

刷新路由进程查看各个路由器路由表:

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, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

 

Gateway of last resort is not set

 

     1.0.0.0/24 is subnetted, 2 subnets

C       1.1.1.0 is directly connected, Loopback1

C       1.1.2.0 is directly connected, Loopback2

     2.0.0.0/32 is subnetted, 2 subnets

O       2.2.1.2 [110/782] via 10.0.1.2, 00:08:58, Serial1/0

O       2.2.2.2 [110/782] via 10.0.1.2, 00:08:58, Serial1/0

     3.0.0.0/32 is subnetted, 2 subnets

O       3.3.1.3 [110/782] via 10.0.1.3, 00:08:58, Serial1/0

O       3.3.2.3 [110/782] via 10.0.1.3, 00:08:58, Serial1/0

     10.0.0.0/24 is subnetted, 1 subnets

C       10.0.1.0 is directly connected, Serial1/0

 

R2#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, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

 

Gateway of last resort is not set

 

     1.0.0.0/32 is subnetted, 2 subnets

O       1.1.1.1 [110/782] via 10.0.1.1, 00:09:43, Serial1/1

O       1.1.2.1 [110/782] via 10.0.1.1, 00:09:43, Serial1/1

     2.0.0.0/24 is subnetted, 2 subnets

C       2.2.1.0 is directly connected, Loopback1

C       2.2.2.0 is directly connected, Loopback2

     3.0.0.0/32 is subnetted, 2 subnets

O       3.3.1.3 [110/782] via 10.0.1.3, 00:09:33, Serial1/1

O       3.3.2.3 [110/782] via 10.0.1.3, 00:09:33, Serial1/1

     10.0.0.0/24 is subnetted, 1 subnets

C       10.0.1.0 is directly connected, Serial1/1

 

R3#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, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route

 

Gateway of last resort is not set

 

     1.0.0.0/32 is subnetted, 2 subnets

O       1.1.1.1 [110/782] via 10.0.1.1, 00:10:05, Serial1/2

O       1.1.2.1 [110/782] via 10.0.1.1, 00:10:05, Serial1/2

     2.0.0.0/32 is subnetted, 2 subnets

O       2.2.1.2 [110/782] via 10.0.1.2, 00:10:05, Serial1/2

O       2.2.2.2 [110/782] via 10.0.1.2, 00:10:05, Serial1/2

     3.0.0.0/24 is subnetted, 2 subnets

C       3.3.1.0 is directly connected, Loopback1

C       3.3.2.0 is directly connected, Loopback2

     10.0.0.0/24 is subnetted, 1 subnets

C       10.0.1.0 is directly connected, Serial1/2

 

R2有了R3的路由,R3也有了R2的路由,但它们是相互不能ping通的,因为它们找不到下一跳。

 

各个路由器邻居关系:

R1#show ip ospf ne

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

3.3.2.3           0   FULL/DROTHER    00:00:35    10.0.1.3        Serial1/0

2.2.2.2           0   FULL/DROTHER    00:00:32    10.0.1.2        Serial1/0

 

R2#show ip ospf ne

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/DR         00:00:31    10.0.1.1        Serial1/1

 

R3#show ip ospf ne

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/DR         00:00:35    10.0.1.1        Serial1/2