OSPF单区域配置

OSPF单区域配置

实验环境:华为模拟器eNSP
现在有这样一个拓扑图:

我想要让R1可以pingR3,显然目前是不行的:

<R1>ping 192.168.2.2
PING 192.168.2.2: 56  data bytes, press CTRL_C to break
    Request time out
    Request time out
    Request time out
    Request time out
    Request time out

--- 192.168.2.2 ping statistics ---
    5 packet(s) transmitted
    0 packet(s) received
    100.00% packet loss

查看一下路由器R1的路由表:

<R1>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
        Destinations : 4        Routes : 4        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
    127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  Direct  0    0           D   192.168.1.1     Ethernet0/0/0
    192.168.1.1/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0

发现只有自己的IP地址,说明ping不通是正常的,现在我们来配置OSPF来让R1可以pingR3

<R1>sy
[R1]ospf    //启用ospf进程
[R1-ospf-1]area 0	  //区域号
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255   //宣告路由

<R2>sy
[R2]ospf
[R2-ospf-1]area 0	
[R2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255

<R3>sy
[R3]ospf
[R3-ospf-1]area 0	
[R3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255

这样就配好了,去R1上查看一下路由表:

<R1>dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
        Destinations : 5        Routes : 5        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
    127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/24  Direct  0    0           D   192.168.1.1     Ethernet0/0/0
    192.168.1.1/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0
    192.168.2.0/24  OSPF    10   2           D   192.168.1.2     Ethernet0/0/0

可以看到已经通过OSPF学到了路由器R3的路由,再来ping一下R3试试:

<R1>ping 192.168.2.2
PING 192.168.2.2: 56  data bytes, press CTRL_C to break
    Reply from 192.168.2.2: bytes=56 Sequence=1 ttl=254 time=60 ms
    Reply from 192.168.2.2: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 192.168.2.2: bytes=56 Sequence=3 ttl=254 time=80 ms
    Reply from 192.168.2.2: bytes=56 Sequence=4 ttl=254 time=60 ms
    Reply from 192.168.2.2: bytes=56 Sequence=5 ttl=254 time=50 ms

--- 192.168.2.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/56/80 ms

可以看到,已经能ping通了,说明配置没有问题。
再来看一下OSPF状态信息:

<R1>dis ospf peer brief 

    OSPF Process 1 with Router ID 192.168.1.1
        Peer Statistic Information
----------------------------------------------------------------------------
Area Id          Interface                        Neighbor id      State    
0.0.0.0          Ethernet0/0/0                    192.168.1.2      Full        
----------------------------------------------------------------------------
posted @ 2018-07-26 20:58  顾北清  阅读(551)  评论(0编辑  收藏  举报