HCIA静态路由配置案例

该文详细展示了如何配置四台华为路由器(R1,R2,R3,R4)的静态路由,以实现网络中所有设备的可达性。通过在各路由器上设置相应的IP地址和静态路由条目,成功地进行了不同网络段之间的ping测试,验证了配置的有效性。
摘要由CSDN通过智能技术生成

配置静态路由实现全网可达

在这里插入图片描述

配置R1

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]user-int	
[R1]user-interface con	
[R1]user-interface console 0
[R1-ui-console0]idl	
[R1-ui-console0]idle-timeout 0
[R1-ui-console0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
Jan  7 2023 23:21:37-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 14.1.1.1 24
Jan  7 2023 23:22:21-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]int lo0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]q
[R1]dis ip con bri
           ^
Error: Unrecognized command found at '^' position.
[R1]dis ip int bri
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.1/24          up         up        
GigabitEthernet0/0/1              14.1.1.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         1.1.1.1/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R1]ip route-static 2.2.2.0 24 12.1.1.2
[R1]ip route-static 23.1.1.0 24 12.1.1.2
[R1]ip route-static 3.3.3.0 24 12.1.1.2
[R1]ip route-static 34.1.1.0 24 14.1.1.2
[R1]ip route-static 4.4.4.0 24 14.1.1.2

配置R2

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]user-int	
[R2]user-interface con	
[R2]user-interface console 0
[R2-ui-console0]id	
[R2-ui-console0]idle-timeout 0
[R2-ui-console0]int g0/0/0
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 12.1.1.2 24
Jan  7 2023 23:25:43-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R2-GigabitEthernet0/0/1]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 23.1.1.1 24
Jan  7 2023 23:26:06-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]int lo0
[R2-LoopBack0]ip add 2.2.2.2 24
[R2-LoopBack0]q
[R2]dis ip int bri
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              23.1.1.1/24          up         up        
GigabitEthernet0/0/1              12.1.1.2/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         2.2.2.2/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R2]ip route-	
[R2]ip route-static 3.3.3.0 24 23.1.1.2
[R2]ip route-static 34.1.1.0 24 23.1.1.2
[R2]ip route-static 4.4.4.0 24 23.1.1.2
[R2]ip route-static 14.1.1.0 24 12.1.1.1
[R2]ip route-static 1.1.1.0 24 12.1.1.1

配置R3

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]user-int	
[R3]user-interface con	
[R3]user-interface console 0
[R3-ui-console0]idl	
[R3-ui-console0]idle-timeout 0
[R3-ui-console0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 23.1.1.2 24
Jan  7 2023 23:28:31-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R3-GigabitEthernet0/0/1]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 34.1.1.1 24
Jan  7 2023 23:29:16-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]int lo0
[R3-LoopBack0]ip add 3.3.3.3 24
[R3-LoopBack0]q
[R3]dis ip int bri
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              34.1.1.1/24          up         up        
GigabitEthernet0/0/1              23.1.1.2/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         3.3.3.3/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R3]ip route-	
[R3]ip route-static 12.1.1.0 24 23.1.1.1
[R3]ip route-static 14.1.1.0 24 34.1.1.2
[R3]ip route-static 4.4.4.0 24 34.1.1.2
[R3]ip route-static 1.1.1.0 24 34.1.1.2
[R3]ip route-static 2.2.2.0 24 23.1.1.1
[R3]dis ip ro pro st	
[R3]dis ip ro pro static 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
         Destinations : 5        Routes : 5        Configured Routes : 5

Static routing table status : <Active>
         Destinations : 4        Routes : 4

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        2.2.2.0/24  Static  60   0          RD   23.1.1.1        GigabitEthernet
0/0/1
        4.4.4.0/24  Static  60   0          RD   34.1.1.2        GigabitEthernet
0/0/0
       12.1.1.0/24  Static  60   0          RD   23.1.1.1        GigabitEthernet
0/0/1
       14.1.1.0/24  Static  60   0          RD   34.1.1.2        GigabitEthernet
0/0/0

Static routing table status : <Inactive>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.0/24  Static  60   0               24.1.1.2        Unknown




[R3]

配置R4

The device is running!

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]user-int	
[R4]user-interface con	
[R4]user-interface console 0
[R4-ui-console0]idl	
[R4-ui-console0]idle-timeout 0
[R4-ui-console0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 34.1.1.2 24
[R4-GigabitEthernet0/0/1]
Jan  7 2023 23:30:32-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R4-GigabitEthernet0/0/1]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 14.1.1.2 24
Jan  7 2023 23:30:53-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R4-GigabitEthernet0/0/0]int lo0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-LoopBack0]q
[R4]dis ip int bri
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              14.1.1.2/24          up         up        
GigabitEthernet0/0/1              34.1.1.2/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         4.4.4.4/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
[R4]ip route-	
[R4]ip route-static 23.1.1.0 24 34.1.1.1
[R4]ip route-static 12.1.1.0 24 14.1.1.1
[R4]ip route-static 1.1.1.0 24 14.1.1.1
[R4]ip route-static 2.2.2.0 24 14.1.1.1
[R4]ip route-static 3.3.3.0 24 34.1.1.1


[R4]

效果:

R1:

[R1]ping 2.2.2.2
  PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=80 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 2.2.2.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/32/80 ms

[R1]ping 3.3.3.3
  PING 3.3.3.3: 56  data bytes, press CTRL_C to break
    Request time out
    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
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=254 time=20 ms

  --- 3.3.3.3 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 20/27/30 ms

[R1]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=50 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=30 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 4.4.4.4: bytes=56 Sequence=5 ttl=255 time=30 ms

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

[R1]

R2:

[R2]ping 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

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

[R2]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=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=10 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=30 ms

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

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

  --- 4.4.4.4 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 20/27/30 ms

[R2]

R3:

[R3]ping 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=254 time=30 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=254 time=30 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=254 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=254 time=30 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms

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

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

[R3]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=20 ms
    Reply from 4.4.4.4: bytes=56 Sequence=4 ttl=255 time=30 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 = 20/22/30 ms

R4:

[R4]ping 1.1.1.1
  PING 1.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

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

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

[R4]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=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=20 ms

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

[R4]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值