一、拓朴及要求
二、过程
(一)R6为ISP只能配置IP地址,R1-R5的环回为私有网段
1、分划IP地址
2、配置IP地址
(1)R1
<R1>sy
Enter system view, return user view with Ctrl+Z.
[R1]int loo
[R1]int LoopBack 0
[R1-LoopBack0]ip add
[R1-LoopBack0]ip address 192.168.1.1 24
[R1-LoopBack0]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add
[R1-GigabitEthernet0/0/0]ip address 15.0.0.1 8
Jul 10 2024 16:34:42-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]
(2)R2
<R2>sys
Enter system view, return user view with Ctrl+Z.
[R2]int loo
[R2]int LoopBack 0
[R2-LoopBack0]ip add
[R2-LoopBack0]ip address 192.168.2.1 24
[R2-LoopBack0]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add
[R2-GigabitEthernet0/0/0]ip address 25.0.0.1 8
Jul 10 2024 16:43:53-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]
(3)R3
<R3>sy
Enter system view, return user view with Ctrl+Z.
[R3]int loo
[R3]int LoopBack 0
[R3-LoopBack0]ip add
[R3-LoopBack0]ip address 192.168.3.1 24
[R3-LoopBack0]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add
[R3-GigabitEthernet0/0/0]ip address 35.0.0.1 8
Jul 10 2024 16:45:18-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]
(4)R4
<R4>sy
Enter system view, return user view with Ctrl+Z.
[R4]int loo
[R4]int LoopBack 0
[R4-LoopBack0]ip add
[R4-LoopBack0]ip address 192.168.4.1 24
[R4-LoopBack0]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add
[R4-GigabitEthernet0/0/0]ip address 45.0.0.1 8
Jul 10 2024 16:46:36-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]
(5)R5
<R5>sys
Enter system view, return user view with Ctrl+Z.
[R5]int loo
[R5]int LoopBack 0
[R5-LoopBack0]ip add
[R5-LoopBack0]ip address 192.168.5.1 24
[R5-LoopBack0]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip add
[R5-GigabitEthernet0/0/0]ip address 55.0.0.1 8
Jul 10 2024 16:48:51-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]
(6)R6
<ISP>sys
Enter system view, return user view with Ctrl+Z.
[ISP]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add
[ISP-GigabitEthernet0/0/0]ip address 15.0.0.2 8
Jul 10 2024 17:01:26-08:00 ISP %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[ISP-GigabitEthernet0/0/0]int g 0/0/2
[ISP-GigabitEthernet0/0/2]ip add
[ISP-GigabitEthernet0/0/2]ip address 55.0.0.2 8
Jul 10 2024 17:02:20-08:00 ISP %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[ISP-GigabitEthernet0/0/2]int g2/0/0
[ISP-GigabitEthernet2/0/0]ip add
[ISP-GigabitEthernet2/0/0]ip address 25.0.0.2 8
Jul 10 2024 17:02:51-08:00 ISP %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet2/0/0 has entered the UP state.
[ISP-GigabitEthernet2/0/0]int g 3/0/0
[ISP-GigabitEthernet3/0/0]ip add
[ISP-GigabitEthernet3/0/0]ip address 35.0.0.2 8
Jul 10 2024 17:03:15-08:00 ISP %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet3/0/0 has entered the UP state.
[ISP-GigabitEthernet3/0/0]int g 4/0/0
[ISP-GigabitEthernet4/0/0]ip add
[ISP-GigabitEthernet4/0/0]ip address 45.0.0.2 8
Jul 10 2024 17:03:34-08:00 ISP %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[ISP-GigabitEthernet4/0/0]
(二)R1/4/5内全连的MGRE结构,R1/2/3为星型的拓扑结构,R1为中心站点
1、R1/4/5内全连的MGRE结构(首先吧R1/4/5进行中心配置,然后分别向另外两台路由器进行注册配置)
(1)R1
中心配置
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip add
[R1-Tunnel0/0/0]ip address 192.168.6.1 24
[R1-Tunnel0/0/0]tu
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]sou
[R1-Tunnel0/0/0]source 15.0.0.1
Jul 10 2024 17:49:56-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]nhrp net
[R1-Tunnel0/0/0]nhrp network-id 100
[R1-Tunnel0/0/0]
注册配置
[R1-Tunnel0/0/0]int t 0/0/0
[R1-Tunnel0/0/0]sou
[R1-Tunnel0/0/0]source g 0/0/0
[R1-Tunnel0/0/0]nhrp net
[R1-Tunnel0/0/0]nhrp network-id 400
[R1-Tunnel0/0/0]nhrp network-id 500
[R1-Tunnel0/0/0]nhrp entry 192.168.6.2 45.0.0.1 re
[R1-Tunnel0/0/0]nhrp entry 192.168.6.2 45.0.0.1 register
[R1-Tunnel0/0/0]nhrp entry 192.168.6.3 55.0.0.1 register
[R1-Tunnel0/0/0]
(2)R4
中心配置
<R4>sys
Enter system view, return user view with Ctrl+Z.
[R4]int t 0/0/0
[R4-Tunnel0/0/0]ip add
[R4-Tunnel0/0/0]ip address 192.168.6.2 24
[R4-Tunnel0/0/0]tunn
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]sou
[R4-Tunnel0/0/0]source 45.0.0.1
Jul 10 2024 17:53:23-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]
[R4-Tunnel0/0/0]nhrp net
[R4-Tunnel0/0/0]nhrp network-id 400
[R4-Tunnel0/0/0]
注册配置
[R4-Tunnel0/0/0]int t 0/0/0
[R4-Tunnel0/0/0]sou
[R4-Tunnel0/0/0]source g 0/0/0
[R4-Tunnel0/0/0]nhrp net
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]nhrp network-id 500
[R4-Tunnel0/0/0]nhrp entry 192.168.6.1 15.0.0.1 re
[R4-Tunnel0/0/0]nhrp entry 192.168.6.1 15.0.0.1 register
[R4-Tunnel0/0/0]nhrp entry 192.168.6.3 55.0.0.1 register
[R4-Tunnel0/0/0]
(3)R5
中心配置
<R5>sy
Enter system view, return user view with Ctrl+Z.
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ip add
[R5-Tunnel0/0/0]ip address 192.168.6.3 24
[R5-Tunnel0/0/0]tun
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp
[R5-Tunnel0/0/0]sou
[R5-Tunnel0/0/0]source 55.0.0.1
Jul 10 2024 17:54:26-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]
[R5-Tunnel0/0/0]nhrp net
[R5-Tunnel0/0/0]nhrp network-id 500
[R5-Tunnel0/0/0]
注册配置
[R5-Tunnel0/0/0]int t 0/0/0
[R5-Tunnel0/0/0]sou
[R5-Tunnel0/0/0]source g 0/0/0
[R5-Tunnel0/0/0]nhrp net
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp network-id 400
[R5-Tunnel0/0/0]nhrp entry 192.168.6.1 15.0.0.1 re
[R5-Tunnel0/0/0]nhrp entry 192.168.6.1 15.0.0.1 register
[R5-Tunnel0/0/0]nhrp entry 192.168.6.2 45.0.0.1 register
[R5-Tunnel0/0/0]
(4)测试
2、R1/2/3为星型的拓扑结构,R1为中心站点
(1)R1
[R1]int t 0/0/1
[R1-Tunnel0/0/1]ip add
[R1-Tunnel0/0/1]ip address 192.168.7.1 24
[R1-Tunnel0/0/1]tun
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp
[R1-Tunnel0/0/1]sou
[R1-Tunnel0/0/1]source 65.0.0.1
[R1-Tunnel0/0/1]nhrp net
[R1-Tunnel0/0/1]nhrp network-id 200
[R1-Tunnel0/0/1]
(2)R2
[R2]int t 0/0/1
[R2-Tunnel0/0/1]ip add
[R2-Tunnel0/0/1]ip address 192.168.7.2 24
[R2-Tunnel0/0/1]tunn
[R2-Tunnel0/0/1]tunnel-protocol gre p2mp
[R2-Tunnel0/0/1]sou
[R2-Tunnel0/0/1]source g 0/0/0
[R2-Tunnel0/0/1]nhrp net
[R2-Tunnel0/0/1]nhrp network-id 200
[R2-Tunnel0/0/1]nhrp entry 192.168.7.1 65.0.0.1 re
[R2-Tunnel0/0/1]nhrp entry 192.168.7.1 65.0.0.1 register
[R2-Tunnel0/0/1]
(3)R3
<R3>sy
Enter system view, return user view with Ctrl+Z.
[R3]int t 0/0/1
[R3-Tunnel0/0/1]ip add
[R3-Tunnel0/0/1]ip address 192.168.7.3 24
[R3-Tunnel0/0/1]tun
[R3-Tunnel0/0/1]tunnel-protocol gre p2mp
[R3-Tunnel0/0/1]sou
[R3-Tunnel0/0/1]source g 0/0/0
[R3-Tunnel0/0/1]nhrp net
[R3-Tunnel0/0/1]nhrp network-id 200
[R3-Tunnel0/0/1]nhrp entry 192.168.7.1 65.0.0.1 re
[R3-Tunnel0/0/1]nhrp entry 192.168.7.1 65.0.0.1 register
[R3-Tunnel0/0/1]
(三)所有私有网段可以互相通讯,私有网段使用OSPF完成
(1)R1
[R1]ospf 1 router-id 25.2.2.2
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net
[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 192.168.6.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]
(2)R2
[R2]ospf 1 rou
[R2]ospf 1 router-id 25.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]net
[R2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.25
[R2-ospf-1-area-0.0.0.0]
(3)R3
[R3]ospf 1 rou
[R3]ospf 1 router-id 35.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]net
[R3-ospf-1-area-0.0.0.0]network 192.168.3.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net
[R3-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]
(4)R4
[R4]ospf 1 rou
[R4]ospf 1 router-id 45.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]net
[R4-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
[R4-ospf-1-area-0.0.0.0]net
[R4-ospf-1-area-0.0.0.0]network 4.0.0.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]
(5)R5
[R5]ospf 1 rou
[R5]ospf 1 router-id 55.5.5.5
[R5-ospf-1]area 0
[R5-ospf-1-area-0.0.0.0]net
[R5-ospf-1-area-0.0.0.0]network 192.168.5.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]net
[R5-ospf-1-area-0.0.0.0]network 5.0.0.0 0.0.0.255
[R5-ospf-1-area-0.0.0.0]
(6)将R1/4/5的接口类型改为Broadcast类型
R1
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ospf net
[R1-Tunnel0/0/0]ospf network-type br
[R1-Tunnel0/0/0]ospf network-type broadcast
R4
[R4]int t 0/0/0
[R4-Tunnel0/0/0]ospf net
[R4-Tunnel0/0/0]ospf network-type br
[R4-Tunnel0/0/0]ospf network-type broadcast
R5
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ospf net
[R5-Tunnel0/0/0]ospf network-type br
[R5-Tunnel0/0/0]ospf network-type broadcast
(7)将R2,R3的优先级改为0,令R2、R3放弃选举
R2
<R2>sy
Enter system view, return user view with Ctrl+Z.
[R2]int t 0/0/0
[R2-Tunnel0/0/0]ospf dr
[R2-Tunnel0/0/0]ospf dr-priority 0
[R2-Tunnel0/0/0]
R3
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ospf dr
[R3-Tunnel0/0/0]ospf dr-priority 0
[R3-Tunnel0/0/0]
全网可通