HCIA的OSPF路由实验

实验题目:
HCIA的OSPF路由实验_第1张图片

1.先基本配置接口的IP和路由的环回(例R1):

[R1]int g0/0/0                   
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 41.1.1.2 24
[R1]int lo 0 
[R1-LoopBack0]ip add 1.1.1.1 24

2.使用OSPF协议通告路由R1:
 

[R1]ospf 1 router-id 1.1.1.1       #进程号都用1,路由标识符手工指定
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]net 12.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]net 41.1.1.0 0.0.0.255

        R2路由上的路由通告:

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]are 0
[R2-ospf-1-area-0.0.0.0]net 12.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]net 23.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]default-route-advertise always      #将R2的环回以缺省的方式通告

3.查看路由表:

[R1]display ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 5        Routes : 6        

OSPF routing table status : 
         Destinations : 5        Routes : 6

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_ASE   150  1           D   12.1.1.2        GigabitEthernet0/0/0
        3.3.3.3/32  OSPF    10   2           D   41.1.1.1        GigabitEthernet0/0/1
                    OSPF    10   2           D   12.1.1.2        GigabitEthernet0/0/0
        4.4.4.4/32  OSPF    10   1           D   41.1.1.1        GigabitEthernet0/0/1
       23.1.1.0/24  OSPF    10   2           D   12.1.1.2        GigabitEthernet0/0/0
       34.1.1.0/24  OSPF    10   2           D   41.1.1.1        GigabitEthernet0/0/1

#除了R2上的缺省,其他两个环回的掩码均是32位

#除了R2上的缺省,其他两个环回的掩码均是32位,为了IP真实化,我们将环回接口还原真实网络掩码

[R1]int lo 0
[R1-LoopBack0]ospf network-type broadcast 

再次查看路由表的环回接口的网路掩码就还原了:

[R1]dis ip ro pr ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 5        Routes : 6        

OSPF routing table status : 
         Destinations : 5        Routes : 6

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_ASE   150  1           D   12.1.1.2        GigabitEthernet0/0/0
        3.3.3.0/24  OSPF    10   2           D   41.1.1.1        GigabitEthernet0/0/1
                    OSPF    10   2           D   12.1.1.2        GigabitEthernet0/0/0
        4.4.4.0/24  OSPF    10   1           D   41.1.1.1        GigabitEthernet0/0/1
       23.1.1.0/24  OSPF    10   2           D   12.1.1.2        GigabitEthernet0/0/0
       34.1.1.0/24  OSPF    10   2           D   41.1.1.1        GigabitEthernet0/0/1

你可能感兴趣的:(网络)