华为默认路由配置(华为默认路由配置命令实例)
Demo:
R1:
system-view
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 30
[R1-GigabitEthernet0/0/0]
Oct 22 2019 17:13:38-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]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.10.1 24
[R1-GigabitEthernet0/0/1]
Oct 22 2019 17:15:52-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]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1-GigabitEthernet0/0/1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.0.0.0/30 Direct 0 0 D 12.0.0.1 GigabitEthernet
0/0/0
12.0.0.1/32 Direct 0 0 D 127.0.0.1 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
192.168.10.0/24 Direct 0 0 D 192.168.10.1 GigabitEthernet
0/0/1
192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
R2:
system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]int g0/0
Oct 22 2019 17:19:26-08:00 R2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 1, the ch
ange loop count is 0, and the maximum number of records is 4095./0
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 30
[R2-GigabitEthernet0/0/0]
Oct 22 2019 17:19:43-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.un
[R2-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R2-GigabitEthernet0/0/0]int LoopBack 0
[R2-LoopBack0]
Oct 22 2019 17:20:46-08:00 R2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 3, the ch
ange loop count is 0, and the maximum number of records is 4095.
[R2-LoopBack0]ip add 2.2.2.2 32
[R2-LoopBack0]dis ip routing
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0
12.0.0.0/30 Direct 0 0 D 12.0.0.2 GigabitEthernet
0/0/0
12.0.0.2/32 Direct 0 0 D 127.0.0.1 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
[R2]ip route-static 192.168.10.0 24 12.0.0.1
PC1和PC2写IP地址和子网,网关:
通过PC1ping网关和R2路由查看是否互通:
PC>ping 192.168.10.1
Ping 192.168.10.1: 32 data bytes, Press Ctrl_C to break
From 192.168.10.1: bytes=32 seq=1 ttl=255 time=47 ms
From 192.168.10.1: bytes=32 seq=2 ttl=255 time=31 ms
From 192.168.10.1: bytes=32 seq=3 ttl=255 time=31 ms
From 192.168.10.1: bytes=32 seq=4 ttl=255 time=47 ms
From 192.168.10.1: bytes=32 seq=5 ttl=255 time=47 ms
--- 192.168.10.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/40/47 ms
[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=30 ms
Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=50 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=10 ms
Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=50 ms
--- 2.2.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/32/50 ms
[R1]ping 12.0.0.2
PING 12.0.0.2: 56 data bytes, press CTRL_C to break
Reply from 12.0.0.2: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 12.0.0.2: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 12.0.0.2: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 12.0.0.2: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 12.0.0.2: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 12.0.0.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/28/40 ms
此时可以达到全网互通,试验成功!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
暂时没有评论,来抢沙发吧~