1、 广播多路访问
a、 DR/BDR的选举
b、 以太网
c、优先级相同 环回地址作为router-id
R1配置
en
conf t
hostname R1
int loopback 0
ip address 1.1.1.1 255.255.255.0
no shutdown
exit
int f0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255area 0
exit
end
R2配置
en
conf t
hostname R2
int loopback 0
ip address 2.2.2.2 255.255.255.0
no shutdown
exit
int f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
exit
int f0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
exit
router ospf 1
network 2.2.2.00.0.0.255 area 0
network 192.168.2.0 0.0.0.255area 0
network 192.168.1.0 0.0.0.255area 0
exit
end
R3配置
en
conf t
hostname R3
int loopback 0
ip address 3.3.3.3255.255.255.0
no shutdown
exit
int f0/1
ip address 192.168.2.2 255.255.255.0
no shutdown
exit
int f0/0
ip address 192.168.3.1 255.255.255.0
no shutdown
exit
router ospf 1
network 3.3.3.00.0.0.255 area 0
network 192.168.3.0 0.0.0.255area 0
network 192.168.2.0 0.0.0.255area 0
exit
end
R4配置
en
conf t
hostname R4
int loopback 0
ip address 4.4.4.4255.255.255.0
no shutdown
exit
int f0/0
ip address 192.168.3.2 255.255.255.0
no shutdown
exit
int f0/1
ip address 192.168.4.1 255.255.255.0
no shutdown
exit
router ospf 1
network 4.4.4.00.0.0.255 area 0
network 192.168.4.0 0.0.0.255area 0
network 192.168.3.0 0.0.0.255area 0
exit
end
R5配置
en
conf t
hostname R5
int loopback 0
ip address 5.5.5.5255.255.255.0
no shutdown
exit
int f0/1
ip address 192.168.4.2 255.255.255.0
no shutdown
exit
router ospf 1
network 5.5.5.00.0.0.255 area 0
network 192.168.4.0 0.0.0.255area 0
exit
end
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
4.4.4.4 1 FULL/DR 00:00:34 192.168.3.2 FastEthernet0/0
2.2.2.2 1 FULL/BDR 00:00:34 192.168.2.1 FastEthernet0/1
R3#show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.4 4.4.4.4 58 0x80000005 0x00dc68 3
3.3.3.3 3.3.3.3 58 0x80000005 0x0092c2 3
2.2.2.2 2.2.2.2 58 0x80000005 0x00481d 3
5.5.5.5 5.5.5.5 58 0x80000003 0x004cda 2
1.1.1.1 1.1.1.1 58 0x80000003 0x00500e 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.3.2 4.4.4.4 63 0x80000001 0x008aee
192.168.4.2 5.5.5.5 58 0x80000001 0x0095d6
192.168.2.2 3.3.3.3 58 0x80000001 0x00d2be
192.168.1.2 2.2.2.2 58 0x80000001 0x001822
解释:R3邻居和数据库。产生DR/BDR。数据库包含LSA1和LSA2
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 - OSPFexternal 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, 1 subnets
O 1.1.1.1 [110/3] via 192.168.2.1, 00:00:55, FastEthernet0/1
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 192.168.2.1, 00:00:55, FastEthernet0/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 192.168.3.2, 00:00:55, FastEthernet0/0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/3] via 192.168.3.2, 00:00:55, FastEthernet0/0
O 192.168.1.0/24 [110/2] via 192.168.2.1, 00:00:55, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
O 192.168.4.0/24 [110/2] via 192.168.3.2, 00:00:55, FastEthernet0/0
解释:R3路由信息,包含到区域所有网段的路由。
R4#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3.3 1 FULL/BDR 00:00:37 192.168.3.1 FastEthernet0/0
5.5.5.5 1 FULL/DR 00:00:37 192.168.4.2 FastEthernet0/1
R4#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
4.4.4.4 4.4.4.4 133 0x80000005 0x00dc68 3
5.5.5.5 5.5.5.5 133 0x80000003 0x004cda 2
3.3.3.3 3.3.3.3 133 0x80000005 0x0092c2 3
1.1.1.1 1.1.1.1 133 0x80000003 0x00500e 2
2.2.2.2 2.2.2.2 128 0x80000005 0x00481d 3
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
192.168.3.2 4.4.4.4 138 0x80000001 0x008aee
192.168.4.2 5.5.5.5 133 0x80000001 0x0095d6
192.168.2.2 3.3.3.3 133 0x80000001 0x00d2be
192.168.1.2 2.2.2.2 133 0x80000001 0x001822
解释:R4邻居和数据库。产生DR/BDR。数据库包含LSA1和LSA2
R4#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 - OSPFexternal 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, 1 subnets
O 1.1.1.1 [110/4] via 192.168.3.1, 00:02:02, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/3] via 192.168.3.1, 00:02:02, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/2] via 192.168.3.1, 00:02:02, FastEthernet0/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
5.0.0.0/32 is subnetted, 1 subnets
O 5.5.5.5 [110/2] via 192.168.4.2, 00:02:02, FastEthernet0/1
O 192.168.1.0/24 [110/3] via 192.168.3.1,00:02:02, FastEthernet0/0
O 192.168.2.0/24 [110/2] via 192.168.3.1,00:02:02, FastEthernet0/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
C 192.168.4.0/24 is directly connected, FastEthernet0/1
解释:R4路由信息,包含到区域所有网段的路由。