A-A+
ccnp认证考试知识:IBGP和EBGP邻居关系的建立和验证
在学习CCNP各种知识和力图通过认证考试的努力中,花一些精力来了解IBGP和EBGP的配置和验证是必须的。实话实说,BGP的组网实验真的不好弄,不过为了成为一名优秀的思科认证网络工程师,一切汗水和付出都是值得的。
拓扑很简单,4台路由器,R1,R2和R3在同一个AS1中,R4在AS2中其中R1和R2是IBGP邻居关系,R2和R3运行OSPF。R3和R4是EBGP邻居关系。
- r1:
- in e1/0
- ip add 192.168.1.1 255.255.255.0
- no sh
- ip route 0.0.0.0 0.0.0.0 192.168.1.2
- router bgp 1
- nei 192.168.2.2 remote-as 1
- net 192.168.1.0
- r2:
- in e1/0
- ip add 192.168.1.2 255.255.255.0
- no sh
- ip ospf 1 a 0
- in e1/1
- ip add 192.168.2.1 255.255.255.0
- no sh
- ip ospf 1 a 0
- r3:
- in e1/0
- ip add 192.168.2.2 255.255.255.0
- no sh
- ip ospf 1 a 0
- in e1/1
- ip add 192.168.3.1 255.255.255.0
- no sh
- router bgp 1
- nei 192.168.1.1 remote-as 1
- nei 192.168.3.2 remote-as 2
- net 192.168.3.0
- r4:
- in e1/0
- ip add 192.168.3.2 255.255.255.0
- http://www.xiaoxiongboke.com
- no sh
- router bgp 2
- nei 192.168.3.1 remote-as 1
- net 192.168.3.0
BGP是运行在运营商与运营商之间的路由协议,BGP维护着全INTERNET的路由,所以其路由条目是很多的。其复杂性也很强。废话不多说,解释一下配置的重点。
配置的重点在于R3,R3定义了IBGP邻居R1和EBGP邻居R4,是通过nei 192.168.1.1 remote-as 1定义了IBGP邻居,通过nei 192.168.3.2 remote-as 2定义了EBGP邻居。注意无论是要形成IBGP邻居还是EBGP都要有前往邻居的路由才能够形成邻居,所以我在R1和R4上各定义了一条默认路由。BGP是通过TCP端口179传输BGP消息。
验证命令:
show ip bgp 验证BGP路由,只有通过network命令定义了才会有show ip bgp sum 验证BGP邻居状态,状态不能为IDLE和ACTIVE,是数字就正常的show ip rou
下面是一个输出示例:
- R1#show ip bgp sum
- BGP router identifier 1.1.1.1, local AS number 1
- BGP table version is 3, main routing table version 3
- 2 network entries using 234 bytes of memory
- 2 path entries using 104 bytes of memory
- 3/2 BGP path/bestpath attribute entries using 372 bytes of memory
- 0 BGP route-map cache entries using 0 bytes of memory
- 0 BGP filter-list cache entries using 0 bytes of memory
- BGP using 710 total bytes of memory
- BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
- Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
- 192.168.2.2 4 1 42 42 3 0 0 00:38:09 1
R1形成了一个邻居关系,再看看R3的
- R3#show ip bgp sum
- BGP router identifier 192.168.3.1, local AS number 1
- BGP table version is 4, main routing table version 4
- 2 network entries using 234 bytes of memory
- 3 path entries using 156 bytes of memory
- 4/2 BGP path/bestpath attribute entries using 496 bytes of memory
- 1 BGP AS-PATH entries using 24 bytes of memory
- 0 BGP route-map cache entries using 0 bytes of memory
- 0 BGP filter-list cache entries using 0 bytes of memory
- BGP using 910 total bytes of memory
- BGP activity 2/0 prefixes, 3/0 paths, scan interval 60 secs
- Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
- 192.168.1.1 4 1 45 45 4 0 0 00:41:20 1
- 192.168.3.2 4 2 45 46 4 0 0 00:40:41 1
- R1#show ip bgp sum
- BGP router identifier 1.1.1.1, local AS number 1
- BGP table version is 3, main routing table version 3
- 2 network entries using 234 bytes of memory
- 2 path entries using 104 bytes of memory
- 3/2 BGP path/bestpath attribute entries using 372 bytes of memory
- 0 BGP route-map cache entries using 0 bytes of memory
- 0 BGP filter-list cache entries using 0 bytes of memory
- BGP using 710 total bytes of memory
- BGP activity 2/0 prefixes, 2/0 paths, scan interval 60 secs
- Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
- 192.168.2.2 4 1 42 42 3 0 0 00:38:09 1
- R1#
- R1#show ip bgp
- BGP table version is 3, local router ID is 1.1.1.1
- 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
- *> 192.168.1.0 0.0.0.0 0 32768 i
- *>i192.168.3.0 192.168.2.2 0 100 0 i
- R1#show ip ro
- Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
- D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
- N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
- E1 - OSPF external type 1, E2 - OSPF external type 2
- i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
- ia - IS-IS inter area, * - candidate default, U - per-user static route
- o - ODR, P - periodic downloaded static route
- Gateway of last resort is 192.168.1.2 to network 0.0.0.0
- C 1.0.0.0/8 is directly connected, Loopback1
- C 192.168.1.0/24 is directly connected, Ethernet1/0
- B 192.168.3.0/24 [200/0] via 192.168.2.2, 00:39:36
- S* 0.0.0.0/0 [1/0] via 192.168.1.2
这些就是这次要完成的ccnp基础网络知识。在建立ebgp和ibgp的邻居关系之后,进一步的进行验证的全过程。