MGRE环境下的OSPF实验

目录

MGRE环境下的OSPF实验

实验图

基本思路

基本配置

写路由缺省使得公网可以ping通

制定R1/2/3为星型拓扑结构

测试

 R1/4/5全连MGRE结构中心站点为R1

 私有网段使用OSPF配置


MGRE环境下的OSPF实验

实验图

基本思路

R1 0/0/0接口为16.0.0.1 / 24

              0/0/1接口为161.0.0.1 / 24

               环回地址:192.168.1.1 / 24

R2 0/0/0接口为26.0.0.1 / 24

           回环地址为192.168.2.1 / 24

R3 0/0/0接口为36.0.0.1 / 24

           回环地址为192.168.3.1 / 24

R4 0/0/0接口为46.0.0.1 / 24

           回环地址为192.168.4.1 / 24

R5 0/0/0接口为56.0.0.1 / 24

           回环地址为192.168.5.1 / 24

R6 0/0/0接口为16.0.0.2 / 24

      0/0/1接口为161.0.0.2 / 24

      2/0/0接口为26.0.0.2 / 24

      3/0/0接口为36.0.0.2 / 24

      4/0/0接口为46.0.0.2 / 24

      0/0/2接口为56.0.0.2 / 24

基本配置

R1

[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add	
[R1-GigabitEthernet0/0/0]ip address 16.0.0.1 24
Sep 23 2022 14:24:40-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 g 0/0/1
[R1-GigabitEthernet0/0/1]ip add	
[R1-GigabitEthernet0/0/1]ip address 161.0.0.1 24
Sep 23 2022 14:25:47-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]q
[R1]
[R1]int LoopBack 0
[R1-LoopBack0]ip add	
[R1-LoopBack0]ip address 192.168.1.1 24

R2

[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add	
[R2-GigabitEthernet0/0/0]ip address 26.0.0.1 24
Sep 23 2022 14:26:36-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 loop 0
[R2-LoopBack0]ip add	
[R2-LoopBack0]ip address 192.168.2.1 24

R3

[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add	
[R3-GigabitEthernet0/0/0]ip address 36.0.0.1 24
Sep 23 2022 14:30:37-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]int loop 0
[R3-LoopBack0]ip ad	
[R3-LoopBack0]ip address 192.168.3.1 24

R4

[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add	
[R4-GigabitEthernet0/0/0]ip address 46.0.0.1 24
Sep 23 2022 14:31:14-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]int loop 0
[R4-LoopBack0]ip ad	
[R4-LoopBack0]ip address 192.168.4.1 24
[R4-LoopBack0]

R5

[R5]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip ad	
[R5-GigabitEthernet0/0/0]ip address 56.0.0.1 24
Sep 23 2022 14:31:55-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 loop 0
[R5-LoopBack0]ip add	
[R5-LoopBack0]ip address 192.168.5.1 24
[R5-LoopBack0]

R6

[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip ad	
[R6-GigabitEthernet0/0/0]ip address 16.0.0.2 24
Sep 23 2022 14:33:46-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 g 0/0/1
[R6-GigabitEthernet0/0/1]ip add	
[R6-GigabitEthernet0/0/1]ip address 161.0.0.2 24
[R6-GigabitEthernet0/0/1]
Sep 23 2022 14:33:58-08:00 R6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R6-GigabitEthernet0/0/1]int g 2/0/0
[R6-GigabitEthernet2/0/0]ip add	
[R6-GigabitEthernet2/0/0]ip address 26.0.0.2 24
[R6-GigabitEthernet2/0/0]
Sep 23 2022 14:34:16-08:00 R6 %%01IFNET/4/LINK_STATE(l)[2]: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	
[R6-GigabitEthernet3/0/0]ip address 36.0.0.2 24
[R6-GigabitEthernet3/0/0]
Sep 23 2022 14:34:31-08:00 R6 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet3/0/0 has entered the UP state. 
[R6-GigabitEthernet3/0/0]int g 4/0/0
[R6-GigabitEthernet4/0/0]ip add	
[R6-GigabitEthernet4/0/0]ip address 46.0.0.2 24
[R6-GigabitEthernet4/0/0]
Sep 23 2022 14:34:53-08:00 R6 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP 
on the interface GigabitEthernet4/0/0 has entered the UP state. 
[R6-GigabitEthernet4/0/0]int g 0/0/2
[R6-GigabitEthernet0/0/2]ip add	
[R6-GigabitEthernet0/0/2]ip address 56.0.0.2 24
[R6-GigabitEthernet0/0/2]
Sep 23 2022 14:35:03-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]

写路由缺省使得公网可以ping通

