OSPF(Open Shortest Pass First)俗称开放最短路径优先协议,是众多内部网管协议中最常用的,同时他也是一个链路状态协议。
工具/原料
方法/步骤
2先配置路由器R1的各接口ip,然后再配置ospf协议,具体配置命令如下:sys / system view命令的简写,进入系统视图Enter system view, return user view with Ctrl+Z.[Huawei]un in en /此命令是undo info-center enable的简写,这个命令关闭信息中心功能,这样做配置的过程中,就不会再出现那种告警信息了。Info: Information center is disabled.[Huawei]sysn R1 /sysn是 sysname的简写,修改设备名称 /配置R1各接口ip [R1]int g0/0/1 /此命令是interface gigabitethernet 0/0/1的简写,进入路由器接口视图[R1-GigabitEthernet0/0/1]ip add 192.168.1.1 24 //add是address的简写[R1-GigabitEthernet0/0/1]int g0/0/2[R1-GigabitEthernet0/0/2]ip add 192.168.2.1 24[R1-GigabitEthernet0/0/2]quit /在路由器R1上配置OSPF基本功能[R1]ospf[R1-ospf-1]area 0[R1-ospf-1-area-0.0.0.0]net 192.168.1.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]net 192.168.2.0 0.0.0.255[R1-ospf-1-area-0.0.0.1]quit[R1-ospf-1]quit[R1]dis ip routing /查看路由表信息
3路由器R2,R3,R4,R5,R6,的配置过程与R1类似: R2:sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sysn R2[R2]int g0/0/1[R2-GigabitEthernet0/0/1]ip add 192.168.1.2 24[R2-GigabitEthernet0/0/1]int g0/0/2[R2-GigabitEthernet0/0/2]ip add 192.168.4.1 24[R2-GigabitEthernet0/0/2]quit[R2]ospf[R2-ospf-1]area 0[R2-ospf-1-area-0.0.0.0]net 192.168.1.0 0.0.0.255[R2-ospf-1-area-0.0.0.0]quit[R2-ospf-1]area 2[R2-ospf-1-area-0.0.0.2]net 192.168.4.0 0.0.0.255[R2-ospf-1-area-0.0.0.2]quit[R2-ospf-1]quit[R2]quitdis ip routing R3:sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sysn R3[R3]int g0/0/1[R3-GigabitEthernet0/0/1]ip add 192.168.2.2 24[R3-GigabitEthernet0/0/1]int g0/0/2[R3-GigabitEthernet0/0/2]ip add 192.168.3.1 24[R3-GigabitEthernet0/0/2]quit[R3]ospf[R3-ospf-1]area 1[R3-ospf-1-area-0.0.0.1]net 192.168.2.0 0.0.0.255[R3-ospf-1-area-0.0.0.1]net 192.168.3.0 0.0.0.255[R3-ospf-1-area-0.0.0.1]quit[R3-ospf-1]quit[R3]dis ip routing R4:sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sysn R4[R4]int g0/0/1[R4-GigabitEthernet0/0/1]ip add 192.168.4.2 24[R4-GigabitEthernet0/0/1]int g0/0/2[R4-GigabitEthernet0/0/2]ip add 192.168.5.1 24[R4]ospf[R4-ospf-1]area 2[R4-ospf-1-area-0.0.0.2]net 192.168.4.0 0.0.0.255[R4-ospf-1-area-0.0.0.2]net 192.168.5.0 0.0.0.255[R4-ospf-1-area-0.0.0.2]quit[R4-ospf-1]quit[R4]dis ip routing R5:sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sysn R5[R5]int g0/0/1[R5-GigabitEthernet0/0/1]ip add 192.168.3.2 24[R5]ospf[R5-ospf-1]area 1[R5-ospf-1-area-0.0.0.1]net 192.168.3.0 0.0.0.255[R5-ospf-1-area-0.0.0.1]quit[R5-ospf-1]quit[R5]dis ip routing R6:sysEnter system view, return user view with Ctrl+Z.[Huawei]un in enInfo: Information center is disabled.[Huawei]sysn R6[R6]int g0/0/1[R6-GigabitEthernet0/0/1]ip add 192.168.5.2 24[R6]ospf[R6-ospf-1]area 2[R6-ospf-1-area-0.0.0.2]net 192.168.5.0 0.0.0.255[R6-ospf-1-area-0.0.0.2]quit[R6-ospf-1]quit[R6]dis ip routing
4配置完成后,在路由器上使用dis ip routing,查看配置结果,R1,R2,R3的结果如图所示。
5在路由器上使用dis ospf routing,查看ospf的信息,R1,R2,R3的结果如图所示。