华为交换机配置动态路由OSPF

  -拓扑图

               华为交换机配置动态路由OSPF_第1张图片
  -操作
    R1:
        system-view                                                    #进入系统视图
        [Huawei] sysname R1                                                        #设置名称
        [R1] interface GigabitEthernet 0/0/0                                  #进入接口
        [R1-GigabitEthernet0/0/0] ip address 192.168.1.1 24          #配置接口ip
        [R1-GigabitEthernet0/0/0] q
        [R1] interface loopback 0                                                  #进入回环接口
        [R1-LoopBack0] ip address 1.1.1.1 32                                #设置回环ip
        [R1-LoopBack0] q
        [R1] ospf 1 router-id 1.1.1.1                                               #配置ospf编号及私有路由ip
        [R1-ospf-1] area 0                                                             #配置所属区域
        [R1-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255       #声明直连路由网段
        [R1-ospf-1-area-0.0.0.0] network 1.1.1.1 0.0.0.0                  #声明回环ip
    R2:
        sys
        [Huawei] sysname R2
        [R2] inter g0/0/0
        [R2-GigabitEthernet0/0/0] ip address 192.168.1.2 24
        [R2-GigabitEthernet0/0/0] interface g0/0/1
        [R2-GigabitEthernet0/0/1] ip address 192.168.2.1 24
        [R2-GigabitEthernet0/0/1] q
        [R2] interface LoopBack 0
        [R2-LoopBack0] ip address 2.2.2.2 32
        [R2-LoopBack0] q
        [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
        [R2-ospf-1-area-0.0.0.0] area 1
        [R2-ospf-1-area-0.0.0.1] network 192.168.2.0 0.0.0.255
        [R2-ospf-1-area-0.0.0.1] network 2.2.2.2 0.0.0.0
        [R2-ospf-1-area-0.0.0.1] vlink-peer 3.3.3.3                        #定义虚拟连接 相邻路由id
    R3:
        sys
        [Huawei] sysname R3
        [R3] interface g0/0/1
        [R3-GigabitEthernet0/0/1] ip address 192.168.2.2 24
        [R3-GigabitEthernet0/0/1] interface g0/0/0
        [R3-GigabitEthernet0/0/0] ip address 192.168.3.1 24
        [R3-GigabitEthernet0/0/0] quit
        [R3] interface loopback 0
        [R3-LoopBack0] ip address 3.3.3.3 32
        [R3-LoopBack0] q
        [R3] ospf 1 router-id 3.3.3.3
        [R3-ospf-1] area 1
        [R3-ospf-1-area-0.0.0.1] network 192.168.2.0 0.0.0.255
        [R3-ospf-1-area-0.0.0.1] network 3.3.3.3 0.0.0.0
        [R3-ospf-1-area-0.0.0.1] vlink-peer 2.2.2.2
        [R3-ospf-1-area-0.0.0.1] q
        [R3-ospf-1] area 2
        [R3-ospf-1-area-0.0.0.2] network 192.168.3.0 0.0.0.255
        [R3-ospf-1-area-0.0.0.2] q
    R4:
        sys
        [Huawei] sysname R4
        [R4] inter g0/0/0
        [R4-GigabitEthernet0/0/0] ip address 192.168.3.2 24
        [R4-GigabitEthernet0/0/0] q
        [R4] interface loopback 0
        [R4-LoopBack0] ip address 4.4.4.4 32
        [R4-LoopBack0] q
        [R4] ospf 1 router-id 4.4.4.4
        [R4-ospf-1] area 2
        [R4-ospf-1-area-0.0.0.2] network 192.168.3.0 0.0.0.255
        [R4-ospf-1-area-0.0.0.2] network 4.4.4.4 0.0.0.0
    验证:
        ping 192.168.3.2               #R1 ping R4

转载于:https://my.oschina.net/xinsui1314x/blog/3057958

你可能感兴趣的:(华为交换机配置动态路由OSPF)