HCIP实验:IBGP与EBGP题

实验目的:

1、掌握网络基础配置与IP编址:通过配置和编址,确保网络中的每个设备都有一个唯一的IP地址,这是网络通信的基础。

2、实施IGP配置:在给定的AS(自治系统)内部配置OSPF(开放最短路径优先)协议,实现内部网络的路由选择和信息交换。这是确保内部网络高效、可靠通信的关键。

3、建立IBGP和EBGP对等体关系:在公司的不同自治系统内部(IBGP)和之间(EBGP)建立对等体关系,以实现不同自治系统之间的路由信息交换。这是多自治系统网络中路由信息传递的核心。

4、配置BGP路由信息的传递:通过配置BGP的network命令,发布特定网络的路由信息,确保这些信息能够在整个网络中传递,并被正确地路由。

5、观察和验证BGP路由信息的传递:通过ping测试等方式,验证配置的正确性,确保网络中的设备能够相互通信,路由信息能够正确地传递。

拓扑图:

场景:

你是公司的网络管理员。公司的网络采用了BGP协议作为路由协议。公司的网络由多个自治系统组成,不同的分支机构使用了不同的AS号,现在你需要完成公司网络的搭建工作。在公司总部使用了OSPF作为IGP,公司内部不同分支机构使用的是私有的BGP AS号。在完成网络搭建以后,你还需要观察BGP路由信息的传递。

相关配置和步骤:

1、基础配置与IP编址
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int ser 1/0/0
[R1-Serial1/0/0]ip add 10.0.12.1 24
[R1-Serial1/0/0]int ser 3/0/0
[R1-Serial3/0/0]ip add 10.0.14.1 24
[R1-Serial3/0/0]int lo0
[R1-LoopBack0]ip add 10.0.1.1 32
[R1-LoopBack0]q

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int ser 1/0/0
[R2-Serial1/0/0]ip add 10.0.12.2 24
[R2-Serial1/0/0]int ser 2/0/0
[R2-Serial2/0/0]ip add 10.0.23.2 24
[R2-Serial2/0/0]int lo0
[R2-LoopBack0]ip add 10.0.2.2 32 
[R2-LoopBack0]q

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int ser 2/0/0
[R3-Serial2/0/0]ip add 10.0.23.3 24
[R3-Serial2/0/0]int ser 3/0/0
[R3-Serial3/0/0]ip add 10.0.35.3 24
[R3-Serial3/0/0]int lo0
[R3-LoopBack0]ip add 10.0.3.3 32
[R3-LoopBack0]q

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int ser 1/0/0
[R4-Serial1/0/0]ip add 10.0.14.4 24
[R4-Serial1/0/0]int lo0
[R4-LoopBack0]ip add 10.0.4.4 32
[R3-LoopBack0]q

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]int ser 1/0/0
[R5-Serial1/0/0]ip add 10.0.35.5 24
[R5-Serial1/0/0]int lo0
[R5-LoopBack0]ip add 10.0.5.5 32
[R5-LoopBack0]q
2、配置区域内IGP

在AS 64512 中使用OSPF作为IGP,将Loopback 0连接的网段发布进OSPF。

[R1]router id 10.0.1.1
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.0.12.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 10.0.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]quit

[R2]router id 10.0.2.2
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 10.0.12.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 10.0.23.2  0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]quit
[R2-ospf-1]quit

[R3]router id 10.0.3.3
[R3]ospf 1
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 10.0.23.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 10.0.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]quit
[R3-ospf-1]quit
3、建立 IBGP 对等体

在R1、R2、R3上配置IBGP全互联。使用Loopback0地址作为更新源。

[R1]bgp 64512
[R1-bgp]pe	
[R1-bgp]peer 10.0.2.2 as-n	
[R1-bgp]peer 10.0.2.2 as-number 64512
[R1-bgp]pe	
[R1-bgp]peer 10.0.2.2 con	
[R1-bgp]peer 10.0.2.2 connect-interface lo0
[R1-bgp]pe	
[R1-bgp]peer 10.0.3.3 as-n	
[R1-bgp]peer 10.0.3.3 as-number 64512
[R1-bgp]pe	
[R1-bgp]peer 10.0.3.3 con	
[R1-bgp]peer 10.0.3.3 connect-interface lo0
[R1-bgp]q

[R2]bgp 64512
[R2-bgp]pe	
[R2-bgp]peer 10.0.1.1 as-n	
[R2-bgp]peer 10.0.1.1 as-number 64512
[R2-bgp]pe	
[R2-bgp]peer 10.0.1.1 con	
[R2-bgp]peer 10.0.1.1 connect-interface lo0
[R2-bgp]pe	
[R2-bgp]peer 10.0.3.3 as-n	
[R2-bgp]peer 10.0.3.3 as-number 64512
[R2-bgp]pe	
[R2-bgp]peer 10.0.3.3 con	
[R2-bgp]peer 10.0.3.3 connect-interface lo0
[R2-bgp]q

