OSPF实验

实验拓扑图

OSPF实验_第1张图片

R1的IP以及环回的配置

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname R1
[R1]inter	
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip add	
[R1-GigabitEthernet0/0/0]ip address 15.1.1.1 24
[R1-GigabitEthernet0/0/0]
Jan 14 2024 23:46:36-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]q
[R1]inter	
[R1]interface loop	
[R1]interface LoopBack 0
[R1-LoopBack0]ip add	
[R1-LoopBack0]ip address 1.1.1.1 32
[R1-LoopBack0]q

R2的IP以及环回的配置

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname R2
[R2]inter	
[R2]interface g 0/0/0 
[R2-GigabitEthernet0/0/0]ip add	
[R2-GigabitEthernet0/0/0]ip address 25.1.1.1 24
[R2-GigabitEthernet0/0/0]
Jan 14 2024 23:49:33-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]q
[R2]inter	
[R2]interface loop	
[R2]interface LoopBack 0
[R2-LoopBack0]ip add	
[R2-LoopBack0]ip address 2.2.2.2 32
[R2-LoopBack0]q
[R2]inter	
[R2]interface g0/0/1
[R2-GigabitEthernet0/0/1]ip add	
[R2-GigabitEthernet0/0/1]ip address 26.1.1.1 24
Jan 14 2024 23:55:03-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

R3的IP以及环回的配置

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname R3
[R3]inter	
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip ad	
[R3-GigabitEthernet0/0/1]ip address 35.1.1.1 24
[R3-GigabitEthernet0/0/1]
Jan 14 2024 23:51:16-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R3-GigabitEthernet0/0/1]q
[R3]inter	
[R3]interface loop	
[R3]interface LoopBack 0
[R3-LoopBack0]ip add	
[R3-LoopBack0]ip address 3.3.3.3 32
[R3-LoopBack0]q
[R3]inter	
[R3]interface g0/0/0
[R3-GigabitEthernet0/0/0]ip add	
[R3-GigabitEthernet0/0/0]ip address 38.1.1.1 24
Jan 14 2024 23:55:54-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]q

R4的IP以及环回的配置

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname R4
[R4]inter	
[R4]interface g0/0/1
[R4-GigabitEthernet0/0/1]ip ad	
[R4-GigabitEthernet0/0/1]ip address 45.1.1.1 24
[R4-GigabitEthernet0/0/1]
Jan 14 2024 23:53:27-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]q
[R4]inter	
[R4]interface loop	
[R4]interface LoopBack 0
[R4-LoopBack0]ip ad	
[R4-LoopBack0]ip address 4.4.4.4 32
[R4-LoopBack0]q
[R4]inter	
[R4]interface g0/0/0
[R4-GigabitEthernet0/0/0]ip add	
[R4-GigabitEthernet0/0/0]ip address 47.1.1.1 24
Jan 14 2024 23:56:57-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R4-GigabitEthernet0/0/0]q

R5的IP以及环回的配置

[Huawei]sysname R5
[R5]inter	
[R5]interface g0/0/0
[R5-GigabitEthernet0/0/0]ip add	
[R5-GigabitEthernet0/0/0]ip address 15.1.1.2 24
Jan 14 2024 23:58:08-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]q
[R5]inter	
[R5]interface g0/0/1
[R5-GigabitEthernet0/0/1]ip adfd	
[R5-GigabitEthernet0/0/1]ip add	
[R5-GigabitEthernet0/0/1]ip address 25.1.1.2 24
Jan 14 2024 23:58:45-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
[R5]inter	
[R5]interface g0/0/2
[R5-GigabitEthernet0/0/2]ip add	
[R5-GigabitEthernet0/0/2]ip address 35.1.1.2 24
Jan 14 2024 23:59:19-08:00 R5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R5-GigabitEthernet0/0/2]q
[R5]inter	
[R5]interface g4/0/0
[R5-GigabitEthernet4/0/0]ip add	
[R5-GigabitEthernet4/0/0]ip address 45.1.1.2 24
Jan 15 2024 00:00:00-08:00 R5 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet4/0/0 has entered the UP state. 
[R5-GigabitEthernet4/0/0]q
[R5]intewwr	
[R5]inter	
[R5]interface loop	
[R5]interface LoopBack 0
[R5-LoopBack0]ip add	
[R5-LoopBack0]ip address 5.5.5.5 32

