今天继续为自己对OSPFNMBA网络中的运行类型做个总结,也算是个学习笔记吧
好,马上开始
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

OSPF RFC2328中定义两种标准的在NBMA网络中运行的类型,分别是non-broadcastpoint to multipoint 类型。
cisco则新增三种类型,分别为broadcast point to point point to multipoint
下面则对这五种类型网络作个总结
Broadcast 适用于全互联网络,与其他远程路由器接口处于相同的子网,hello包的发送时间间隔为10s,由于是广播网络,所以不需要手动配置邻居,自动选举DR/BDR
Non-broadcast 默认情况下接口是处于该模式的,适用于全互联或部分互联,与其他远程路由器接口处于相同的子网,hello包的发送时间间隔为30s,由于是非广播的多路访问,因此需要使用neighbor命令手动配置邻居,选举DR/BDR
Point to multipoint 点到多点,适用于部分互联或星型网络,与其他远程路由器接口处于相同的子网,hello包的发送时间间隔为30s,不需要手工配置邻居,不选举DR/BDR.
Point to multipoint non-broadcast适用于部分互联或星型网络,这通常应用在网络部支持发送组播的情况下,与其他远程路由器接口处于相同的子网,hello包的发送时间间隔为30s,需要使用neighbor命令手动配置邻居,不选举DR/BDR
Point to point 适用于部分互联或星型网络且使用子接口,每个子接口处于不同的网络,hello包的发送时间间隔为10s,不需要手工配置邻居,不选举DR/BDR

 

对上面的描述再次做个总结:
1.       除了point to point类型需要不用的子接口配置不同的网络外,其他的类型都需要在同一个子网内
2.       除了point to point broadcast类型网络发送hello包的时间间隔为10s外,其他类型都为30s
3.       凡是non-broadcast类型都要自动配置邻居,其他类型则不需要。
4.       除了broadcastnon-broadcast要选举DR/BDR外,其他则不用
5.       只有Non-broadcastPoint to multipoint是国际标准,而其他则是cisco定义的

 

下面同过一个例子说明如何配置 OSPF 的五种类型在 NBMA 网络上的运行
1.       broadcast模式

 

r1(config)#interface Loopback0
r1(config-if)# ip address 172.16.1.1 255.255.255.0
r1(config-if)# ip ospf network point-to-point

//为什么要配置loopback口为point to point呢,这是OSPF一个很奇怪的特性,如果不配置,就算我配置的是24位的掩码,在其它路由器上看到依然是32位的主机路由

r1(config-if)#interface Serial0/0
r1(config-if)#ip address 192.168.1.1 255.255.255.0
r1(config-if)#encapsulation frame-relay
r1(config-if)#ip ospf network broadcast
r1(config-if)#frame-relay map ip 192.168.1.2 102 broadcast
r1(config-if)#frame-relay map ip 192.168.1.3 103 broadcast
r1(config-if)#no frame-relay inverse-arp
r1(config-if)#no shu
r1(config-if)#exit
r1(config)#router ospf  1
r1(config-router)#net <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />0.0.0.0 255.255.255.255 a 0

 

r2(config)#interface Loopback0
r2(config-if)# ip address 172.16.2.1 255.255.255.0
r2(config-if)# ip ospf network point-to-point

r2(config-if)#interface Serial0/0
r2(config-if)# ip address 192.168.1.2 255.255.255.0
r2(config-if)# encapsulation frame-relay
r2(config-if)# ip ospf network broadcast
r2(config-if)# frame-relay map ip 192.168.1.1 201 broadcast
r2(config-if)# no frame-relay inverse-arp
r2(config-if)#ip os pri 0
r2(config-if)#no shu
r2(config)#router os 1
r2(config-router)#net 0.0.0.0 255.255.255.255 a 0

 

r3(config)#interface Loopback0
r3(config-if)# ip address 172.16.3.1 255.255.255.0
r3(config-if)# ip ospf network point-to-point

r3(config-if)#interface Serial0/0
r3(config-if)# ip address 192.168.1.3 255.255.255.0
r3(config-if)# encapsulation frame-relay
r3(config-if)# ip ospf network broadcast
r3(config-if)# frame-relay map ip 192.168.1.1 301 broadcast
r3(config-if)# no frame-relay inverse-arp
r3(config-if)#ip os pri 0
r3(config-if)#no shu
r3(config)#router ospf 1
r3(config-router)#net 0.0.0.0 255.255.255.255 a 0

 

r1#sh ip os nei
Neighbor ID     Pri   State           Dead Time   Address         Interface
172.16.2.1        0   FULL/DROTHER    00:00:32    192.168.1.2     Serial0/0
172.16.3.1        0   FULL/DROTHER    00:00:35    192.168.1.3     Serial0/0

 

r3#ping 172.16.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

 

为什么不通呢,我们来看看r3的路由表

 

r3(config-if)#do sh ip rou
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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
     172.16.0.0/24 is subnetted, 3 subnets
O       172.16.1.0 [110/65] via 192.168.1.1, 00:14:11, Serial0/0
O       172.16.2.0 [110/129] via 192.168.1.1, 00:14:11, Serial0/0
C       172.16.3.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, Serial0/0

 

由于不是全互联模型,虽然r2r3接口s0/0都处于相同的子网下,但它们还是不能相互通信的,因此必须同过帧中继映射
r3(config-if)#frame-relay map ip 192.168.1.2 301 broadcast
r2也同样
r2(config-if)#frame-relay map ip 192.168.1.3 201 broadcast
配置后我们再来试r3(config-if)#do ping 172.16.2.1                         
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 68/111/156 ms
OK,实验完成

 

