admin 发表于 2021-2-5 17:18:25

HCNA-33 理解OSPF Router-ID

HCNA-33 理解OSPF Router-ID
<Huawei>display router id//查看路由IDRouterID:0.0.0.0设备在未进行配置前默认路由ID为0.0.0.0·<Huawei>system-viewsysnamer1interfaceGigabitEthernet 0/0/0ipaddress 172.16.12.1 24 interfaceGigabitEthernet 0/0/1ipaddress 192.168.10.1 24 interfaceloopback 0ipaddress 1.1.1.1 32quitdisplayip interface brief*down:administratively down^down:standby(l):loopback(s):spoofingThenumber of interface that is UP in Physical is 4Thenumber of interface that is DOWN in Physical is 1Thenumber of interface that is UP in Protocol is 4Thenumber of interface that is DOWN in Protocol is 1 Interface                         IP Address/Mask      PhysicalProtocolGigabitEthernet0/0/0            172.16.12.1/24       up         up      GigabitEthernet0/0/1            192.168.10.1/24      up      up      GigabitEthernet0/0/2            unassigned         down       down   LoopBack0                         1.1.1.1/32         up         up(s)   NULL0                           unassigned         up         up(s)display router idRouterID:172.16.12.1可以看到,当前设备上的全局Router ID是172.16.12.1,而不是Loopback接口地址,因为是接口配置顺序会影响Router ID的选举,设备上每一次配置的是GE 0/0/0的物理地址,所以该地址会被Router ID使用,后面就算是增加环回口地址也不会被使用了。同理如果第一次配置的是环回口地址,那么也会被Router ID使用。下面undo掉GE0/0/0的地址:interfaceGigabitEthernet 0/0/0undo ip address 172.16.12.1 24quitdisplayrouter idRouterID:1.1.1.1当删除当前使用的Router-ID地址后,便会触发重新选举,按照环回口优先的规则,选择使用1.1.1.1作为Router ID。可以手工指定Router-ID,优点是不受选举地址的删除或变更影响。<r1>system-viewrouterid 1.1.1.1//配置Router-IDInfo:Router ID has been modified, please reset the relative protocols manually toupdate the Router ID.信息:路由器ID已被修改,请手动重置相关协议更新路由器ID。即当前全局配置的Router-ID已经被更新,如果目前设备上已经运行OSPF协议,需要重置OSPF协议进程或者重启整台路由器才可以使得OSPF协议中的Router-ID也同步更新使用该新的全局Router-ID。<r1>resetospf process//重置OSPF进程Warning:The OSPF process will be reset. Continue? :y完成其余基本配置:<r1>system-viewinterfaceGigabitEthernet 0/0/0ipaddress 172.16.12.1 24 <Huawei>system-viewsysnamer2interfaceGigabitEthernet 0/0/0ipaddress 172.16.12.2 24 interfaceGigabitEthernet 0/0/1ipaddress 172.16.23.2 24 interfaceGigabitEthernet 0/0/2ipaddress 172.16.24.2 24interfaceloopback 0ipaddress 2.2.2.2 32quit<Huawei>system-viewsysnamer3interfaceGigabitEthernet 0/0/0ipaddress 172.16.23.3 24 interfaceGigabitEthernet 0/0/1ipaddress 192.168.30.1 24 interfaceloopback 0ipaddress 3.3.3.3 32quit <Huawei>system-viewsysnamer4interfaceGigabitEthernet 0/0/0ipaddress 172.16.24.4 24 interfaceGigabitEthernet 0/0/1ipaddress 192.168.40.1 24 interfaceloopback 0ipaddress 4.4.4.4 32quit 配置OSPF及OSPF私有Router-IDospf1 router-id 1.1.1.1//配置OSPF进程1 私有IDarea0 network1.1.1.1 0.0.0.0network192.168.10.0 0.0.0.255network172.16.12.0 0.0.0.255return ospf1 router-id 2.2.2.2area0network2.2.2.2 0.0.0.0network172.16.12.0 0.0.0.255network172.16.23.0 0.0.0.255network172.16.24.0 0.0.0.255return ospf1 router-id 3.3.3.3area0network3.3.3.3 0.0.0.0network172.16.23.0 0.0.0.255network192.168.30.0 0.0.0.255return ospf1 router-id 4.4.4.4area0network4.4.4.4 0.0.0.0network172.16.24.0 0.0.0.255network192.168.40.0 0.0.0.255return 测试连通性 :PC>ping192.168.40.100 Ping192.168.40.100: 32 data bytes, Press Ctrl_C to breakFrom192.168.40.100: bytes=32 seq=1 ttl=125 time=31 msFrom192.168.40.100: bytes=32 seq=2 ttl=125 time=16 msFrom192.168.40.100: bytes=32 seq=3 ttl=125 time=15 msFrom192.168.40.100: bytes=32 seq=4 ttl=125 time=32 msFrom192.168.40.100: bytes=32 seq=5 ttl=125 time=31 ms---192.168.40.100 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 15/25/32 ms 下面把R2的OSPF 私用Router-ID配置成与R3一样看一下会怎么样:<r2>system-viewospf1 router-id 3.3.3.3return<r2>resetospf 1 process//重置OSPF协议进程1<r2>displayospf peer brief       OSPF Process 1 with Router ID 3.3.3.3               Peer Statistic Information ---------------------------------------------------------------------------- Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full       0.0.0.0          GigabitEthernet0/0/2             4.4.4.4          Full       ----------------------------------------------------------------------------<r2>display ospf peer brief       OSPF Process 1 with Router ID 3.3.3.3               Peer Statistic Information ---------------------------------------------------------------------------- Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full       0.0.0.0         GigabitEthernet0/0/2             4.4.4.4          Full       ----------------------------------------------------------------------------OSPF协议重新收敛之后,发现R2与R3之间的邻居关系消失。再测试PC1与PC2的连通性:PC>ping192.168.30.100 Ping192.168.30.100: 32 data bytes, Press Ctrl_C to breakRequesttimeout!Requesttimeout!Requesttimeout!Requesttimeout!Requesttimeout! ---192.168.30.100 ping statistics ---5 packet(s) transmitted0 packet(s) received100.00% packet loss结果是网络不通,网络发生了故障,说明一个问题,验证了OSPF建立直连邻居关系时,Router-ID一定不能重叠。那么OSPF非直连邻居的Router-ID重叠会怎么样: 还原R2制造的问题,现在把R3的Router-ID改成与R4一样:ospf1 router-id 2.2.2.2return<r2>resetospf 1 processWarning:The OSPF process will be reset. Continue? :y ospf1 router-id 4.4.4.4return<r3>resetospf 1 processWarning:The OSPF process will be reset. Continue? :y <r2>displayospf peer brief       OSPF Process 1 with Router ID 2.2.2.2               Peer Statistic Information ---------------------------------------------------------------------------- Area Id          Interface                        Neighbor id      State    0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full       0.0.0.0         GigabitEthernet0/0/1            4.4.4.4          Full       0.0.0.0          GigabitEthernet0/0/2             4.4.4.4          Full       ----------------------------------------------------------------------------发现R2有两个4.4.4.4的邻居!<r2>displayip routing-table protocol ospf RouteFlags: R - relay, D - download to fib------------------------------------------------------------------------------Publicrouting table : OSPF         Destinations : 4      Routes : 4       OSPFrouting table status : <Active>         Destinations : 4      Routes : 4 Destination/Mask    ProtoPreCost      Flags NextHop         Interface       1.1.1.1/32OSPF   10   1         D172.16.12.1   GigabitEthernet0/0/0      4.4.4.4/32OSPF   10   1         D172.16.24.4   GigabitEthernet0/0/2   192.168.10.0/24OSPF   10   2         D172.16.12.1   GigabitEthernet0/0/0   192.168.40.0/24OSPF   10   2         D172.16.24.4   GigabitEthernet0/0/2 OSPFrouting table status : <Inactive>         Destinations : 0      Routes : 0发现此时R2的路由表OSPF条目中,并没有R3的路由条目,说明的问题是即使路由器邻居关系建立正常,但也无法获取到路由条目。
页: [1]
查看完整版本: HCNA-33 理解OSPF Router-ID

公司网站