[R3]bgp 64512
[R3-bgp]pe	
[R3-bgp]peer 10.0.1.1 as-n	
[R3-bgp]peer 10.0.1.1 as-number 64512
[R3-bgp]pe	
[R3-bgp]peer 10.0.1.1 con	
[R3-bgp]peer 10.0.1.1 connect-interface lo0
[R3-bgp]pe	
[R3-bgp]peer 10.0.2.2 as-n	
[R3-bgp]peer 10.0.2.2 as-number 64512
[R3-bgp]pe	
[R3-bgp]peer 10.0.2.2 con	
[R3-bgp]peer 10.0.2.2 connect-interface lo0
[R3-bgp]q

如果BGP后面的数字打错了可以这么改

[R1]bg	
[R1]bgp 65412
[R1]bgp 64512
Error: BGP is already running. The AS is 65412.
[R1]und	
[R1]undo bg	
[R1]undo bgp 65412
Warning: All BGP configurations will be deleted. Continue? [Y/N]: y
[R1]bgp 64512
4、配置EBGP对等体

4.1  在R4上配置BGP,本地AS号为64513,与R1建立EBGP对等体关系。在建立对等体关系时,指定更新源为Loopback 0接口的地址,并指定ebgp-max-hop为2。添加到对端Loopback 0接口地址的32位的静态路由,使之能正常建立对等体关系。

[R1]ip route-static 10.0.4.4 32 10.0.14.4

[R4]ip route-static 10.0.1.1 32 10.0.14.1

[R1]bgp 64512
[R1-bgp]peer 10.0.4.4 as-number 64513 
[R1-bgp]peer 10.0.4.4 ebgp-max-hop 2 
[R1-bgp]peer 10.0.4.4 connect-interface LoopBack0
[R1-bgp]q

[R4]router id 10.0.4.4
[R4]bgp 64513
[R4-bgp]peer 10.0.1.1 as-number 64512 
[R4-bgp]peer 10.0.1.1 ebgp-max-hop 2 
[R4-bgp]peer 10.0.1.1 connect-interface LoopBack0
[R4-bgp]q

4.2  在R3和R5之间也建立EBGP对等体关系。直接使用物理接口地址建立连接。

[R3]bgp 64512
[R3-bgp]peer 10.0.35.5 as-number 64514
[R3-bgp]q

[R5]router id 10.0.5.5
[R5]bgp 64514
[R5-bgp]peer 10.0.35.3 as-number 64512
[R5-bgp]q
5、使用Network命令发布路由信息

5.1  在R4上配置Loopback1,地址为10.1.4.4/24。使用network命令将该网段发布进BGP

[R4]interface Lo1
[R4-LoopBack1]ip address 10.1.4.4 24
[R4-LoopBack1]q
[R4]bgp 64513 
[R4-bgp]network 10.1.4.4 24
[R4-bgp]q

配完后,在R3的ip路由表上并没有发现10.1.4.4的路由
原因是这条路由的NextHop为10.0.4.4,而R3上并没有到达地址10.0.4.4的路由。根据BGP选路原则,当BGP路由的下一跳不可达时,忽略此路由。
所以要在R1上,将路由的下一跳更改为自己

[R1]bgp 64512
[R1-bgp]peer 10.0.3.3  next-hop-local
[R1-bgp]peer 10.0.2.2  next-hop-local
[R1-bgp]q

5.2  在R5上创建Loopback1,地址为10.1.5.5/24,发布进BGP, 在R3上配置next-hop-local。

[R5]interface Lo1
[R5-LoopBack1]ip address 10.1.5.5 24
[R5-LoopBack1]q
[R5]bgp 64514
[R5-bgp]network 10.1.5.0 24

[R3]bgp 64512
[R3-bgp]peer 10.0.1.1 next-hop-local
[R3-bgp]peer 10.0.2.2 next-hop-local
6、最终在R5上使用带源地址ping测试到R4的Loopback1地址的连通性。
[R5]ping -a 10.1.5.5 10.1.4.4
  PING 10.1.4.4: 56  data bytes, press CTRL_C to break
    Reply from 10.1.4.4: bytes=56 Sequence=1 ttl=252 time=40 ms
    Reply from 10.1.4.4: bytes=56 Sequence=2 ttl=252 time=50 ms
    Reply from 10.1.4.4: bytes=56 Sequence=3 ttl=252 time=60 ms
    Reply from 10.1.4.4: bytes=56 Sequence=4 ttl=252 time=40 ms
    Reply from 10.1.4.4: bytes=56 Sequence=5 ttl=252 time=40 ms

  --- 10.1.4.4 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/46/60 ms
  • 10
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值