HCIP ospf实验2

1.先配ip   2.R1-R5写缺省路由

[R1]int loop 0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1]int g 0/0/0             
[R1-GigabitEthernet0/0/0]ip add 16.0.0.1 24
[R2]int loop 0
[R2-LoopBack0]ip add 2.2.2.2 24
[R2-LoopBack0]q
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 26.0.0.1 24
[R3]int loop 0
[R3-LoopBack0]ip add 3.3.3.3 24
[R3-LoopBack0]int g 0/0/0 
[R3-GigabitEthernet0/0/0]ip add 36.0.0.1 24
[R4]int loop 0
[R4-LoopBack0]ip add 4.4.4.4 24
[R4-LoopBack0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 46.0.0.1 24
[R5]int loop 0
[R5-LoopBack0]ip add 5.5.5.5 24
[R5-LoopBack0]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip add 56.0.0.1 24
[R6]int loop 0
[R6-LoopBack0]ip add 6.6.6.6 24
[R6-LoopBack0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 16.0.0.2 24
Jul  9 2021 13:07:09-08:00 R6 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R6-GigabitEthernet0/0/1]int g 0/0/2 
[R6-GigabitEthernet0/0/2]ip add 26.0.0.2 24
[R6-GigabitEthernet0/0/2]
Jul  9 2021 13:07:23-08:00 R6 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R6-GigabitEthernet0/0/2]int g1/0/0
[R6-GigabitEthernet1/0/0]ip add 36.0.0.2 24
[R6-GigabitEthernet1/0/0]
Jul  9 2021 13:07:42-08:00 R6 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP on the interface GigabitEthernet1/0/0 has entered the UP state. 
[R6-GigabitEthernet1/0/0]int g 2/0/0  
[R6-GigabitEthernet2/0/0]ip add 46.0.0.2 24
[R6-GigabitEthernet2/0/0]
Jul  9 2021 13:08:02-08:00 R6 %%01IFNET/4/LINK_STATE(l)[7]:The line protocol IP on the interface GigabitEthernet2/0/0 has entered the UP state. 
[R6-GigabitEthernet2/0/0]int g 3/0/0
[R6-GigabitEthernet3/0/0]ip add 56.0.0.2 24
[R1]ip route-static 0.0.0.0 0 16.0.0.2

全配完后ping 6.6.6.6 检查是否能上外网

[R1]ping 6.6.6.6
  PING 6.6.6.6: 56  data bytes, press CTRL_C to break
    Reply from 6.6.6.6: bytes=56 Sequence=1 ttl=255 time=70 ms
    Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 6.6.6.6 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/34/70 ms

R1/2/3星形拓扑,R1为中心站点

R1:

[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tun
[R1-Tunnel0/0/0]tunnel-protocol gre?
  gre  Generic Routing Encapsulation
[R1-Tunnel0/0/0]tunnel-protocol gre p2
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R1-Tunnel0/0/0]sou
[R1-Tunnel0/0/0]source 16.0.0.1   
Jul  9 2021 13:19:15-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state. 
[R1-Tunnel0/0/0]
[R1-Tunnel0/0/0]nhr
[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]nhrp
[R1-Tunnel0/0/0]nhrp ne
[R1-Tunnel0/0/0]nhrp network-id 100

R2

[R2]int tu
[R2]int Tunnel 0/0/0  
[R2-Tunnel0/0/0]ip add 10.1.1.2 24
[R2-Tunnel0/0/0]tun
[R2-Tunnel0/0/0]tunnel-protocol gre
[R2-Tunnel0/0/0]tunnel-protocol gre p2
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R2-Tunnel0/0/0]souc
[R2-Tunnel0/0/0]sou 
[R2-Tunnel0/0/0]source  g 0/0/0
Jul  9 2021 13:21:10-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state. 
[R2-Tunnel0/0/0]
[R2-Tunnel0/0/0]nhr
[R2-Tunnel0/0/0]nhrp en
[R2-Tunnel0/0/0]nhrp entry 10.1.1.1 16.0.0.1 re
[R2-Tunnel0/0/0]nhrp entry 10.1.1.1 16.0.0.1 register 
[R2-Tunnel0/0/0]nhrp
[R2-Tunnel0/0/0]nhrp ne
[R2-Tunnel0/0/0]nhrp network-id 100

R3

[R3]int tun
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ip add 10.1.1.3 24
[R3-Tunnel0/0/0]tun
[R3-Tunnel0/0/0]tunnel-protocol gre p2
[R3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R3-Tunnel0/0/0]souc
[R3-Tunnel0/0/0]sour
[R3-Tunnel0/0/0]source g0/0/0
Jul  9 2021 13:22:49-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-Tunnel0/0/0]
[R3-Tunnel0/0/0]nhrp
[R3-Tunnel0/0/0]nhrp en
[R3-Tunnel0/0/0]nhrp entry 10.1.1.1 16.0.0.1 re
[R3-Tunnel0/0/0]nhrp entry 10.1.1.1 16.0.0.1 register 
[R3-Tunnel0/0/0]nhrp
[R3-Tunnel0/0/0]nhrp ne
[R3-Tunnel0/0/0]nhrp network-id 100

