Bgp 路由协议

拓扑图:
Bgp 路由协议_第1张图片
一:先配置所有路由器接口ip和回环IP,如图配置区域igp路由协议,(回环口只讲L0加入network)
二:配置bgp
1.ebgp建立邻居:
R1:
neighbor 192.168.30.1 remote-as 200
neighbor 192.168.30.1 update-source loopback 0
neighbor 192.168.30.1 ebgp-multihop 3

neighbor 192.168.50.1 remote-as 300
neighbor 192.168.50.1 update-source loopback 0
neighbor 192.168.50.1 ebgp-multihop 3

neighbor 192.168.70.1 remote-as 400
neighbor 192.168.70.1 update-source loopback 0
neighbor 192.168.70.1 ebgp-multihop 3

neighbor 192.168.90.1 remote-as 500
neighbor 192.168.90.1 update-source loopback 0
neighbor 192.168.90.1 ebgp-multihop 3

R2:
neighbor 192.168.10.1 remote-as 100
neighbor 192.168.10.1 update-source loopback 0
neighbor 192.168.10.1 ebgp-multihop 3

neighbor 192.168.50.1 remote-as 300
neighbor 192.168.50.1 update-source loopback 0
neighbor 192.168.50.1 ebgp-multihop 3

neighbor 192.168.70.1 remote-as 400
neighbor 192.168.70.1 update-source loopback 0
neighbor 192.168.70.1 ebgp-multihop 3

neighbor 192.168.90.1 remote-as 500
neighbor 192.168.90.1 update-source loopback 0
neighbor 192.168.90.1 ebgp-multihop 3

R3:
neighbor 192.168.10.1 remote-as 100
neighbor 192.168.10.1 update-source loopback 0
neighbor 192.168.10.1 ebgp-multihop 3

neighbor 192.168.30.1 remote-as 200
neighbor 192.168.30.1 update-source loopback 0
neighbor 192.168.30.1 ebgp-multihop 3

neighbor 192.168.70.1 remote-as 400
neighbor 192.168.70.1 update-source loopback 0
neighbor 192.168.70.1 ebgp-multihop 3

neighbor 192.168.90.1 remote-as 500
neighbor 192.168.90.1 update-source loopback 0
neighbor 192.168.90.1 ebgp-multihop 3

R4:
neighbor 192.168.10.1 remote-as 100
neighbor 192.168.10.1 update-source loopback 0
neighbor 192.168.10.1 ebgp-multihop 3

neighbor 192.168.30.1 remote-as 200
neighbor 192.168.30.1 update-source loopback 0
neighbor 192.168.30.1 ebgp-multihop 3

neighbor 192.168.50.1 remote-as 300
neighbor 192.168.50.1 update-source loopback 0
neighbor 192.168.50.1 ebgp-multihop 3

neighbor 192.168.90.1 remote-as 500
neighbor 192.168.90.1 update-source loopback 0
neighbor 192.168.90.1 ebgp-multihop 3

R5:
neighbor 192.168.10.1 remote-as 100
neighbor 192.168.10.1 update-source loopback 0
neighbor 192.168.10.1 ebgp-multihop 3

neighbor 192.168.30.1 remote-as 200
neighbor 192.168.30.1 update-source loopback 0
neighbor 192.168.30.1 ebgp-multihop 3

neighbor 192.168.50.1 remote-as 300
neighbor 192.168.50.1 update-source loopback 0
neighbor 192.168.50.1 ebgp-multihop 3

neighbor 192.168.70.1 remote-as 400
neighbor 192.168.70.1 update-source loopback 0
neighbor 192.168.70.1 ebgp-multihop 3

2.邻居配置完成后查看bgp邻居表:
R1#show ip bgp summary
192.168.30.1 4 200 7 7 1 0 0 00:03:54 0
192.168.50.1 4 300 5 6 1 0 0 00:02:55 0
192.168.70.1 4 400 4 5 1 0 0 00:01:59 0
192.168.90.1 4 500 5 5 1 0 0 00:01:11 0

R2#show ip bgp summary
192.168.10.1 4 100 16 16 1 0 0 00:12:22 0
192.168.50.1 4 300 6 8 1 0 0 00:00:00 0
192.168.70.1 4 400 13 14 1 0 0 00:10:17 0
192.168.90.1 4 500 12 13 1 0 0 00:09:57 0

R3#show ip bgp summary
192.168.10.1 4 100 15 14 1 0 0 00:11:32 0
192.168.30.1 4 200 4 4 1 0 0 00:00:09 0
192.168.70.1 4 400 13 13 1 0 0 00:10:20 0
192.168.90.1 4 500 13 13 1 0 0 00:09:57 0

R4#show ip bgp summary
192.168.10.1 4 100 5 4 1 0 0 00:01:41 0
192.168.30.1 4 200 5 4 1 0 0 00:01:31 0
192.168.50.1 4 300 4 4 1 0 0 00:01:24 0
192.168.90.1 4 500 4 4 1 0 0 00:01:25 0