R6的IP以及环回的配置

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]syx	
[Huawei]sys	
[Huawei]sysname R6
[R6]inte	
[R6]interface g0/0/0
[R6-GigabitEthernet0/0/0]ip ad	
[R6-GigabitEthernet0/0/0]ip address 26.1.1.2 24
[R6-GigabitEthernet0/0/0]
Jan 15 2024 00:02:03-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]q
[R6]inter	
[R6]interface loop	
[R6]interface LoopBack 0
[R6-LoopBack0]ip add	
[R6-LoopBack0]ip address 6.6.6.6 32
[R6-LoopBack0]q

R7的IP以及环回的配置

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname R7
[R7]inte	
[R7]interface g0/0/0
[R7-GigabitEthernet0/0/0]ip add	
[R7-GigabitEthernet0/0/0]ip address 47.1.1.2 24
Jan 15 2024 00:04:13-08:00 R7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R7-GigabitEthernet0/0/0]q
[R7]inter	
[R7]interface loo	
[R7]interface LoopBack 0
[R7-LoopBack0]ip add	
[R7-LoopBack0]ip address 7.7.7.7
                                 ^
Error:Incomplete command found at '^' position.
[R7-LoopBack0]ip address 7.7.7.7 32
[R7-LoopBack0]q

R8的IP以及环回的配置

system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sys	
[Huawei]sysname R8
[R8]inter	
[R8]interface g0/0/0
[R8-GigabitEthernet0/0/0]ip add	
[R8-GigabitEthernet0/0/0]ip address 38.1.1.2 24
[R8-GigabitEthernet0/0/0]
Jan 15 2024 00:05:53-08:00 R8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R8-GigabitEthernet0/0/0]q
[R8]inte	
[R8]interface loop	
[R8]interface LoopBack 0
[R8-LoopBack0]ip add	
[R8-LoopBack0]ip address 8.8.8.8 32

 在R1上写ospf

[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]ar	
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]q

在R2上写ospf  并且宣告

[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]are	
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]net	
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]net	
[R2-ospf-1-area-0.0.0.1]network 26.1.1.1 0.0.0.0

在R3上写ospf 并且宣告

[R3]ospf 1 router-id 3.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 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]q
[R3-ospf-1]are	
[R3-ospf-1]area 2
[R3-ospf-1-area-0.0.0.2]net	
[R3-ospf-1-area-0.0.0.2]network 38.1.1.1 0.0.0.0

在R8上写ospf 并且宣告

[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]ar	
[R8-ospf-1]area 2
[R8-ospf-1-area-0.0.0.2]net	
[R8-ospf-1-area-0.0.0.2]network 0.0.0.0 255.255.255.255

在R7上写ospf 并且宣告

[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]are	
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]net	
[R7-ospf-1-area-0.0.0.3]network 0.0.0.0 255.255.255.255

接下来咱们就是建立隧道

