您的位置:首页 > 理论基础 > 计算机网络

OSPF_网络类型

2012-05-27 21:01 281 查看
OSPF__网络类型

OSPF根据物理链路类型定义了不同的网络类型。在每个网络中,OSPF的运行方式各不相同,其中包括如何建立邻居关系以及所需要的配置
OSPF定义了下面三种网络类型:
1、点到点:将一对路由器通过串口连接起来的网络




Serial1/0 is up, line protocol is up
Internet Address 12.1.1.2/24, Area 0
Process ID 1, Router ID 2.2.2.2, 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:08
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 1.1.1.1
Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
Internet Address 2.2.2.2/24, Area 0
Process ID 1, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/ - 00:00:38 12.1.1.1 Serial1/0
综上:由串口相连的是点到点网络类型,这种类型不用选举DR和BDR
2、广播:通过以太网连接的网络





R2#show ip ospf interface
FastEthernet0/0 is up, line protocol is up
Internet Address 12.1.1.2/24, Area 0
Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 1.1.1.1, Interface address 12.1.1.1
Backup Designated router (ID) 2.2.2.2, Interface address 12.1.1.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:06
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 1.1.1.1 (Designated Router)
Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
Internet Address 2.2.2.2/24, Area 0
Process ID 1, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/DR 00:00:36 12.1.1.1 FastEthernet0/0
综上:由以太网相连的属于广播类型,在这个类型里面需要选举DR和BDR,值得留意的是环回口的类型是LOOPBACk(相当于主机)类型,一次R1学到的2.0.0.0的子网掩码是32位的
3、NBMA(非广播多路访问):连接的路由器超过两台,但是没有广播功能。帧中继、ATM和X.25都属于NBMA。
在NBMA中,OSPF又有5种运行模式





帧中继的配置
hostname FR
no ip routing
frame-relay switching
interface Serial1/0
no ip address
encapsulation frame-relay
frame-relay lmi-type cisco
frame-relay intf-type dce
frame-relay route 102 interface Serial1/1 201
frame-relay route 103 interface Serial1/2 301
!
interface Serial1/1
no ip address
encapsulation frame-relay
no ip route-cache
no ip mroute-cache
serial restart-delay 0
frame-relay lmi-type cisco
frame-relay intf-type dce
frame-relay route 201 interface Serial1/0 102
!
interface Serial1/2
no ip address
encapsulation frame-relay
no ip route-cache
no ip mroute-cache
serial restart-delay 0
frame-relay lmi-type cisco
frame-relay intf-type dce
frame-relay route 301 interface Serial1/0 103
!
①:NBMA
interface Loopback0
ip address 1.1.1.1 255.255.255.0
ip ospf network point-to-point 使得环回口不形成loopback类型(不当作主机)
interface Serial1/0
ip address 123.1.1.1 255.255.255.0
encapsulation frame-relay
router ospf 1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 123.1.1.0 0.0.0.255 area 0
neighbor 123.1.1.2 priority 1 手动指定邻居,指定的是所连接的接口ip地址不是对方的Router-ID,优先级默认为1
R1#show ip ospf interface
Serial1/0 is up, line protocol is up
Process ID 1, Router ID 1.1.1.1, Network Type NON_BROADCAST, Cost: 64
Loopback0 is up, line protocol is up
Process ID 1, Router ID 1.1.1.1, Network Type POINT_TO_POINT, Cost: 1
R2#show ip route ospf
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/65] via 123.1.1.1, 00:00:02, Serial1/0

R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
1.1.1.1 1 FULL/BDR 00:01:59 123.1.1.1 Serial1/0
综上帧中继下的NBMA,需要选DR和BDR,要手动指定邻居
配置命令:ip ospf network non-broadcast
不是用组播地址发送的
②、broadcast(广播。cisco)
R1#show ip ospf int
Serial1/0 is up, line protocol is up
Internet Address 123.1.1.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 64
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 1 FULL/DR 00:00:39 123.1.1.2 Serial1/0

