1.配置公有IP
1.R1配置公有IP
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add 16.1.1.1 24
Aug 5 2023 20:42:19-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 61.1.1.1 24
Aug 5 2023 20:42:48-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
2.R2配置公有IP
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip add 26.1.1.1 24
Aug 5 2023 20:46:17-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
3.R3配置公有IP
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip add 36.1.1.1 24
Aug 5 2023 20:47:26-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
4.R4配置公有IP
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip add 46.1.1.1 24
Aug 5 2023 20:48:32-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
5.R5配置公有IP
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip add 56.1.1.1 24
Aug 5 2023 20:50:12-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
6.R6配置公有IP
[r6]interface g0/0/0
[r6-GigabitEthernet0/0/0]ip add 16.1.1.2 24
Aug 5 2023 20:51:13-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 g4/0/0
[r6-GigabitEthernet4/0/0]ip add 61.1.1.2 24
Aug 5 2023 20:51:45-08:00 r6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r6-GigabitEthernet4/0/0]int g0/0/1
[r6-GigabitEthernet0/0/1]ip add 26.1.1.2 24
Aug 5 2023 20:52:08-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]int g0/0/2
[r6-GigabitEthernet0/0/2]ip add 36.1.1.2 24
Aug 5 2023 20:52:38-08:00 r6 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r6-GigabitEthernet0/0/2]int g2/0/0
[r6-GigabitEthernet2/0/0]ip add 46.1.1.2 24
Aug 5 2023 20:53:49-08:00 r6 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet2/0/0 has entered the UP state.
[r6-GigabitEthernet2/0/0]int g3/0/0
[r6-GigabitEthernet3/0/0]ip add 56.1.1.2 24
Aug 5 2023 20:54:14-08:00 r6 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface GigabitEthernet3/0/0 has entered the UP state.
2.配置私有IP
1.R1配置私有IP
<r1>system-view
Enter system view, return user view with Ctrl+Z.
[r1]int lo0
[r1-LoopBack0]ip add 192.168.1.1 24
2.R2配置私有IP
<r2>system-view
Enter system view, return user view with Ctrl+Z.
[r2]int lo0
[r2-LoopBack0]ip add 192.168.2.1 24
3.R3配置私有IP
<r3>system-view
Enter system view, return user view with Ctrl+Z.
[r3]int lo0
[r3-LoopBack0]ip add 192.168.3.1 24
4.R4配置私有IP
<r4>system-view
Enter system view, return user view with Ctrl+Z.
[r4]int lo0
[r4-LoopBack0]ip add 192.168.4.1 24
5.R5配置私有IP
<r5>system-view
Enter system view, return user view with Ctrl+Z.
[r5]int lo0
[r5-LoopBack0]ip add 192.168.5.1 24
6.R6配置环回
<r6>system-view
Enter system view, return user view with Ctrl+Z.
[r6]int lo0
[r6-LoopBack0]ip add 6.6.6.6 24
7.R6分别与对端测试是否配置成功
[r6]ping 16.1.1.1
PING 16.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 16.1.1.1: bytes=56 Sequence=1 ttl=255 time=150 ms
Reply from 16.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 16.1.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 16.1.1.1: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 16.1.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 16.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/48/150 ms
[r6]ping 61.1.1.1
PING 61.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 61.1.1.1: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 61.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 61.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 61.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 61.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 61.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/50 ms
[r6]ping 26.1.1.1
PING 26.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 26.1.1.1: bytes=56 Sequence=1 ttl=255 time=100 ms
Reply from 26.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 26.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 26.1.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 26.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 26.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/38/100 ms
[r6]ping 36.1.1.1
PING 36.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 36.1.1.1: bytes=56 Sequence=1 ttl=255 time=100 ms
Reply from 36.1.1.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 36.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 36.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 36.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 36.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/40/100 ms
[r6]ping 46.1.1.1
PING 46.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 46.1.1.1: bytes=56 Sequence=1 ttl=255 time=90 ms
Reply from 46.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 46.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 46.1.1.1: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 46.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 46.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/32/90 ms
[r6]ping 56.1.1.1
PING 56.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 56.1.1.1: bytes=56 Sequence=1 ttl=255 time=100 ms
Reply from 56.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 56.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 56.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 56.1.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 56.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/38/100 ms
3.配置公网路由(由于公网路由都有直连,配置缺省路由即可)
1.R1配置缺省路由
<r1>system-view
Enter system view, return user view with Ctrl+Z.
[r1]ip route-static 0.0.0.0 0 16.1.1.2
[r1]ip route-static 0.0.0.0 0 61.1.1.2
2.R2配置缺省路由
<r2>system-view
Enter system view, return user view with Ctrl+Z.
[r2]ip route-static 0.0.0.0 0 26.1.1.2
3.R3配置缺省路由
<r3>system-view
Enter system view, return user view with Ctrl+Z.
[r3]ip route-static 0.0.0.0 0 36.1.1.2
4.R4配置缺省路由
<r4>system-view
Enter system view, return user view with Ctrl+Z.
[r4]ip route-static 0.0.0.0 0 46.1.1.2
5.R5配置缺省路由
<r5>system-view
Enter system view, return user view with Ctrl+Z.
[r5]ip route-static 0.0.0.0 0 56.1.1.2
6.检测公网IP是否配置成功
<r1>ping 56.1.1.2
PING 56.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 56.1.1.2: bytes=56 Sequence=1 ttl=255 time=60 ms
Reply from 56.1.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 56.1.1.2: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 56.1.1.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 56.1.1.2: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 56.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/30/60 ms
<r1>ping 46.1.1.2
PING 46.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 46.1.1.2: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 46.1.1.2: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 46.1.1.2: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 46.1.1.2: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 46.1.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 46.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/24/30 ms
4.配置 MGRE (R1 R2 R3)
1.在R1上的配置
<r1>system-view
Enter system view, return user view with Ctrl+Z.
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip add 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.1.1.1
2.在R2上的配置
<r2>system-view
Enter system view, return user view with Ctrl+Z.
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip add 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
<r2>system-view
Enter system view, return user view with Ctrl+Z.
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.1.1 register
3.在R3上的配置
r3>system-view
Enter system view, return user view with Ctrl+Z.
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
Aug 5 2023 21:52:13-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
<r3>system-view
Enter system view, return user view with Ctrl+Z.
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.1.1 register
4.查看是否配置成功并进行检验
[r1]display nhrp peer all
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
10.1.1.2 32 26.1.1.1 10.1.1.2 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:05:25
Expire time : 01:54:35
-------------------------------------------------------------------------------
Protocol-addr Mask NBMA-addr NextHop-addr Type Flag
-------------------------------------------------------------------------------
10.1.1.3 32 36.1.1.1 10.1.1.3 dynamic route tunnel
-------------------------------------------------------------------------------
Tunnel interface: Tunnel0/0/0
Created time : 00:01:50
Expire time : 01:58:10
Number of nhrp peers: 2
[r1]ping 10.1.1.2
PING 10.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=255 time=100 ms
Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=255 time=100 ms
Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/60/100 ms
[r1]ping 10.1.1.3
PING 10.1.1.3: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.3: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 10.1.1.3: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.1.1.3: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 10.1.1.3: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 10.1.1.3: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 10.1.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/24/30 ms
5.配置 OSPF(R1 R2 R3) 使它们之间的环回可以通
1.R1上的配置
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 10.1.1.1 0.0.0.0
2.R2上的配置
[r2]ospf 1 router-id 2.2.2.2
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 10.1.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
3.R3上的配置
<r3>system-view
Enter system view, return user view with Ctrl+Z.
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]are 0
[r3-ospf-1-area-0.0.0.0]network 10.1.1.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0
4.查看OSPF是否配置成功
1.在R1上查看
<r1>display ospf peer brief
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Tunnel0/0/0 26.1.1.1 Init
----------------------------------------------------------------------------
2.在R2上查看 (没有收到R1的回复)
[r2]display ospf peer brief
OSPF Process 1 with Router ID 26.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
----------------------------------------------------------------------------
3.在R3上查看(没有收到R1的回复)
[r3]display ospf peer brief
OSPF Process 1 with Router ID 3.3.3.3
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
----------------------------------------------------------------------------
4.R1上开启伪广播
<r1>system-view
Enter system view, return user view with Ctrl+Z.
[r1]interface t0/0/0
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
5.R1 R2 R3上更改网络类型为broadcast(因为默认为点到点,所以需要更改)
[r1-Tunnel0/0/0]ospf network-type broadcast
[r2]int t0/0/0
[r2-Tunnel0/0/0]ospf network-type broadcast
[r3]int t0/0/0
[r3-Tunnel0/0/0]ospf network-type broadcast
6.R2 R3更改优先级为0
<r2>system-view
Enter system view, return user view with Ctrl+Z.
[r2]int t0/0/0
[r2-Tunnel0/0/0]ospf dr-priority 0
[r3-Tunnel0/0/0]ospf dr-priority 0
6.配置 MGRE (R1 R4 R5)
1.在R1上的配置
<r1>system-view
Enter system view, return user view with Ctrl+Z.
[r1]int t0/0/1
[r1-Tunnel0/0/1]ip add 10.1.2.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 61.1.1.1
2.在R4上的配置
<r4>system-view
Enter system view, return user view with Ctrl+Z.
[r4]int t0/0/0
[r4-Tunnel0/0/0]ip add 10.1.2.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 46.1.1.1
Aug 6 2023 13:25:48-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r4-Tunnel0/0/0]nhrp entry 10.1.2.1 61.1.1.1 register
[r4-Tunnel0/0/0]nhrp entry 10.1.2.3 56.1.1.1 register
3.在R5上的配置
<r5>system-view
Enter system view, return user view with Ctrl+Z.
[r5]int t0/0/0
[r5-Tunnel0/0/0]ip add 10.1.2.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 56.1.1.1
Aug 6 2023 13:32:01-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r5-Tunnel0/0/0]nhrp entry 10.1.2.1 61.1.1.1 register
4.R1 R5开启伪广播
[r1]int t0/0/1
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
7.配置 OSPF(R1 R4 R5) 使它们之间的环回可以通
1.R1上的配置
[r1]ospf 1
[r1-ospf-1]are 0
[r1-ospf-1-area-0.0.0.0]network 10.1.2.1 0.0.0.0
2.R4上的配置
[r4]ospf 1 router-id 4.4.4.4
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
3.R5上的配置
<r5>system-view
Enter system view, return user view with Ctrl+Z.
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 10.1.2.3 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 192.168.5.1 0.0.0.0
4.更改R1 R4 R5的网络类型
<r1>system-view
Enter system view, return user view with Ctrl+Z.
[r1]int t0/0/1
[r1-Tunnel0/0/1]ospf network-type broadcast
<r4>system-view
Enter system view, return user view with Ctrl+Z.
[r4]int t0/0/0
[r4-Tunnel0/0/0]ospf network-type broadcast
[r5]int t0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcast
8.检验是否联通
<r2>ping -a 192.168.2.1 192.168.4.1
PING 192.168.4.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.4.1: bytes=56 Sequence=1 ttl=254 time=70 ms
Reply from 192.168.4.1: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 192.168.4.1: bytes=56 Sequence=3 ttl=254 time=50 ms
Reply from 192.168.4.1: bytes=56 Sequence=4 ttl=254 time=60 ms
Reply from 192.168.4.1: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 192.168.4.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/54/70 ms
<r2>ping -a 192.168.2.1 192.168.5.1
PING 192.168.5.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.5.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=2 ttl=254 time=110 ms
Reply from 192.168.5.1: bytes=56 Sequence=3 ttl=254 time=50 ms
Reply from 192.168.5.1: bytes=56 Sequence=4 ttl=254 time=70 ms
Reply from 192.168.5.1: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 192.168.5.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/62/110 ms