检验:

[R1-Tunnel0/0/0]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=30 ms
    Reply from 10.1.1.3: bytes=56 Sequence=2 ttl=255 time=20 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=30 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/26/30 ms

R1/4/5为全连MGRE:

全连的时候每个路由器都要向其它两个注册,即每个都是中心站点,且R1/4/5这个虚拟网段要用不同于R1/2/3的网段

R1

[R1]int t
[R1]int Tunnel 0/0/1
[R1-Tunnel0/0/1]nhrp
[R1-Tunnel0/0/1]nhrp en
[R1-Tunnel0/0/1]nhrp entry 10.1.2.4 46.0.0.1 dy
[R1-Tunnel0/0/1]nhrp entry 10.1.2.4 46.0.0.1 d 
[R1-Tunnel0/0/1]nhrp entry 10.1.2.4 46.0.0.1 re
[R1-Tunnel0/0/1]nhrp entry 10.1.2.4 46.0.0.1 register 
[R1-Tunnel0/0/1]nhrp
[R1-Tunnel0/0/1]nhrp en
[R1-Tunnel0/0/1]nhrp entry 10.1.2.5
[R1-Tunnel0/0/1]undo nhrp entry 10.1.2.5
[R1-Tunnel0/0/1]nhrp entry 10.1.2.4 46.0.0.1 register
Info: Peer entry exists already. 
[R1-Tunnel0/0/1]nhrp entry 10.1.2.5 56.0.0.1 re      
[R1-Tunnel0/0/1]nhrp entry 10.1.2.5 56.0.0.1 register 

R4

[R4]int t
[R4]int Tunnel 0/0/0
[R4-Tunnel0/0/0]ip add 10.1.2.4 24
[R4-Tunnel0/0/0]tun
[R4-Tunnel0/0/0]tunnel-protocol gre
[R4-Tunnel0/0/0]tunnel-protocol gre p2,
[R4-Tunnel0/0/0]tunnel-protocol gre p  
[R4-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R4-Tunnel0/0/0]nhrp
[R4-Tunnel0/0/0]nhrp en
[R4-Tunnel0/0/0]nhrp entry m
[R4-Tunnel0/0/0]nhrp entry multicast d
[R4-Tunnel0/0/0]nhrp entry multicast dynamic 
[R4-Tunnel0/0/0]nhrp ne
[R4-Tunnel0/0/0]nhrp network-id 100
[R4-Tunnel0/0/0]sou
[R4-Tunnel0/0/0]source 46.0.0.1
Jul  9 2021 15:24:39-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 en
[R4-Tunnel0/0/0]nhrp entry 10.1.2.4 46.0.0.1 re
[R4-Tunnel0/0/0]nhrp entry 10.1.2.4 46.0.0.1 register 
Error: This peer nbma address is same with tunnel source address. 
[R4-Tunnel0/0/0]nhrp entry 10.1.2.1 61.0.0.1 re      
[R4-Tunnel0/0/0]nhrp entry 10.1.2.1 61.0.0.1 register 
Info: This peer protocol address conflicts with hub register peer protocol address. 
[R4-Tunnel0/0/0]nhrp
[R4-Tunnel0/0/0]nhrp en
[R4-Tunnel0/0/0]nhrp entry 10.1.2.5 56.0.0.1 re
[R4-Tunnel0/0/0]nhrp entry 10.1.2.5 56.0.0.1 register 

R5

[R5]int t
[R5]int Tunnel 0/0/0
[R5-Tunnel0/0/0]ip add 10.1.2.5 24
[R5-Tunnel0/0/0]tun
[R5-Tunnel0/0/0]tunnel-protocol gre p2
[R5-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R5-Tunnel0/0/0]nhrp
[R5-Tunnel0/0/0]nhrp  en
[R5-Tunnel0/0/0]nhrp  entry m
[R5-Tunnel0/0/0]nhrp  entry multicast d
[R5-Tunnel0/0/0]nhrp  entry multicast dynamic 
[R5-Tunnel0/0/0]souc
[R5-Tunnel0/0/0]sou 
[R5-Tunnel0/0/0]source 56.0.0.1
Jul  9 2021 15:27:17-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
[R5-Tunnel0/0/0]nhrp ne
[R5-Tunnel0/0/0]nhrp network-id 100
[R5-Tunnel0/0/0]nhrp en
[R5-Tunnel0/0/0]nhrp entry 10.1.2.1 61.0.0.1
Info: Static peer protocol address conflicts with hub register peer protocol address.
[R5-Tunnel0/0/0]nhrp en
[R5-Tunnel0/0/0]nhrp entry 10.1.2.4 46.0.0.1

私网基于ospf全网通