关键配置命令:ip ospf network point-to-point
选举DR和BDR,不用指定邻居。
使用组播224.0.0.5来发现邻居,使用debug ip packet可以看到
Hello time是10秒,dead是40秒
③、point-to-multipoint(点到多点)
使用组播224.0.0.0来发送更新的,不需要选举DR和BDR,hello时间间隔是30秒,dead time是120秒
配置: ip ospf network point-to-multipoint
此时的路由表、
R3#show ip route ospf
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/65] via 123.1.1.1, 00:00:35, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/129] via 123.1.1.1, 00:00:35, Serial1/0
123.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O 123.1.1.2/32 [110/128] via 123.1.1.1, 00:00:35, Serial1/0
O 123.1.1.1/32 [110/64] via 123.1.1.1, 00:00:35, Serial1/0 为何会有这些
④点到多点非广播(cisco point-to-multipoint non-broadcast)
不是用组播地址发送的

不用选择DR和BDR
用手动指定邻居,只是单方面指定就可以了的
R3#show ip ospf interface
Serial1/0 is up, line protocol is up
Internet Address 123.1.1.3/24, Area 0 Process ID 1, Router ID 3.3.3.3, Network Type POINT_TO_MULTIPOINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
Hello due in 00:00:13
R3#show ip route ospf
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/65] via 123.1.1.1, 00:00:52, Serial1/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/129] via 123.1.1.1, 00:00:52, Serial1/0
123.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O 123.1.1.2/32 [110/128] via 123.1.1.1, 00:00:52, Serial1/0
O 123.1.1.1/32 [110/64] via 123.1.1.1, 00:00:52, Serial1/0

⑤点到点子接口(cisco)
点到点子接口:不用指定邻居,不用选举DR和BDR,使用的组播老发送更新
但是这个的ip不是在同一个子网的
配置如下:当然这个时候ospf要重新通告。
R1:interface Serial1/0
no ip address
encapsulation frame-relay
ip ospf network point-to-point //定义为点到点
serial restart-delay 0
!
interface Serial1/0.1 point-to-point//设置子接口
ip address 12.1.1.1 255.255.255.0
frame-relay interface-dlci 102 //一定要指定dlci值。
!
interface Serial1/0.2 point-to-point
ip address 12.1.2.2 255.255.255.0
frame-relay interface-dlci 103
R2:
interface Serial1/0
no ip address
encapsulation frame-relay
ip ospf network point-to-point
serial restart-delay 0
!
interface Serial1/0.1 point-to-point
ip address 12.1.1.2 255.255.255.0
frame-relay interface-dlci 201
!
R3:
interface Serial1/0
no ip address
encapsulation frame-relay
ip ospf network point-to-point
serial restart-delay 0
!
interface Serial1/0.1 point-to-point
ip address 12.1.2.3 255.255.255.0
frame-relay interface-dlci 301
多点 点到点子接口
此时不要把主接口配置成点到点的,这里需要的是默认的非广播类型,在同一个子网内,要选举DR和BDR,也不是使用组播地址发送更新。需要手动指定邻居,hello时间是30,dead time是120秒

配置:
interface Serial1/0
no ip address
encapsulation frame-relay
ip ospf network non-broadcast
serial restart-delay 0
!
interface Serial1/0.1 multipoint
ip address 123.1.1.1 255.255.255.0
frame-relay interface-dlci 102
frame-relay interface-dlci 103
!
router ospf 1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
network 123.1.1.0 0.0.0.255 area 0
neighbor 123.1.1.3 priority 3
neighbor 123.1.1.2 priority 3
!
在R2和R3上面就不用配置帧中继dlci值。
R2#show ip route ospf
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/65] via 123.1.1.1, 00:00:38, Serial1/0
3.0.0.0/24 is subnetted, 1 subnets
O 3.3.3.0 [110/129] via 123.1.1.1, 00:00:38, Serial1/0
R2#这里纵然有3.3.3.0网段但是是不可以到达的,分析如下
查看ospf链路状态数据库,看是否有学到该网段的LSA类型
没有到达123.1.1.3网段所以是没有办法ping通3.3.3.3
同理R3也是没有办法ping通2.2.2.2的
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息