2.       non-broadcast

 

需要手动使用neighbor命令配置邻居由于默认情况下是non-broadcast模式,因此不用手动配置non-broadcast模式
r1(config)#interface Loopback0
r1(config-if)# ip address 172.16.1.1 255.255.255.0
r1(config-if)# ip ospf network point-to-point

r1(config-if)#interface Serial0/0
r1(config-if)#ip address 192.168.1.1 255.255.255.0
r1(config-if)#encapsulation frame-relay
r1(config-if)#ip ospf network broadcast
r1(config-if)#frame-relay map ip 192.168.1.2 102 broadcast
r1(config-if)#frame-relay map ip 192.168.1.3 103 broadcast
r1(config-if)#no frame-relay inverse-arp
r1(config-if)#no shu
r1(config-if)#exit
r1(config)#router ospf  1
r1(config-router)#net 0.0.0.0 255.255.255.255 a 0
r1(config-router)#neighbor 192.168.1.2

r1(config-router)#neighbor 192.168.1.3

 

r2(config)#interface Loopback0
r2(config-if)# ip address 172.16.2.1 255.255.255.0
r2(config-if)# ip ospf network point-to-point
r2(config-if)#interface Serial0/0
r2(config-if)# ip address 192.168.1.2 255.255.255.0
r2(config-if)# encapsulation frame-relay
r2(config-if)# ip ospf network broadcast
r2(config-if)# frame-relay map ip 192.168.1.1 201 broadcast

r2(config-if)# frame-relay map ip 192.168.1.3 201 broadcast

r2(config-if)# no frame-relay inverse-arp
r2(config-if)#ip os pri 0
r2(config-if)#no shu
r2(config)#router os 1
r2(config-router)#net 0.0.0.0 255.255.255.255 a 0

 

r3(config)#interface Loopback0
r3(config-if)# ip address 172.16.3.1 255.255.255.0
r3(config-if)# ip ospf network point-to-point
r3(config-if)#interface Serial0/0
r3(config-if)# ip address 192.168.1.3 255.255.255.0
r3(config-if)# encapsulation frame-relay
r3(config-if)# ip ospf network broadcast
r3(config-if)# frame-relay map ip 192.168.1.1 301 broadcast

r3(config-if)# frame-relay map ip 192.168.1.2 301 broadcast

r3(config-if)# no frame-relay inverse-arp
r3(config-if)#ip os pri 0
r3(config-if)#no shu
r3(config)#router ospf 1
r3(config-router)#net 0.0.0.0 255.255.255.255 a 0

 

r3#ping 172.16.2.1

 

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/88/160 ms

 

OK,实验完成

 

接下来是
3. Point to multipoint
r1(config)#interface Loopback0
r1(config-if)# ip address 172.16.1.1 255.255.255.0
r1(config-if)# ip ospf network point-to-point

r1(config-if)#interface Serial0/0
r1(config-if)#ip address 192.168.1.1 255.255.255.0
r1(config-if)#encapsulation frame-relay
r1(config-if)#ip ospf network point-to-multipoint
r1(config-if)#frame-relay map ip 192.168.1.2 102 broadcast
r1(config-if)#frame-relay map ip 192.168.1.3 103 broadcast
r1(config-if)#no frame-relay inverse-arp
r1(config-if)#no shu
r1(config-if)#exit
r1(config)#router ospf  1
r1(config-router)#net 0.0.0.0 255.255.255.255 a 0

 

r2(config)#interface Loopback0
r2(config-if)# ip address 172.16.2.1 255.255.255.0
r2(config-if)# ip ospf network point-to-point

r2(config-if)#interface Serial0/0
r2(config-if)# ip address 192.168.1.2 255.255.255.0
r2(config-if)# encapsulation frame-relay
r2(config-if)#ip ospf network point-to-multipoint
r2(config-if)# frame-relay map ip 192.168.1.1 201 broadcast
r2(config-if)# no frame-relay inverse-arp
r2(config-if)#no shu
r2(config)#router os 1
r2(config-router)#net 0.0.0.0 255.255.255.255 a 0

 

r3(config)#interface Loopback0
r3(config-if)# ip address 172.16.3.1 255.255.255.0
r3(config-if)# ip ospf network point-to-point

r3(config-if)#interface Serial0/0
r3(config-if)# ip address 192.168.1.3 255.255.255.0
r3(config-if)# encapsulation frame-relay
r3(config-if)#ip ospf network point-to-multipoint
r3(config-if)# frame-relay map ip 192.168.1.1 301 broadcast
r3(config-if)# no frame-relay inverse-arp
r3(config-if)#no shu

 

r1(config-if)#do sh ip o nei

 

Neighbor ID     Pri   State           Dead Time   Address         Interface
172.16.3.1        0   FULL/  -        00:01:57    192.168.1.3     Serial0/0
172.16.2.1        0   FULL/  -        00:01:35    192.168.1.2     Serial0/0
由此可以看出不选举DR/BDR

 

r1(config-if)#do sh ip rou
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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

 

     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback0
O       172.16.2.0 [110/65] via 192.168.1.2, 00:00:06, Serial0/0
O       172.16.3.0 [110/65] via 192.168.1.3, 00:00:06, Serial0/0
     192.168.1.0/24 is variably subnetted, 3 subnets, 2 masks
C       192.168.1.0/24 is directly connected, Serial0/0
O       192.168.1.3/32 [110/64] via 192.168.1.3, 00:00:06, Serial0/0
O       192.168.1.2/32 [110/64] via 192.168.1.2, 00:00:06, Serial0/0