华为路由器RIP和OSPF引入路由简单实验

实验背景

如果在一个网络中既有RIP又有OSPF并且希望全网互连互通,那么我们就需要使用路由引入。在华三中讲到路由引入时,注意引入时只会将IP路由表以该路由协议存在的路由引入,换句话说引入不会将本地直连路由引入。所以在路由引入实验还需要引入直连路由协议。但是在华为路由器中,可以直接使用命令import-route rip/ospf即可将本地的直连路由也引入。

实验拓补

华为路由器RIP和OSPF引入路由简单实验_第1张图片

实验思路

1:我们按如图所示配置接口的IP地址,以及loopback地址。(routerID即loopback地址)

2:在OSPF的area0骨干区域宣告椭圆圈内的所有网段

3:在RIP协议里面宣告方框内的所有网段。

4:在R2路由器里,进行路由引入。

实验代码

AR1


system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]undo  info-center enable 
Info: Information center is disabled.
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/0 //配置IP地址
[R1-GigabitEthernet0/0/0]ip address 172.16.1.1 24	
[R1-GigabitEthernet0/0/0]quit 
[R1]interface LoopBack 0//进入loopback接口,并配置IP地址
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]quit 
	
[R1]ospf 1 router-id 1.1.1.1 //创建OSPF进程1,设置routerID为1.1.1.1
[R1-ospf-1]area 0//进入骨干区域0
[R1-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.255 //宣告172.16.1.0网段
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0//宣告loopbackip地址1.1.1.1
[R1-ospf-1-area-0.0.0.0]quit 



AR2

system-view 
Enter system view, return user view with Ctrl+Z.	
[Huawei]undo  info-center enable 
Info: Information center is disabled.
[Huawei]sysname R2 //将设备命名为R2
[R2]interface GigabitEthernet 0/0/0 //配置IP地址
[R2-GigabitEthernet0/0/0]ip address 172.16.1.254 24	
[R2-GigabitEthernet0/0/0]quit 
[R2]interface GigabitEthernet 0/0/1//配置IP地址
[R2-GigabitEthernet0/0/1]ip address 192.168.1.1 24	
[R2-GigabitEthernet0/0/1]quit 	
[R2]interface LoopBack 0 //进入loopback0接口,并配置IP地址,掩码是32位
[R2-LoopBack0]ip address 2.2.2.2 32
[R2-LoopBack0]quit 
	
[R2]ospf 1 router-id 2.2.2.2 //创建OSPF进程1,设置routerID为2.2.2.2	
[R2-ospf-1]area 0 //进入骨干区域0
[R2-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.255 //宣告172.16.1.0网段
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0//宣告loopback地址2.2.2.2
[R2-ospf-1-area-0.0.0.0]quit 	
[R2-ospf-1]quit 

[R2]rip 100 //创建RIP进程100
[R2-rip-100]version 2	//选择RIP版本为V2
[R2-rip-100]undo  summary //关闭有类聚合
[R2-rip-100]network 192.168.1.0  //宣告192.168.1.0网段	
[R2-rip-100]quit 


[R2]ospf 1 	//进入OSPF1进程
[R2-ospf-1]import-route rip 100//引入rip100进程
[R2-ospf-1]quit 
[R2]rip 100 //进入RIP进程100
[R2-rip-100]import-route ospf  1//引入OSPF进程1
[R2-rip-100]quit 

AR3


system-view 
Enter system view, return user view with Ctrl+Z.	
[Huawei]undo  info-center enable 
Info: Information center is disabled.
[Huawei]sysname R3 //将系统命名为R3

[R3]interface GigabitEthernet 0/0/0 //进入G0/0/0并配置IP地址
[R3-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[R3-GigabitEthernet0/0/0]quit 

[R3]interface LoopBack 0//进入loopback0接口,并配置IP地址,设置掩码是32位
[R3-LoopBack0]ip address 3.3.3.3 32	
[R3-LoopBack0]quit 

[R3]rip 100 //创建RIP100进程
[R3-rip-100]version 2 //选择版本是V2
[R3-rip-100]undo summary //关闭路由有类聚合
[R3-rip-100]network 192.168.1.0 //宣告192.168.1.0网段
[R3-rip-100]network 3.0.0.0	//宣告3.0.0.0ip地址
[R3-rip-100]quit 
[R3]

我们观察下R1上面的路由表

[R1]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 11       Routes : 11       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.2/32  OSPF    10   1           D   172.16.1.254    GigabitEthernet
0/0/0
        3.3.3.3/32  O_ASE   150  1           D   172.16.1.254    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
     172.16.1.0/24  Direct  0    0           D   172.16.1.1      GigabitEthernet
0/0/0
     172.16.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
   172.16.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
    192.168.1.0/24  O_ASE   150  1           D   172.16.1.254    GigabitEthernet
0/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

最后我们在R1上测试通断,结果说明实验室成功的。

 

[R1]ping 192.168.1.254
  PING 192.168.1.254: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.1.254: bytes=56 Sequence=2 ttl=254 time=40 ms
    Reply from 192.168.1.254: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 192.168.1.254: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 192.168.1.254: bytes=56 Sequence=5 ttl=254 time=30 ms

  --- 192.168.1.254 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 30/32/40 ms
[R1]ping 3.3.3.3
  PING 3.3.3.3: 56  data bytes, press CTRL_C to break
    Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=254 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=254 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=254 time=30 ms
[R1]

 

你可能感兴趣的:(【华为华三】)