分别在R1 R2 R3 R4上面
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]tu	
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp
[R1-Tunnel0/0/0]so	
[R1-Tunnel0/0/0]source 15.1.1.1
[R1-Tunnel0/0/0]nhrp en	
[R1-Tunnel0/0/0]nhrp entry mu	
[R1-Tunnel0/0/0]nhrp entry multicast dy	
[R1-Tunnel0/0/0]nhrp entry multicast dynamic 
[R1-Tunnel0/0/0]nh	
[R1-Tunnel0/0/0]nhrp ne	
[R1-Tunnel0/0/0]nhrp network-id 10
[R1-Tunnel0/0/0]ip add	
[R1-Tunnel0/0/0]ip address  10.1.1.1 24
Jan 15 2024 01:02: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. 
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]tu	
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp
[R2-Tunnel0/0/0]so	
[R2-Tunnel0/0/0]source 25.1.1.1
[R2-Tunnel0/0/0]nh	
[R2-Tunnel0/0/0]nhrp en	
[R2-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 re	
[R2-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 register 
[R2-Tunnel0/0/0]nh	
[R2-Tunnel0/0/0]nhrp net	
[R2-Tunnel0/0/0]nhrp network-id 10
[R2-Tunnel0/0/0]ip ad	
[R2-Tunnel0/0/0]ip address 10.1.1.2 24
Jan 15 2024 01:09:03-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]tu	
[R3-Tunnel0/0/0]tunnel-protocol gre p2	
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R3-Tunnel0/0/0]so	
[R3-Tunnel0/0/0]source 35.1.1.1
[R3-Tunnel0/0/0]nh	
[R3-Tunnel0/0/0]nhrp en	
[R3-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 re	
[R3-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 register 
[R3-Tunnel0/0/0]nh	
[R3-Tunnel0/0/0]nhrp net	
[R3-Tunnel0/0/0]nhrp network-id 10
[R3-Tunnel0/0/0]ip add	
[R3-Tunnel0/0/0]ip address 10.1.1.3 24
[R3-Tunnel0/0/0]
Jan 15 2024 01:12:00-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[R4]interface Tunnel 0/0/0
[R4-Tunnel0/0/0]tu	
[R4-Tunnel0/0/0]tunnel-protocol gre	
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp
[R4-Tunnel0/0/0]so	
[R4-Tunnel0/0/0]source 45.1.1.1
[R4-Tunnel0/0/0]nh	
[R4-Tunnel0/0/0]nhrp en	
[R4-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 re	
[R4-Tunnel0/0/0]nhrp entry 10.1.1.1 15.1.1.1 register 
[R4-Tunnel0/0/0]nhr	
[R4-Tunnel0/0/0]nhrp  net	
[R4-Tunnel0/0/0]nhrp  network-id 10
[R4-Tunnel0/0/0]ip add	
[R4-Tunnel0/0/0]ip address 10.1.1.4 24
[R4-Tunnel0/0/0]
Jan 15 2024 01:14:54-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 

为了简单一点 我就直接写缺省了

还是分别在R1 R2 R3 R4上面
[R1]ip route-static 0.0.0.0 0 15.1.1.2
[R2]ip route-static 0.0.0.0 0 25.1.1.2
[R3]ip route-static 0.0.0.0 0 35.1.1.2
[R4]ip route-static 0.0.0.0 0 45.1.1.2

应该还要宣告

还是在R1 R2 R3 R4上面
[R1]ospf 1
[R1-ospf-1]are	
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net	
[R1-ospf-1-area-0.0.0.0]network 10.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]q
[R1-ospf-1]q
[R1]inte	
[R1]interface tu	
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]osp	
[R1-Tunnel0/0/0]ospf ne	
[R1-Tunnel0/0/0]ospf network-type  b	
[R1-Tunnel0/0/0]ospf network-type  broadcast 
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]net	
[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]q
[R2-ospf-1]q
[R2]int	
[R2]interface tu	
[R2]interface Tunnel 0/0/0
[R2-Tunnel0/0/0]osp	
[R2-Tunnel0/0/0]ospf net	
[R2-Tunnel0/0/0]ospf network-type br	
[R2-Tunnel0/0/0]ospf network-type broadcast
[R3]ospf 1
[R3-ospf-1]are	
[R3-ospf-1]area  0
[R3-ospf-1-area-0.0.0.0]net	
[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]q
[R3-ospf-1]q
[R3]inter	
[R3]interface tu	
[R3]interface Tunnel 0/0/0
[R3-Tunnel0/0/0]os	
[R3-Tunnel0/0/0]ospf ne	
[R3-Tunnel0/0/0]ospf network-type  b	
[R3-Tunnel0/0/0]ospf network-type  broadcast 
[R4]ospf 1
[R4-ospf-1]are	
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]net	
[R4-ospf-1-area-0.0.0.0]network 10.1.1.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]q
[R4-ospf-1]q
[R4]interface tu0/0/0
[R4-Tunnel0/0/0]osp	
[R4-Tunnel0/0/0]ospf ne	
[R4-Tunnel0/0/0]ospf network-type bro	
[R4-Tunnel0/0/0]ospf network-type broadcast 

至此 试验结束。

你可能感兴趣的:(网络)