R5#show ip bgp summary
192.168.10.1 4 100 5 5 1 0 0 00:01:04 0
192.168.30.1 4 200 5 4 1 0 0 00:01:21 0
192.168.50.1 4 300 5 5 1 0 0 00:01:12 0
192.168.70.1 4 400 4 4 1 0 0 00:01:35 0

EBGP邻居建立成功!

3.建立IBGP邻居:
R5:
R5(config)#router bgp 500
neighbor 56.1.1.6 remote-as 500
neighbor 67.1.1.7 remote-as 500

R6:
R6(config)#router bgp 500
neighbor 56.1.1.5 remote-as 500
neighbor 67.1.1.7 remote-as 500

R7:
R7(config)#router bgp 500
neighbor 67.1.1.6 remote-as 500
neighbor 56.1.1.5 remote-as 500

3.邻居配置完成后查看bgp邻居表:

R5#show ip bgp summary
56.1.1.6 4 500 15 16 1 0 0 00:12:26 0
67.1.1.7 4 500 4 4 1 0 0 00:00:32 0
192.168.10.1 4 100 32 32 1 0 0 00:28:22 0
192.168.30.1 4 200 32 31 1 0 0 00:28:40 0
192.168.50.1 4 300 32 32 1 0 0 00:28:31 0
192.168.70.1 4 400 31 31 1 0 0 00:28:54 0

R6#show ip bgp summary
56.1.1.5 4 500 14 13 1 0 0 00:10:26 0
67.1.1.7 4 500 13 13 1 0 0 00:10:12 0

R7#show ip bgp summary
56.1.1.5 4 500 4 4 1 0 0 00:00:23 0
67.1.1.6 4 500 15 15 1 0 0 00:12:04 0

IBGP邻居建立成功!

4.将所有路由器的回环口L1的网段和成都区域R5、R6、R7的网段network到bgp路由协议:
(这些网段之前并没有加入ospf协议的配置)
R1:
Network 192.168.20.0 mask 255.255.255.0

R2:
Network 192.168.40.0 mask 255.255.255.0

R3:
Network 192.168.60.0 mask 255.255.255.0

R4:
Network 192.168.80.0 mask 255.255.255.0

R5:
network 56.1.1.0 mask 255.255.255.0

R6:
network 67.1.1.0 mask 255.255.255.0
network 56.1.1.0 mask 255.255.255.0

R7:
network 67.1.1.0 mask 255.255.255.0

5.查看成都区域的bgp表
R6#show ip bgp
BGP table version is 1, local router ID is 67.1.1.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
* i56.1.1.0/24 56.1.1.5 0 100 0 i
* 0.0.0.0 0 32768 i
* i67.1.1.0/24 67.1.1.7 0 100 0 i

  • i192.168.20.0 192.168.10.1 0 100 0 100 i
  • i192.168.40.0 192.168.30.1 0 100 0 200 i
  • i192.168.60.0 192.168.50.1 0 100 0 300 i
  • i192.168.80.0 192.168.70.1 0 100 0 400 i
    路由条目之前没有> 这样是不通的

6.所以需要配置下一跳通告命令:
R1:
router bgp 100
neighbor 192.168.30.1 next-hop-self
neighbor 192.168.90.1 next-hop-self

R2:
router bgp 200
neighbor 192.168.10.1 next-hop-self
neighbor 192.168.50.1 next-hop-self

R3:
router bgp 300
neighbor 192.168.30.1 next-hop-self
neighbor 192.168.70.1 next-hop-self

R4:
router bgp 400
neighbor 192.168.50.1 next-hop-self
neighbor 192.168.90.1 next-hop-self

R5:
router bgp 500
neighbor 192.168.10.1 next-hop-self
neighbor 192.168.70.1 next-hop-self
neighbor 56.1.1.6 next-hop-self
neighbor 67.1.1.7 next-hop-self

7.配置完成下一跳通告(路由更新重定向)命令后再次查看BGP表并ping bgp路由协议network的网段:
R6#show ip bgp
BGP table version is 7, local router ID is 67.1.1.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight Path
* i56.1.1.0/24 56.1.1.5 0 100 0 i
*> 0.0.0.0 0 32768 i
* i67.1.1.0/24 67.1.1.7 0 100 0 i
*> 0.0.0.0 0 32768 i
*>i192.168.20.0 56.1.1.5 0 100 0 100 i
*>i192.168.40.0 56.1.1.5 0 100 0 200 i
*>i192.168.60.0 56.1.1.5 0 100 0 300 i
*>i192.168.80.0 56.1.1.5 0 100 0 400 i
出现了>

R6#ping 192.168.20.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 212/348/504 ms
R6#ping 192.168.40.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.40.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 428/472/512 ms
R6#ping 192.168.60.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.60.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 392/464/592 ms
R6#ping 192.168.80.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.80.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 204/321/392 ms

BGP 路由协议配置成功!(Ebgp最好物理接口建立邻居,Ibgp最好逻辑(回环)接口建立邻居)——我们这里没有严格要求此规则。

你可能感兴趣的:(Bgp 路由协议)