R1

[R1]ip route-static 0.0.0.0 0 16.0.0.2
[R1]ip ro	
[R1]ip route-s	
[R1]ip route-static 0.0.0.0 0 161.0.0.2
[R1]

R2

[R2]ip ro	
[R2]ip route-s	
[R2]ip route-static 0.0.0.0 0 26.0.0.2 
[R2]

注意:R3,R4,R5配置相同

制定R1/2/3为星型拓扑结构

私有网段:7.0网段

 R1

1.配置地址
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip add	
[R1-Tunnel0/0/0]ip address 192.168.7.1 24
[R1-Tunnel0/0/0]
2.定义封装接口
[R1-Tunnel0/0/0]tu	
[R1-Tunnel0/0/0]tunnel-protocol g	
[R1-Tunnel0/0/0]tunnel-protocol gre p	
[R1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R1-Tunnel0/0/0]
3.定义封装内容
[R1-Tunnel0/0/0]so	
[R1-Tunnel0/0/0]source ?
  Ethernet         Ethernet interface
  GigabitEthernet  GigabitEthernet interface
  LoopBack         LoopBack interface
  NULL             NULL interface
  Tunnel           Tunnel interface
  X.X.X.X          IP address
  vpn-instance     Specify the vpn instance of the source
[R1-Tunnel0/0/0]source 16.0.0.1
Sep 23 2022 14:50:18-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]
4.创建nhrp域
[R1-Tunnel0/0/0]nh	
[R1-Tunnel0/0/0]nhrp ?
  authentication  Configure the authentication string for an interface using the
                  NHRP
  entry           NHRP mapping
  network-id      NHRP network id 
  redirect        Configure Next Hop Resolution Protocol (NHRP) redirect
  registration    Register
  shortcut        Configure NHRP shortcut information 
[R1-Tunnel0/0/0]nhrp net	
[R1-Tunnel0/0/0]nhrp network-id 100
[R1-Tunnel0/0/0]
5.开启伪广播当做中心站点
[R1-Tunnel0/0/0]nhr	
[R1-Tunnel0/0/0]nhrp en	
[R1-Tunnel0/0/0]nhrp entry ?
  IP_ADDR<X.X.X.X>  IP address
  holdtime          NHRP entry holdtime 
  multicast         IP multicast
[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]

R2

[R2]int t 0/0/0
[R2-Tunnel0/0/0]ip add	
[R2-Tunnel0/0/0]ip address 192.168.7.2 24
[R2-Tunnel0/0/0]tu	
[R2-Tunnel0/0/0]tunnel-protocol nh	
[R2-Tunnel0/0/0]tunnel-protocol ?
  gre        Generic Routing Encapsulation
  ipsec      IPSEC Encapsulation
  ipv4-ipv6  IP over IPv6 encapsulation
  ipv6-ipv4  IPv6 over IP encapsulation
  mpls       MPLS Encapsulation
  none       Null Encapsulation
