姓名:chanlsp (李树鹏)

 

拓扑:



需求:通过BGP的全互联使得R1的环回口和R5的环回口能够互相通信

配置方案:

1、在此配置设备的(IP地址省略)

2、R1和R2通过直连构建EBGP邻居关系

R1router bgp 100

 bgp log-neighbor-changes

 neighbor 12.1.1.2 remote-as 200 //指定对端的邻居建立EBGP邻居//

R2router bgp 200

 bgp log-neighbor-changes

 neighbor 12.1.1.1 remote-as 100

验证EBGP邻居关系;

R2#show ip bgp summary

BGP router identifier 22.1.1.1, local AS number 200

BGP table version is 1, main routing table version 1

 

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

12.1.1.1        4          100       2       2        1    0    0 00:00:04        0

R1#show ip bgp summary

BGP router identifier 11.1.1.1, local AS number 100

BGP table version is 1, main routing table version 1

 

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

12.1.1.2        4          200       7       7        1    0    0 00:04:27        0

3、在AS200区内运行IGP协议,使得R2、R3、R4能够通信。

R2:

 router eigrp 90

 network 22.0.0.0

 network 23.0.0.0

R3:

router eigrp 90

 network 23.0.0.0

 network 33.0.0.0

 network 34.0.0.0

R4:

router eigrp 90

 network 34.0.0.0

 network 44.0.0.0

4、R4和R5通过环回口建立EBGP邻居关系

R4

router bgp 200

 bgp log-neighbor-changes

 neighbor 55.1.1.1 remote-as 300

 neighbor 55.1.1.1 ebgp-multihop 2

 neighbor 55.1.1.1 update-source Loopback0

R5

router bgp 300

 bgp log-neighbor-changes

 neighbor 44.1.1.1 remote-as 200

 neighbor 44.1.1.1 ebgp-multihop 2

 neighbor 44.1.1.1 update-source Loopback0

这里环回口建议使用静态路由,使其通信

R5(config)#ip route 44.1.1.1 255.255.255.255 s1/2

R4的静态路由请按照R5自行配置即可

 

验证EBGP邻居关系:

R5#show ip bgp summary

BGP router identifier 55.1.1.1, local AS number 300

BGP table version is 1, main routing table version 1

 

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

44.1.1.1        4          200       6       6        1    0    0 00:02:58        0

 

5、AS 200区域通过环回口建立IBGP邻居关系

R2:

router bgp 200

 bgp log-neighbor-changes

 network 22.1.1.1 mask 255.255.255.255

 neighbor 12.1.1.1 remote-as 100

 neighbor 33.1.1.1 remote-as 200

 neighbor 33.1.1.1 update-source Loopback0

 neighbor 33.1.1.1 next-hop-self

 neighbor 44.1.1.1 remote-as 200

 neighbor 44.1.1.1 update-source Loopback0

 neighbor 44.1.1.1 next-hop-self

R3:使用最少的命令去构建邻居

这里采用的是peer-group对等体组

router bgp 200

 synchronization

 bgp log-neighbor-changes

 bgp listen range 0.0.0.0/0 peer-group QYT

 network 33.1.1.1 mask 255.255.255.255

 neighbor QYT peer-group

 neighbor QYT remote-as 200

 neighbor QYT update-source Loopback0

R4:

router bgp 200

 synchronization

 bgp log-neighbor-changes

 network 44.1.1.1 mask 255.255.255.255

 neighbor 22.1.1.1 remote-as 200

 neighbor 22.1.1.1 update-source Loopback0

 neighbor 22.1.1.1 next-hop-self

 neighbor 33.1.1.1 remote-as 200

 neighbor 33.1.1.1 update-source Loopback0

 neighbor 33.1.1.1 next-hop-self

 neighbor 34.1.1.5 remote-as 300

 neighbor 55.1.1.1 remote-as 300

 neighbor 55.1.1.1 shutdown

 neighbor 55.1.1.1 ebgp-multihop 2

 neighbor 55.1.1.1 update-source Loopback0

R5

router bgp 300

 bgp log-neighbor-changes

 network 55.1.1.1 mask 255.255.255.255

 redistribute connected route-map conn

 neighbor 34.1.1.4 remote-as 200

 neighbor 44.1.1.1 remote-as 200

 neighbor 44.1.1.1 ebgp-multihop 2

 neighbor 44.1.1.1 update-source Loopback0

测试R2和R4的环回口通信:

R2(config-router)#do ping 44.1.1.1 sou lo0

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 44.1.1.1, timeout is 2 seconds:

Packet sent with a source address of 22.1.1.1

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 10/14/22 ms

 

另外在R4上配置ACL让R4能够匹配到55.1.1.1最优的这条路由

R4#show access-lists

Standard IP access list 10

10 permit 55.1.1.0, wildcard bits 0.0.0.255

最终验证R1可以ping通R5

R1#ping 55.1.1.1 sou lo0

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 55.1.1.1, timeout is 2 seconds:

Packet sent with a source address of 11.1.1.1

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 23/27/30 ms

 

R1#traceroute 55.1.1.1 sou 11.1.1.1 numeric

Type escape sequence to abort.

Tracing the route to 55.1.1.1

VRF info: (vrf in name/id, vrf out name/id)

  1 12.1.1.2 11 msec 10 msec 11 msec

  2 23.1.1.3 21 msec 20 msec 21 msec

  3 34.1.1.4 23 msec 22 msec 20 msec

  4 45.1.1.5 28 msec *  27 msec