首先此时的拓扑结构不再是以前的物理拓扑而是逻辑拓扑,其次OSPF协议在Tunnel接口默认的工作方式为点到点,该方式只能建立一个邻居关系;故MGRE中运行OSPF协议,默认只能产生一个关系,无法全网沟通

解决方案:修改接口工作方式

[r1]interface Tunnel 0/0/0

 [r1-Tunnel0/0/0]ospf network-type ?

  broadcast  Specify OSPF broadcast network

  nbma       Specify OSPF NBMA network

  p2mp       Specify OSPF point-to-multipoint network

  p2p        Specify OSPF point-to-point network

 [r1-Tunnel0/0/0]ospf network-type broadcast  修改为广播型

切记:tunnel接口默认的点到点工作方式与人为修改的broadcast工作方式使用了相同的hello time,将导致p2p与broadcast接口相遇时邻居关系正常建立;但p2p不支持DR选举,最终无法正常沟通LSA信息;所以要求一个网段内所有接口的工作方式必须完全一致

此时再把R2 R3 接口优先级配置0,放弃选举让R1为dr;而R1/4/5为全连结构,不需要配置优先级便可选举

R1

[R1]int t
[R1]int Tunnel 0/0/0
[R1-Tunnel0/0/0]ospf 1 rou
[R1-Tunnel0/0/0]ospf 1 rout
[R1-Tunnel0/0/0]q          
[R1]ospf 1 rou
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]net
[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]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]net
[R1-ospf-1-area-0.0.0.0]network 10.1.2.1 0.0.0.0
[R1]int t
[R1]int Tunnel 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 

R2

[R2]ospf 1rou
[R2]ospf 1 rou
[R2]ospf 1 router-id 2.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 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]netw
[R2-ospf-1-area-0.0.0.0]network 10.1.1.2 0.0.0.0
[R2]int t
[R2]int Tunnel 0/0/0
[R2-Tunnel0/0/0]ospf net
[R2-Tunnel0/0/0]ospf network-type b
[R2-Tunnel0/0/0]ospf network-type broadcast 
[R2-Tunnel0/0/0]ospf d
[R2-Tunnel0/0/0]ospf dr-priority 0

R3

 

[R3]ospf 1 rou
[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]net
[R3-ospf-1-area-0.0.0.0]network 10.1.1.3 0.0.0.0
[R3]int t 
[R3]int Tunnel 0/0/0
[R3-Tunnel0/0/0]ospf net
[R3-Tunnel0/0/0]ospf network-type br
[R3-Tunnel0/0/0]ospf network-type broadcast 
[R3-Tunnel0/0/0]ospf d
[R3-Tunnel0/0/0]ospf dr-priority 0

R4

[R4]ospf 1 rou
[R4]ospf 1 router-id 4.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 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]net
[R4-ospf-1-area-0.0.0.0]network 10.1.2.4 0.0.0.0
[R4]int t 0/0/0
[R4-Tunnel0/0/0]ospf net
[R4-Tunnel0/0/0]ospf network-type b
[R4-Tunnel0/0/0]ospf network-type broadcast 

R5

[R5]ospf 1 rou
[R5]ospf 1 router-id 5.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 5.5.5.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]net
[R5-ospf-1-area-0.0.0.0]network 10.1.2.5 0.0.0.0
[R5-Tunnel0/0/0]ospf 
[R5-Tunnel0/0/0]ospf net
[R5-Tunnel0/0/0]ospf network-type b
[R5-Tunnel0/0/0]ospf network-type broadcast 

此时就全网通了

[R2]ping 10.1.2.5
  PING 10.1.2.5: 56  data bytes, press CTRL_C to break
    Reply from 10.1.2.5: bytes=56 Sequence=1 ttl=254 time=60 ms
    Reply from 10.1.2.5: bytes=56 Sequence=2 ttl=254 time=50 ms
    Reply from 10.1.2.5: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 10.1.2.5: bytes=56 Sequence=4 ttl=254 time=40 ms
    Reply from 10.1.2.5: bytes=56 Sequence=5 ttl=254 time=50 ms

  --- 10.1.2.5 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/48/60 ms
[R4-Tunnel0/0/0]ping 10.1.2.5
  PING 10.1.2.5: 56  data bytes, press CTRL_C to break
    Reply from 10.1.2.5: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 10.1.2.5: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 10.1.2.5: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 10.1.2.5: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 10.1.2.5: bytes=56 Sequence=5 ttl=255 time=40 ms

  --- 10.1.2.5 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 30/32/40 ms

[R4-Tunnel0/0/0]ping 10.1.1.1
  PING 10.1.1.1: 56  data bytes, press CTRL_C to break
    Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms

  --- 10.1.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/26/40 ms

[R4-Tunnel0/0/0]ping 6.6.6.6
  PING 6.6.6.6: 56  data bytes, press CTRL_C to break
    Reply from 6.6.6.6: bytes=56 Sequence=1 ttl=255 time=20 ms
    Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=255 time=40 ms
    Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=255 time=20 ms
    Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=255 time=20 ms

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿巴阿巴巴bbb

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值