拓扑
要求
- 注意路由区域
- R1、R2配置RIP
- R4、R5、R6、R7配置OSPF
- R1、R2、R4只能配置一条静态路由
- R5、R6、R7不能配置静态路由
- R3只能配置静态路由
- 全网互通
配置
R1配置
命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.1.1.1 30
Apr 15 2021 19:27:15-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]rip
[R1-rip-1]net 10.0.0.0
#静态路由
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.255.2 30
Apr 15 2021 22:02:25-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]q
#配置静态路由
[R1]ip rout
[R1]ip route-s
[R1]ip route-static 0.0.0.0 0 192.168.255.1
验证
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20<R1>dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 RIP 100 1 D 10.1.1.2 GigabitEthernet
0/0/0
10.1.1.0/30 Direct 0 0 D 10.1.1.1 GigabitEthernet
0/0/0
10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.3/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
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
R2配置
命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.1.1.2 30
Apr 15 2021 19:29:30-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int lo 1
[R2-LoopBack1]ip add 2.2.2.2 32
[R2-LoopBack1]rip 1
[R2-rip-1]ver 2
[R2-rip-1]net 10.0.0.0
[R2-rip-1]net 2.0.0.0
#配置静态路由
<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]ip rout
[R2]ip route-s
[R2]ip route-static 0.0.0.0 0 10.1.1.1
R3配置
命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14[Huawei]sys R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.255.1 30
Apr 16 2021 09:13:11-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 151.151.1.2 30
Apr 16 2021 09:13:33-08:00 R3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]q
#配置静态路由
[R3]ip route-static 151.151.1.0 30 151.151.1.1
[R3]ip route-static 192.168.255.0 30 192.168.255.2
R4配置
命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 131.131.255.13 30
Apr 15 2021 21:36:52-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 s4/0/0
[R4-Serial4/0/0]ip add 131.131.255.6 30
[R4-Serial4/0/0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 151.151.1.1 30
[R4-Serial4/0/0]q
#配置OSPF
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]net 131.131.255.12 0.0.0.3
[R4-ospf-1-area-0.0.0.0]net 131.131.255.4 0.0.0.3
#配置静态路由
[R3]ip route-static 2.2.2.2 32 192.168.255.2
[R3]ip route-static 10.1.1.0 30 192.168.255.2
[R3]ip route-static 7.7.7.7 32 151.151.1.1
[R3]ip route-static 131.131.255.0 28 151.151.1.1
验证
1
2
3
4
5
6
7
8
9
10
11
12
13<R4>ping 7.7.7.7
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Reply from 7.7.7.7: bytes=56 Sequence=1 ttl=253 time=190 ms
Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 7.7.7.7 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/68/190 ms
R5配置
命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 131.131.255.14 30
Apr 15 2021 21:47:09-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]int g0/0/01
[R5-GigabitEthernet0/0/1]ip add 131.131.255.10 30
Apr 15 2021 21:48:40-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R5-GigabitEthernet0/0/1]q
#配置OSPF
[R5]ospf 1 rout
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]net 131.131.255.0 0.0.0.255
R6配置
命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R6
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 131.131.255.9 30
Apr 15 2021 21:52:08-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R6-GigabitEthernet0/0/0]int s4/0/0
[R6-Serial4/0/0]ip add 131.131.255.5 30
[R6-Serial4/0/0]
Apr 15 2021 21:52:29-08:00 R6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol PPP
IPCP on the interface Serial4/0/0 has entered the UP state.
[R6-Serial4/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 131.131.255.1 30
Apr 15 2021 21:53:17-08:00 R6 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R6-GigabitEthernet0/0/1]q
#配置OSPF
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]net 131.131.255.0 0.0.0.255
#缺省路由发布
<R4>sys
Enter system view, return user view with Ctrl+Z.
[R4]ospf 1
[R4-ospf-1]defa
[R4-ospf-1]default-rout
[R4-ospf-1]default-route-advertise
验证
1
2
3
4
5
6
7
8
9
10
11<R6>dis ospf pe
<R6>dis ospf peer br
OSPF Process 1 with Router ID 6.6.6.6
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/0 5.5.5.5 Full
0.0.0.0 GigabitEthernet0/0/1 7.7.7.7 Full
0.0.0.0 Serial4/0/0 4.4.4.4 Full
----------------------------------------------------------------------------
验证
1
2
3
4
5
6
7
8
9
10
11
12
13<R2>ping -a 2.2.2.2 7.7.7.7
PING 7.7.7.7: 56 data bytes, press CTRL_C to break
Request time out
Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=250 time=60 ms
Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=250 time=40 ms
Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=250 time=50 ms
Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=250 time=50 ms
--- 7.7.7.7 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 40/50/60 ms1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16<R2>tracert -a 2.2.2.2 7.7.7.7
traceroute to 7.7.7.7(7.7.7.7), max hops: 30 ,packet length: 40,press CTRL_C t
o break
1 10.1.1.1 20 ms 10 ms 20 ms
2 192.168.255.1 30 ms 30 ms 20 ms
3 151.151.1.1 40 ms 30 ms 30 ms
4 131.131.255.14 40 ms 30 ms 30 ms
5 131.131.255.9 80 ms 40 ms 40 ms
6 131.131.255.2 50 ms 50 ms 50 ms