[R2-Tunnel0/0/0]tunnel-protocol gr	
[R2-Tunnel0/0/0]tunnel-protocol gre p	
[R2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[R2-Tunnel0/0/0]
配置初接口
[R2-Tunnel0/0/0]sou	
[R2-Tunnel0/0/0]source ?
  Ethernet         Ethernet interface
  GigabitEthernet  GigabitEthernet interface
  LoopBack         LoopBack interface
  NULL             NULL interface
  Tunnel           Tunnel interface
  X.X.X.X          IP address
  vpn-instance     Specify the vpn instance of the source
[R2-Tunnel0/0/0]source g	
[R2-Tunnel0/0/0]source GigabitEthernet 0/0/0
Sep 23 2022 14:53:44-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 192.168.7.1 16.0.0.1 re	
[R2-Tunnel0/0/0]nhrp entry 192.168.7.1 16.0.0.1 register 
[R2-Tunnel0/0/0]
[R2-Tunnel0/0/0]nhrp network-id 100
[R2-Tunnel0/0/0]

注意:R3与R2配置类似

测试

[R1]dis	
[R1]display nhrp	
[R1]display nhrp ?
  peer        Peer
  statistics  NHRP statistics information 
[R1]display nhrp pee	
[R1]display nhrp peer ?
  IP_ADDR<X.X.X.X>  IP address
  all               All 
  dynamic           Allow NHRP to automatically add routers to the multicast    
                    NHRP mappings 
  interface         Interface information 
  static            Static
[R1]display nhrp peer a	
[R1]display nhrp peer all 
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.7.2     32    26.0.0.1        192.168.7.2     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:05:19
Expire time     : 01:54:41
------------------------------------------------------------------------------- 
Protocol-addr   Mask  NBMA-addr       NextHop-addr    Type         Flag         
------------------------------------------------------------------------------- 
192.168.7.3     32    36.0.0.1        192.168.7.3     dynamic      route tunnel 
------------------------------------------------------------------------------- 
Tunnel interface: Tunnel0/0/0
Created time    : 00:00:59
Expire time     : 01:59:01

Number of nhrp peers: 2
[R1]

 说明中心到站点的MGRE环境配置完成

 R1/4/5全连MGRE结构中心站点为R1

网段信息:为6.0网段

 R1

[R1]int t 0/0/1
[R1-Tunnel0/0/1]ip add	
[R1-Tunnel0/0/1]ip address 192.168.6.1 24
[R1-Tunnel0/0/1]
[R1-Tunnel0/0/1]tu	
[R1-Tunnel0/0/1]tunnel-protocol gr	
[R1-Tunnel0/0/1]tunnel-protocol gre p	
[R1-Tunnel0/0/1]tunnel-protocol gre p2mp 
[R1-Tunnel0/0/1]so	
[R1-Tunnel0/0/1]source 161.0.0.1
Sep 23 2022 15:03:00-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface Tunnel0/0/1 has entered the UP state. 
[R1-Tunnel0/0/1]
[R1-Tunnel0/0/1]nhrp	
[R1-Tunnel0/0/1]nhrp ?
  authentication  Configure the authentication string for an interface using the
                  NHRP
  entry           NHRP mapping
  network-id      NHRP network id 
  redirect        Configure Next Hop Resolution Protocol (NHRP) redirect
  registration    Register
  shortcut        Configure NHRP shortcut information 
[R1-Tunnel0/0/1]nhrp ne	
[R1-Tunnel0/0/1]nhrp network-id 110
开启伪广播设置R1为中心站点
[R1-Tunnel0/0/1]nhr	
[R1-Tunnel0/0/1]nhrp en	
[R1-Tunnel0/0/1]nhrp entry m	
[R1-Tunnel0/0/1]nhrp entry multicast dy	
[R1-Tunnel0/0/1]nhrp entry multicast dynamic 
[R1-Tunnel0/0/1]

注意:R4,R5配置与R1类似

 私有网段使用OSPF配置

R1

[R1]ospf 1 r	
[R1]ospf 1 router-id 1.1.1.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 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]ne	
[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]ne	
[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]

R2

[R2]ospf ro	
[R2]ospf router-id 2.2.	
[R2]ospf router-id 2.2.2.2
[R2-ospf-1]a	
[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.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]net	
[R2-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255

注意:R3/4/5/6都类似

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
HCIP实验中的OSPF是指Open Shortest Path First,是一种内部网关协议(IGP),用于在自治系统(AS)内部进行路由选择。在HCIP实验中,OSPF的配置包括实验拓扑、子网划分、基本配置、MGRE环境配置、OSPF配置、路由汇总、特殊区域和NAT配置等。\[1\] 在实验中,可以使用OSPF多进程重发布的方式解决重发布问题。例如,在非骨干区域a4中,可以使用OSPF进程1和进程2进行重发布。R9的配置示例为: ospf 1 router-id 9.9.9.9 import-route ospf 2 area 0.0.0.3 network 172.16.136.2 0.0.0.0 ospf 2 router-id 9.9.9.9 asbr-summary 172.16.160.0 255.255.224.0 import-route ospf 1 area 0.0.0.4 network 172.16.160.1 0.0.0.0 network 172.16.168.1 0.0.0.0 \[2\] 另外,实验中还涉及到AREA2/3的完全NSSA配置。例如,在AREA2中,R6、R11和R12的配置示例为: R6: ospf 1 area 2 nssa no-summary R11: ospf 1 area 2 nssa R12: ospf 1 area 2 nssa \[3\] 此外,实验中还包括NAT配置。例如,R3、R6和R7的NAT配置示例为: R3: acl 2000 rule 5 permit source 172.16.0.0 0.0.255.255 int s3/0/0 nat outbound 2000 R6: acl 2000 rule 5 permit source 172.16.0.0 0.0.255.255 int s4/0/0 nat outbound 2000 R7: acl 2000 rule 5 permit source 172.16.0.0 0.0.255.255 int s4/0/1 nat outbound 2000 \[3\] 以上是关于HCIP实验OSPF的一些配置示例。 #### 引用[.reference_title] - *1* *2* *3* [HCIP——OSPF综合大实验](https://blog.csdn.net/After_GlowX/article/details/118708375)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

White乄joker

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

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

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

打赏作者

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

抵扣说明:

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

余额充值