華為路由器配置靜態路由,如果只包含出接口,靜態路由可以存在於路由表,但不能轉發數據,因為他的下一跳顯示的是他的出接口,這條靜態路由的出接口和下一跳地址為同一個地址。
R1預配
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy AR1
[AR1]int lo 0
[AR1-LoopBack0]ip add 1.1.1.1 32
[AR1-LoopBack0]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[AR1-GigabitEthernet0/0/0]q
[AR1]dis ip int br
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 1.1.1.1/32 up up(s)
NULL0 unassigned up up(s)
GigabitEthernet0/0/0 12.1.1.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 1.1.1.1/32 up up(s)
NULL0 unassigned up up(s)
R2預配
[Huawei]sy AR2
[AR2]int lo 0
[AR2-LoopBack0]ip add 2.2.2.2 32
[AR2-LoopBack0]int g0/0/2
[AR2-GigabitEthernet0/0/2]ip add 12.1.1.2 24
[AR2-GigabitEthernet0/0/2]dis ip int br
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
[AR2]int lo 0
[AR2-LoopBack0]ip add 2.2.2.2 32
[AR2-LoopBack0]int g0/0/2
[AR2-GigabitEthernet0/0/2]ip add 12.1.1.2 24
[AR2-GigabitEthernet0/0/2]dis ip int br
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 12.1.1.2/24 up up
LoopBack0 2.2.2.2/32 up up(s)
NULL0 unassigned up up(s)
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 12.1.1.2/24 up up
LoopBack0 2.2.2.2/32 up up(s)
NULL0 unassigned up up(s)
R1配置去往2網絡的靜態路由,只包含出接口
[AR1]ip route-static 2.2.2.0 255.255.255.0 g0/0/0
查看R1路由表
<AR1>dis ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
Destinations : 1 Routes : 1 Configured Routes : 1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
Destinations : 1 Routes : 1 Configured Routes : 1
Static routing table status : <Active>
Destinations : 1 Routes : 1
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.0/24 Static 60 0 D 12.1.1.1 GigabitEthernet
0/0/0
0/0/0
Static routing table status : <Inactive>
Destinations : 0 Routes : 0
Destinations : 0 Routes : 0
<AR1>
R2配置去往1網絡的靜態路由,只包含出接口
[AR2]ip route-static 1.1.1.0 255.255.255.0 g0/0/2
查看R2路由表
[AR2]dis ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
Destinations : 1 Routes : 1 Configured Routes : 1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
Destinations : 1 Routes : 1 Configured Routes : 1
Static routing table status : <Active>
Destinations : 1 Routes : 1
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Static 60 0 D 12.1.1.2 GigabitEthernet
0/0/2
0/0/2
Static routing table status : <Inactive>
Destinations : 0 Routes : 0
Destinations : 0 Routes : 0
[AR2]
R1 ping R2
[AR1]ping 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
[AR1]
[AR1]ping -a 1.1.1.1 2.2.2.2
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
PING 2.2.2.2: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
[AR1]
總結:華為路由器配置靜態路由,不能只有出接口,一定要連下一跳地址