匿名
未登录
登录
Linux78|wiki
搜索
查看“华为OSPF区域配置”的源代码
来自Linux78|wiki
名字空间
页面
讨论
更多
更多
页面选项
查看
查看源代码
历史
←
华为OSPF区域配置
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
wiki:用户|用户
您可以查看与复制此页面的源代码。
[[文件:Ospf-1.jpg|有框|居中]] 基本配置如下: R1: interface Serial1/0/0 ip address 10.0.12.1 255.255.255.0 interface GigabitEthernet0/0/0 ip address 10.0.13.1 255.255.255.0 interface LoopBack0 ip address 10.0.1.1 255.255.255.0 R2: interface Serial1/0/0 ip address 10.0.12.2 255.255.255.0 interface LoopBack0 ip address 10.0.2.2 255.255.255.0 R3: interface GigabitEthernet0/0/0 ip address 10.0.13.3 255.255.255.0 interface LoopBack0 ip address 10.0.3.3 255.255.255.0 interface LoopBack1 ip address 172.16.0.1 255.255.255.0 测试: [R1]ping -c 2 10.0.12.2 PING 10.0.12.2: 56 data bytes, press CTRL_C to break Reply from 10.0.12.2: bytes=56 Sequence=1 ttl=255 time=50 ms Reply from 10.0.12.2: bytes=56 Sequence=2 ttl=255 time=10 ms [R1]ping -c 2 10.0.13.3 PING 10.0.13.3: 56 data bytes, press CTRL_C to break Reply from 10.0.13.3: bytes=56 Sequence=1 ttl=255 time=30 ms Reply from 10.0.13.3: bytes=56 Sequence=2 ttl=255 time=10 ms 二、OSPF配置如下: [R1]ospf 1 router-id 10.0.1.1 ====启用OPSF进程,默认进程ID为1.进程ID只具有本地意义,所以同一区域的不同路由器可以使用相同或者不同进程ID。 [R1-ospf-1]are 0 [R1-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255 =====network后面配置反掩码 [R1-ospf-1-area-0.0.0.0]network 10.0.13.0 0.0.0.255 [R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255 [R2]ospf 10 router-id 10.0.2.2 [R2-ospf-10]area 0 [R2-ospf-10-area-0.0.0.0]network 10.0.12.0 0.0.0.255 [R2-ospf-10-area-0.0.0.0]network 10.0.2.0 0.0.0.255 [R3]ospf 100 router-id 10.0.3.3 [R3-ospf-100]area 0 [R3-ospf-100-area-0.0.0.0]network 10.0.13.0 0.0.0.255 [R3-ospf-100-area-0.0.0.0]network 10.0.3.0 0.0.0.255 R1>display ip routing-table protocol ospf ====查看路由表中OSPF路由信息 Route Flags: R – relay, D – download to fib —————————————————————————— Public routing table : OSPF Destinations : 2 Routes : 2 OSPF routing table status : Destinations : 2 Routes : 2 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0 10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0 OSPF routing table status : Destinations : 0 Routes : 0 测试: ping -c 1 10.0.2.2 PING 10.0.2.2: 56 data bytes, press CTRL_C to break Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=255 time=10 ms — 10.0.2.2 ping statistics — 1 packet(s) transmitted 1 packet(s) received 0.00% packet loss round-trip min/avg/max = 10/10/10 ms ping -c 1 10.0.3.3 PING 10.0.3.3: 56 data bytes, press CTRL_C to break Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=255 time=10 ms — 10.0.3.3 ping statistics — 1 packet(s) transmitted 1 packet(s) received 0.00% packet loss round-trip min/avg/max = 10/10/10 ms display ospf peer ====显示OSPF邻居详细信息 OSPF Process 1 with Router ID 10.0.12.1 Neighbors Area 0.0.0.0 interface 10.0.12.1(Serial1/0/0)’s neighbors Router ID: 10.0.2.2 Address: 10.0.12.2 State: Full Mode:Nbr is Slave Priority: 1 DR: None BDR: None MTU: 0 Dead timer due in 32 sec Retrans timer interval: 5 Neighbor is up for 00:09:52 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.0 interface 10.0.13.1(GigabitEthernet0/0/0)’s neighbors Router ID: 10.0.3.3 Address: 10.0.13.3 State: Full Mode:Nbr is Slave Priority: 1 DR: 10.0.13.1 BDR: 10.0.13.3 MTU: 0 Dead timer due in 34 sec Retrans timer interval: 5 Neighbor is up for 00:06:50 Authentication Sequence: [ 0 ] display ospf peer brief ====显示OSPF简洁信息 OSPF Process 1 with Router ID 10.0.12.1 Peer Statistic Information —————————————————————————- Area Id Interface Neighbor id State 0.0.0.0 Serial1/0/0 10.0.2.2 Full 0.0.0.0 GigabitEthernet0/0/0 10.0.3.3 Full 三、修改OSPF Hello和Dead时间 display ospf interface g0/0/0 ====查看OSPF Hello与Dead默认时间 OSPF Process 1 with Router ID 10.0.12.1 Interfaces Interface: 10.0.13.1 (GigabitEthernet0/0/0) Cost: 1 State: DR Type: Broadcast MTU: 1500 Priority: 1 Designated Router: 10.0.13.1 Backup Designated Router: 10.0.13.3 Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1 [R3]int g0/0/0 [R3-GigabitEthernet0/0/0]ospf timer hello 15 [R3-GigabitEthernet0/0/0]ospf timer dead 60 display ip routing-table protocol ospf Route Flags: R – relay, D – download to fib —————————————————————————— Public routing table : OSPF Destinations : 1 Routes : 1 OSPF routing table status : Destinations : 1 Routes : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0 OSPF routing table status : Destinations : 0 Routes : 0 注:由于R1和R3之间hello与dead时间不一致,所以邻居无法建立。 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ospf timer hello 15 [R1-GigabitEthernet0/0/0]ospf timer dead 60 [R1]display ip routing-table protocol ospf Route Flags: R – relay, D – download to fib —————————————————————————— Public routing table : OSPF Destinations : 2 Routes : 2 OSPF routing table status : Destinations : 2 Routes : 2 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0 10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0 OSPF routing table status : Destinations : 0 Routes : 0 =================OSPF邻居建立必要条件================ 1.router-id不能相同 2.hello and dead 必须相同 3.区域ID必须相同 4.认证key-id及密码必须相同 5.特殊区域标记相同 6.三层MTU必须相同 7.子网掩码必须相同(在一个需要DR|BDR环境中) 8.最小范围内的双向互通 ============================================== 四、OSPF重分布默认路由 [R3]ip route-static 0.0.0.0 0 lo 1 [R3]ospf 100 [R3-ospf-100]default-route-advertise ====重分布默认路由 display ip routing-table protocol os | in 0.0.0.0 Route Flags: R – relay, D – download to fib —————————————————————————— Public routing table : OSPF Destinations : 3 Routes : 3 OSPF routing table status : Destinations : 3 Routes : 3 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 O_ASE 150 1 D 10.0.13.3 GigabitEthernet0/0/0 OSPF routing table status : Destinations : 0 Routes : 0 ping 172.16.0.1 PING 172.16.0.1: 56 data bytes, press CTRL_C to break Reply from 172.16.0.1: bytes=56 Sequence=1 ttl=255 time=10 ms Reply from 172.16.0.1: bytes=56 Sequence=2 ttl=255 time=20 ms Reply from 172.16.0.1: bytes=56 Sequence=3 ttl=255 time=10 ms 五、OSPF DR/BDR选举 display ospf peer OSPF Process 1 with Router ID 10.0.12.1 Neighbors Area 0.0.0.0 interface 10.0.12.1(Serial1/0/0)’s neighbors Router ID: 10.0.2.2 Address: 10.0.12.2 State: Full Mode:Nbr is Slave Priority: 1 DR: None BDR: None MTU: 0 Dead timer due in 31 sec Retrans timer interval: 5 Neighbor is up for 01:17:49 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.0 interface 10.0.13.1(GigabitEthernet0/0/0)’s neighbors Router ID: 10.0.3.3 Address: 10.0.13.3 State: Full Mode:Nbr is Slave Priority: 1 DR: 10.0.13.1 BDR: 10.0.13.3 MTU: 0 Dead timer due in 59 sec Retrans timer interval: 5 Neighbor is up for 00:30:15 Authentication Sequence: [ 0 ] 注:默认优先级是1,由于R3 router-id大于R1 router-id所以R3为DR,R1为BDR。 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ospf dr-priority 200 ====配置OSPF优先级为200 注:由于DR/BDR选举默认为不抢占模式,因此修改了优先级后,不会重新进行选举,所以要重置R1与R3之间邻居关系。 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]shut [R1-GigabitEthernet0/0/0]undo shut display ospf pee OSPF Process 100 with Router ID 10.0.3.3 Neighbors Area 0.0.0.0 interface 10.0.13.3(GigabitEthernet0/0/0)’s neighbors Router ID: 10.0.12.1 Address: 10.0.13.1 State: Full Mode:Nbr is Master Priority: 200 DR: 10.0.13.1 BDR: 10.0.13.3 MTU: 0 Dead timer due in 52 sec Retrans timer interval: 5 Neighbor is up for 00:02:10 Authentication Sequence: [ 0 ] 拓扑二 [[文件:Ospf-2.jpg|有框|居中]] 六、配置OSPF多区域 R1: [R1]ospf 1 router-id 10.0.1.1 [R1-ospf-1]area 0 [R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255 [R1-ospf-1-area-0.0.0.0]quit [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]network 10.0.13.0 0.0.0.255 [R1-ospf-1-area-0.0.0.1]network 10.0.1.0 0.0.0.255 R2: [R2]ospf 1 router-id 10.0.2.2 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255 [R2-ospf-1-area-0.0.0.0]network 10.0.2.0 0.0.0.255 R3: [R3]ospf 1 router-id 10.0.3.3 [R3-ospf-1]area 1 [R3-ospf-1-area-0.0.0.1]network 10.0.3.0 0.0.0.255 [R3-ospf-1-area-0.0.0.1]network 10.0.13.0 0.0.0.255 测试: display ip rou pr os Route Flags: R – relay, D – download to fib —————————————————————————— Public routing table : OSPF Destinations : 2 Routes : 2 OSPF routing table status : Destinations : 2 Routes : 2 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0 10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0 OSPF routing table status : Destinations : 0 Routes : 0 display ip routing-table protocol ospf Route Flags: R – relay, D – download to fib —————————————————————————— Public routing table : OSPF Destinations : 3 Routes : 3 OSPF routing table status : Destinations : 3 Routes : 3 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.1.1/32 OSPF 10 48 D 10.0.12.1 Serial1/0/0 10.0.3.3/32 OSPF 10 49 D 10.0.12.1 Serial1/0/0 10.0.13.0/24 OSPF 10 49 D 10.0.12.1 Serial1/0/0 OSPF routing table status : Destinations : 0 Routes : 0 ping -c 2 10.0.3.3 PING 10.0.3.3: 56 data bytes, press CTRL_C to break Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=255 time=20 ms Reply from 10.0.3.3: bytes=56 Sequence=2 ttl=255 time=20 ms ping -c 2 10.0.2.2 PING 10.0.2.2: 56 data bytes, press CTRL_C to break Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=255 time=10 ms Reply from 10.0.2.2: bytes=56 Sequence=2 ttl=255 time=10 ms display ospf peer brief OSPF Process 1 with Router ID 10.0.1.1 Peer Statistic Information —————————————————————————- Area Id Interface Neighbor id State 0.0.0.0 Serial1/0/0 10.0.2.2 Full 0.0.0.1 GigabitEthernet0/0/0 10.0.3.3 Full 七、OSPF直连路由重分布 [R3]ospf 1 [R3-ospf-1]import-route direct ====重分布直连 测试: dis ip rout protocol os Route Flags: R – relay, D – download to fib —————————————————————————— Public routing table : OSPF Destinations : 4 Routes : 4 OSPF routing table status : Destinations : 4 Routes : 4 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.2.2/32 OSPF 10 48 D 10.0.12.2 Serial1/0/0 10.0.3.0/24 O_ASE 150 1 D 10.0.13.3 GigabitEthernet0/0/0 10.0.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet0/0/0 172.16.0.0/24 O_ASE 150 1 D 10.0.13.3 GigabitEthernet0/0/0 注:O_ASE表示OSPF外部路由 ping -a 10.0.2.2 10.0.3.3 ====以IP 10.0.2.2为源 PING 10.0.3.3: 56 data bytes, press CTRL_C to break Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=254 time=20 ms Reply from 10.0.3.3: bytes=56 Sequence=2 ttl=254 time=10 ms Reply from 10.0.3.3: bytes=56 Sequence=3 ttl=254 time=20 ms Reply from 10.0.3.3: bytes=56 Sequence=4 ttl=254 time=20 ms R1>display ospf lsdb ==== 查看LSA数据库 OSPF Process 1 with Router ID 10.0.1.1 Link State Database Area: 0.0.0.0 Type LinkState ID AdvRouter Age Len Sequence Metric Router 10.0.2.2 10.0.2.2 1536 60 80000003 48 Router 10.0.1.1 10.0.1.1 1558 48 80000003 48 Sum-Net 10.0.13.0 10.0.1.1 1773 28 80000001 1 Sum-Net 10.0.3.3 10.0.1.1 1407 28 80000001 1 Sum-Net 10.0.1.1 10.0.1.1 1766 28 80000001 0 Sum-Asbr 10.0.3.3 10.0.1.1 522 28 80000001 1 Area: 0.0.0.1 Type LinkState ID AdvRouter Age Len Sequence Metric Router 10.0.3.3 10.0.3.3 523 48 80000005 1 Router 10.0.1.1 10.0.1.1 1399 48 80000006 1 Network 10.0.13.1 10.0.1.1 1399 32 80000002 0 Sum-Net 10.0.12.0 10.0.1.1 1773 28 80000001 48 Sum-Net 10.0.2.2 10.0.1.1 1535 28 80000001 48 AS External Database Type LinkState ID AdvRouter Age Len Sequence Metric External 10.0.3.0 10.0.3.3 523 36 80000001 1 External 10.0.13.0 10.0.3.3 523 36 80000001 1 External 172.16.0.0 10.0.3.3 523 36 80000001 1 display ospf lsdb summary 10.0.3.3 =====查看TYPE 3 LSA OSPF Process 1 with Router ID 10.0.1.1 Area: 0.0.0.0 Link State Database Type : Sum-Net Ls id : 10.0.3.3 Adv rtr : 10.0.1.1 Ls age : 1693 Len : 28 Options : E seq# : 80000001 chksum : 0x4cf3 Net mask : 255.255.255.255 Tos 0 metric: 1 Priority : Low Area: 0.0.0.1 Link State Database display ospf lsdb asbr ====查看TYPE 4 LSA OSPF Process 1 with Router ID 10.0.1.1 Area: 0.0.0.0 Link State Database Type : Sum-Asbr Ls id : 10.0.3.3 Adv rtr : 10.0.1.1 Ls age : 1031 Len : 28 Options : E seq# : 80000001 chksum : 0x3e01 Tos 0 metric: 1 Area: 0.0.0.1 Link State Database display ospf lsdb ase 172.16.0.0 ====查看TYPE 5 LSA OSPF Process 1 with Router ID 10.0.1.1 Link State Database Type : External Ls id : 172.16.0.0 Adv rtr : 10.0.3.3 Ls age : 1109 Len : 36 Options : E seq# : 80000001 chksum : 0xf70c Net mask : 255.255.255.0 TOS 0 Metric: 1 E type : 2 Forwarding Address : 0.0.0.0 Tag : 1 Priority : Low 八、配置OSPF认证 [R1]int s1/0/0 [R1-Serial1/0/0]ospf authentication-mode simple plain ccieh3c.com [R2]int s1/0/0 [R2-Serial1/0/0]ospf authentication-mode simple plain ccieh3c.com [R1-ospf-1]area 1 [R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher ccieh3c.com [R2-ospf-1]area 1 [R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher ccieh3c.com
返回至
华为OSPF区域配置
。
导航
导航
首页
最近更改
随机页面
栏目
Nginx
Kubernetes
Spring Cloud
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志