OSPF 动态路由配置

OSPF 动态路由配置_第1张图片

以上是题目要求

使用192.168.1.0 24 网段合理分配 

每个路由器都有一个回环接口 总共5个网段 

r3回环地址固定 其他网段使用192.168.1.0 24合理分配
由图可知分为五个网段
三个环回接口
两个干道网段
将子网掩码右移3位
192.168.1.0 27 用于area0区域干道
192.168.1.32 27 ar1的环回
192.168.1.64 27 ar2的环回
192.168.1.96 27 ar3的环回
192.168.1.128 27 ar3与ar4之间的干道
192.168.1.160 27
192.168.1.192 27
192.168.1.224 27

配置各个接口的IP地址

AR1

[Huawei]sys R1
[R1]INT L0
[R1-LoopBack0]IP ADD 192.168.1.33 27
[R1-LoopBack0]QUIT
[R1]INT G0/0/0
[R1-GigabitEthernet0/0/0]IP ADD 192.168.1.1 27
May 13 2023 20:23:24-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state.

AR2

[Huawei]SYS R2
[R2]INT L0
[R2-LoopBack0]IP ADD 192.168.1.65 27
[R2-LoopBack0]QUIT
[R2]INT G0/0/0
[R2-GigabitEthernet0/0/0]IP ADD 192.168.1.2 27
May 13 2023 20:24:33-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 

AR3

[R3]INT L0
[R3-LoopBack0]IP ADD 192.168.1.97 27
[R3-LoopBack0]QUIT
[R3]INT G0/0/0
[R3-GigabitEthernet0/0/0]IP ADD 192.168.1.3 27
May 13 2023 20:26:04-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]INT G0/0/1
[R3-GigabitEthernet0/0/1]IP ADD 192.168.1.129 27
[R3-GigabitEthernet0/0/1]
May 13 2023 20:26:22-08:00 R3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

AR4

[Huawei]SYS R4
[R4]INT L0
[R4-LoopBack0]IP ADD 4.4.4.4 24
[R4-LoopBack0]QUIT
[R4]INT G0/0/0
[R4-GigabitEthernet0/0/0]IP ADD 192.168.1.130 27
May 13 2023 20:27:38-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 

启用ospf 并宣告

AR1 由于这一路由器所直连网段都位于192.168.1.0 24 中所以直接宣告192.168.1.0 0.0.0.255

根据题目要求这一区域位于area0

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255

AR2

	
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255

AR3

nter system view, return user view with Ctrl+Z.
[R3-ospf-1]dis th
[V200R003C00]
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
#
return
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 192.168.1.3 0.0.0.0

[R3-ospf-1-area-0.0.0.0]network 192.168.1.97 0.0.0.0
[R3-ospf-1-area-0.0.0.0]quit
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]network 192.168.1.129 0.0.0.0
[R3-ospf-1-area-0.0.0.1]quit

AR4

[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 1
[R4-ospf-1-area-0.0.0.1]network 192.168.1.130 0.0.0.0

将AR4设为缺省源 在ospf环境下配置

[R4-ospf-1]default-route-advertise always 

 查看AR1路由表和AR3的邻居表

dis ip rout
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 14       Routes : 14       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_ASE   150  1           D   192.168.1.3     GigabitEthernet
0/0/0
      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
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
    192.168.1.0/27  Direct  0    0           D   192.168.1.1     GigabitEthernet
0/0/0
    192.168.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   192.168.1.31/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   192.168.1.32/27  Direct  0    0           D   192.168.1.33    LoopBack0
   192.168.1.33/32  Direct  0    0           D   127.0.0.1       LoopBack0
   192.168.1.63/32  Direct  0    0           D   127.0.0.1       LoopBack0
   192.168.1.65/32  OSPF    10   1           D   192.168.1.2     GigabitEthernet
0/0/0
   192.168.1.97/32  OSPF    10   1           D   192.168.1.3     GigabitEthernet
0/0/0
  192.168.1.128/27  OSPF    10   2           D   192.168.1.3     GigabitEthernet
0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
dis 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/0             2.2.2.2          Full        
 0.0.0.1          GigabitEthernet0/0/1             4.4.4.4          Full        
 ----------------------------------------------------------------------------

将ar3设为dr 没有bdr(接口环境下配置)

分别将其他三个接口的

[R1-GigabitEthernet0/0/0]ospf dr-priority 0
[R2-GigabitEthernet0/0/0]ospf dr-priority 0
[R4-GigabitEthernet0/0/0]ospf dr-priority 0

优先级设为0使其放弃选举

减少路由条目 可以在abr r3上进行area0的汇总(区域环境下)

汇总后

[R3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.0

Public routing table : OSPF
         Destinations : 1        Routes : 1        

OSPF routing table status : 
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

    192.168.1.0/24  OSPF    10   2           D   192.168.1.129   GigabitEthernet
0/0/0

OSPF routing table status : 
         Destinations : 0        Routes : 0

汇总前

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

    192.168.1.0/27  OSPF    10   2           D   192.168.1.129   GigabitEthernet
0/0/0
   192.168.1.33/32  OSPF    10   2           D   192.168.1.129   GigabitEthernet
0/0/0
   192.168.1.65/32  OSPF    10   2           D   192.168.1.129   GigabitEthernet
0/0/0
   192.168.1.97/32  OSPF    10   1           D   192.168.1.129   GigabitEthernet
0/0/0

OSPF routing table status : 
         Destinations : 0        Routes : 0

保障安全进行加密配置 对每个接口进行同一加密(接口环境下)

ospf authentication-mode md5 1 cipher 123456

每个接口都执行这一命令

以上就完成了配置

进行测试

[R1-GigabitEthernet0/0/0]ping -a 192.168.1.33 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=254 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=50 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=50 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=50 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=50 ms

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/48/50 ms
[R2-GigabitEthernet0/0/0]ping 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=254 time=50 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=254 time=60 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=254 time=60 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=254 time=40 ms

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/50/60 ms
[R3-GigabitEthernet0/0/1]ping 4.4.4.4
  PING 4.4.4.4: 56  data bytes, press CTRL_C to break
    Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 4.4.4.4: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 4.4.4.4: bytes=56 Sequence=3 ttl=255 time=10 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/22/40 ms
[R4-GigabitEthernet0/0/0]ping 192.168.1.97
  PING 192.168.1.97: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.97: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 192.168.1.97: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 192.168.1.97: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 192.168.1.97: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 192.168.1.97: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 192.168.1.97 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/24/30 ms

全网可达!!!

你可能感兴趣的:(智能路由器,网络)