|
Fastethernet0/0 |
Fastethernet1/0 |
Loopback 0 |
R1 |
192.168.12.1/24 |
N/A |
172.16.1.1/24 |
R2 |
192.168.12.2/24 |
192.168.23.2/24 |
172.16.2.1/24 |
R3 |
192.168.23.3/24 |
N/A |
172.16.3.1/24 |
l 现有三台路由器设备R1、R2、R3都运行OSPF协议,进程号为1。
l 三台设备手动指定Router-ID,分别为1.1.1.1、2.2.2.2、3.3.3.3 。
l 分别给R1、R2、R3配置一个环回地址为172.16.1.1/24、172.16.2.1/24、172.16.3.1/24
l 最终实现相互通信。
l 检测选举DR的原则。
(一) 配置各设备的接口地址和环回接口:
(config)#interface
fastEthernet x/x
(config-if)#ip
address x.x.x.x x.x.x.x
(config)#interface
loopback 0
(config-if)#ip
address x.x.x.x x.x.x.x
(二) 配置各设备所属的OSPF的相应区域:
(config)#router
ospf 1
(config-router)#router-id
x.x.x.x
(config-router)#network
x.x.x.x x.x.x.x area x
1)
先查看默认下网络环境是否为MA环境:
R2#show
ip ospf int f0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 192.168.12.2/24, Area 0
Process ID 1, Router ID 2.2.2.2, Network
Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DR,
Priority 1
Designated Router (ID) 2.2.2.2,
Interface address 192.168.12.2
Backup Designated router (ID)
1.1.1.1, Interface address 192.168.12.1
Timer intervals configured, Hello
10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:03
Supports Link-local Signaling
(LLS)
Index 1/1, 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 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
/上面的网络环境为广播多路访问(BROADCAST),此网络环境要选举DR,且要Dead时间内选举DR/
2)
在优先级相同下,手动选举Router-ID:手动指定Router-ID的地址,查看是否指定IP地址越大为DR
R2#show
ip ospf neighbor
Neighbor
ID Pri State Dead Time Address Interface
1.1.1.1 1
FULL/BDR 00:00:38 192.168.12.1 FastEthernet0/0
3.3.3.3 1
FULL/DR 00:00:32 192.168.23.3 FastEthernet1/0
/上面显示R2与R3的邻居关系时,R3为DR。说明优先级(默认优先级为1)相等时,手动指定的Router-ID大的为DR /
3)
测试R1与R3能否相互通信:
R1#ping
3.3.3.3
Type escape
sequence to abort.
Sending 5,
100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success
rate is 100 percent (5/5), round-trip min/avg/max = 36/48/68 ms
/上面显示R1与R3能相互通信/
4)
优先级相同下,自动选举Router-ID:若有环回接口存在,让它们自动选举Router-ID,查看是否环回地址大的为DR:
R2#show ip ospf
neighbor
Neighbor ID Pri State Dead Time Address Interface
172.16.3.1
1 FULL/DR 00:00:32 192.168.23.3 FastEthernet1/0
172.16.1.1
1 FULL/BDR 00:00:31 192.168.12.1 FastEthernet0/0
/上面显示的可以看出R3的环回地址为172.16.3.1比R2的环回地址大,所以此时R3为DR /
5)
优先级相同下,自动选举Router-ID:若没有环回接口存在,让它们自动选举Router-ID,则是否根据物理接口地址大的为DR:
R2#show
ip ospf neighbor
Neighbor
ID Pri State Dead Time Address Interface
192.168.23.3 1
FULL/DR 00:00:36 192.168.23.3 FastEthernet1/0
192.168.12.1 1
FULL/BDR 00:00:37 192.168.12.1 FastEthernet0/0
/上面显示R3的地址192.168.23.3比R2的F1/0大,则选为DR。可以看出此时比较物理接口地址,大的为DR。/
6)
R1与R3能否相互通信:
R1#ping
192.168.23.3
Type escape sequence to
abort.
Sending 5, 100-byte ICMP
Echos to 192.168.23.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent
(5/5), round-trip min/avg/max = 40/47/76 ms
/上面显示R1与R3能相互通信/
R1:
hostname R1 ! interface Loopback0 ip address 172.16.1.1 255.255.255.0 ! interface FastEthernet0/0 ip address 192.168.12.1 255.255.255.0 duplex auto speed auto ! router ospf 1 router-id 1.1.1.1 log-adjacency-changes network 172.16.1.0 0.0.0.255 area 0 network 192.168.12.0 0.0.0.255 area 0 ! end
1) 选举DR的网络环境条件:广播多路访问或是非广播多路访问即可选举DR。
2) 选举DR的时间限制:在Dead时间(40S)内选举出DR,且选DR 是在同一个网段内选举出一个DR。
3) 选举DR的原则:1.先比较优先级,优先级大的为DR。
2.优先级相同时,Router-ID大的为DR。
4) 选举Router-ID的原则:1.手动指定Router-ID,大的地址越优先,为DR。
2.自动选举Router-ID,大的地址越优先,为DR。
5) 自动选举Router-ID的原则:1.有环回接口存在,环回地址大的优先,为DR。
2.若无环回接口存在,物理接口地址大的为DR。
注意:当DR选举出来后,是不能被抢占的。若设备上的Router-ID不改变,但要修改某台设备为DR,则可以通过clear ip ospf process
若要修改设备的Router-ID,则只能把OSPF的进程删除再安装需求重新配置。
-----------------------------------------------------------------------------------------
SPOTO 我们共创未来
您的朋友 周俊杰(Jay)
Email:zhoujj@spoto.net
新浪微博:http://weibo.com/zhoujj0130
新浪博客:http://blog.sina.com.cn/zhoujj0130
持续付出不亚于任何人的努力
-----------------------------------------------------------------------------------------
|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )
GMT+8, 2024-5-6 09:01 , Processed in 0.055574 second(s), 18 queries , Gzip On.