OSPF网络配置排错
网络拓扑如图10.1所示,配置完成后发现从R1到R4和R5所带主机有时通有时不通,网络通信出现故障。
图10.1 BENET网络拓扑图
各路由器的配置如下所示:
R1配置
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.252
!
interface FastEthernet1/0
ip address 20.0.0.1 255.255.255.252
!
router ospf 1
network 10.0.0.0 0.0.0.3 area 0
network 20.0.0.0 0.0.0.3 area 0
R2配置
interface FastEthernet0/0
ip address 10.0.0.2 255.255.255.252
!
interface FastEthernet1/0
ip address 30.0.0.1 255.255.255.0
!
router ospf 1
network 10.0.0.0 0.0.0.3 area 0
network 30.0.0.0 0.0.0.255 area 1
R3配置
interface FastEthernet0/0
ip address 30.0.0.5 255.255.255.0
!
interface FastEthernet1/0
ip address 20.0.0.2 255.255.255.252
!
router ospf 1
network 20.0.0.0 0.0.0.3 area 0
network 30.0.0.0 0.0.0.255 area 2
R4配置
interface FastEthernet0/0
ip address 30.0.0.2 255.255.255.0
!
router ospf 1
network 30.0.0.0 0.0.0.255 area 1
R5配置
interface FastEthernet0/0
ip address 30.0.0.6 255.255.255.0
!
router ospf 1
network 30.0.0.0 0.0.0.255 area 2
在处理OSPF故障时,一般首先查看路由表,通过路由表发现路由异常;然后根据出现异常的路由条目的目的地址,检查所属路由器的配置、邻接关系等排除故障。
由于R1到R4、R5出现通信问题,所以查看R1的路由表,如下所示:
20.0.0.0/30 is subnetted, 1 subnets
C 20.0.0.0 is directly connected, FastEthernet1/0
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, FastEthernet0/0
30.0.0.0/24 is subnetted, 1 subnets
O IA 30.0.0.0 [110/2] via 20.0.0.2, 00:32:40, FastEthernet1/0
[110/2] via 10.0.0.2, 00:32:40, FastEthernet0/0
发现路由表中出现了负载均衡的路由条目,但是在网络规划中没有负载均衡的要求。
由于30.0.0.0/24网段出现故障,所以检查配置此网段的路由器。经检查检查配置发现接口地址的子网掩码配置有误,将/30的掩码误配置成/24的掩码导致的网络通信故障。
网络管理员更改配置如下所示:
R2配置:
interface FastEthernet1/0
ip address 30.0.0.1 255.255.255.252
R3配置:
interface FastEthernet0/0
ip address 30.0.0.5 255.255.255.252
R4配置:
interface FastEthernet0/0
ip address 30.0.0.2 255.255.255.252
R5配置:
interface FastEthernet0/0
ip address 30.0.0.6 255.255.255.252
更改配置完成后,再次查看路由表已经恢复正常,网络通信也已正常。
当运行OSPF协议的网络出现故障时,查看LSDB也可以快速有效的判断问题,上述故障案例中也可以通过LSDB发现故障。
当OSPF网络出现故障时,可以使用show ip ospf database命令R1查看LSDB,如下:
OSPF Router with ID (10.0.0.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
10.0.0.1 10.0.0.1 953 0x80000005 0x00CAFC 2
30.0.0.1 30.0.0.1 605 0x8000000A 0x0011C2 1
30.0.0.5 30.0.0.5 943 0x80000006 0x009723 1
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
10.0.0.1 10.0.0.1 1448 0x80000002 0x0048B3
20.0.0.2 30.0.0.5 943 0x80000002 0x00C60E
Summary Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
30.0.0.0 30.0.0.1 97 0x80000004 0x00F00B
30.0.0.0 30.0.0.5 943 0x80000002 0x00DC1D
R1的LSDB中粗体部分出现不同的路由器发送了相同的LSA,这时可以使用show ip ospf database summary命令进一步查看R1路由器收到的类型3的LSA信息如下:
OSPF Router with ID (10.0.0.1) (Process ID 1)
Summary Net Link States (Area 0)
Routing Bit Set on this LSA
LS age: 163
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 30.0.0.0 (summary Network Number)
Advertising Router: 30.0.0.1
LS Seq Number: 80000004
Checksum: 0xF00B
Length: 28
Network Mask: /24
TOS: 0 Metric: 1
Routing Bit Set on this LSA
LS age: 1009
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 30.0.0.0 (summary Network Number)
Advertising Router: 30.0.0.5
LS Seq Number: 80000002
Checksum: 0xDC1D
Length: 28
Network Mask: /24
TOS: 0 Metric: 1
两台路由器发布的Summary NET的LSA完全相同,这就造成了路由的负载均衡,查看路由表有网段30.0.0.0/24网段的负载均衡。然而实际网络并不是负载均衡的网络,检查配置发现子网掩码配置错误导致路由选路问题。