1 实验环境
路由器 7200
iOS版本 Version 15.2(4)S5
2 实验目的
1、掌握IBGP、EBGP配置
2、掌握BGP命令使用
3 实验拓扑
4 配置步骤
1、配置各路由器IP地址,并用ping测试连通性
2、ISP内部使用ospf,区域为0,进程号110
3、配置如图所示BGP协议,IGP用loopback0建邻居,EBP用直连接口建邻居
4、将各接口环回口通告到BGP中
5、R1 基本配置
router bgp 1 bgp router-id 10.10.1.1 bgp log-neighbor-changes network 10.10.1.1 mask 255.255.255.255 neighbor 172.16.12.2 remote-as 234 |
R2基本配置
interface Loopback0 ip address 10.10.2.2 255.255.255.255 ip ospf 110 area 0 ! interface GigabitEthernet0/0 ip address 172.16.12.2 255.255.255.0 media-type gbic speed 1000 duplex full negotiation auto ! interface GigabitEthernet1/0 ip address 172.16.23.2 255.255.255.0 ip ospf 110 area 0 negotiation auto ! interface GigabitEthernet2/0 no ip address shutdown negotiation auto ! router ospf 110 ! router bgp 234 bgp router-id 10.10.2.2 bgp log-neighbor-changes network 10.10.2.2 mask 255.255.255.255 neighbor 10.10.3.3 remote-as 234 neighbor 10.10.3.3 update-source Loopback0 neighbor 10.10.3.3 next-hop-self neighbor 172.16.12.1 remote-as 1 |
R3 基本配置
interface Loopback0 ip address 10.10.3.3 255.255.255.255 ip ospf 110 area 0 ! interface Ethernet0/0 no ip address shutdown duplex auto ! interface GigabitEthernet0/0 ip address 172.16.23.3 255.255.255.0 ip ospf 110 area 0 media-type gbic speed 1000 duplex full negotiation auto ! interface GigabitEthernet1/0 ip address 172.16.34.3 255.255.255.0 ip ospf 110 area 0 negotiation auto ! interface GigabitEthernet2/0 no ip address shutdown negotiation auto ! router ospf 110 ! router bgp 234 bgp router-id 10.10.3.3 bgp log-neighbor-changes neighbor paul peer-group network 10.10.3.3 mask 255.255.255.255 neighbor paul remote-as 234 neighbor paul update-source Loopback0 neighbor paul route-reflector-client neighbor paul next-hop-self neighbor 10.10.2.2 peer-group paul neighbor 10.10.4.4 peer-group paul |
R4基本配置
interface Loopback0 ip address 10.10.4.4 255.255.255.255 ip ospf 110 area 0 ! interface Ethernet0/0 no ip address shutdown duplex auto ! interface GigabitEthernet0/0 ip address 172.16.34.4 255.255.255.0 ip ospf 110 area 0 media-type gbic speed 1000 duplex full negotiation auto ! interface GigabitEthernet1/0 ip address 172.16.45.4 255.255.255.0 negotiation auto ! interface GigabitEthernet2/0 no ip address shutdown negotiation auto ! router ospf 110 ! router bgp 234 bgp router-id 10.10.4.4 bgp log-neighbor-changes network 10.10.4.4 mask 255.255.255.255 neighbor 10.10.3.3 remote-as 234 neighbor 10.10.3.3 update-source Loopback0 neighbor 10.10.3.3 next-hop-self neighbor 172.16.45.5 remote-as 5 |
R5基本配置
interface Loopback0 ip address 10.10.5.5 255.255.255.255 ! interface Ethernet0/0 no ip address shutdown duplex auto ! interface GigabitEthernet0/0 ip address 172.16.45.5 255.255.255.0 media-type gbic speed 1000 duplex full negotiation auto ! interface GigabitEthernet1/0 no ip address shutdown negotiation auto ! interface GigabitEthernet2/0 no ip address shutdown negotiation auto ! router bgp 5 bgp router-id 10.10.5.5 bgp log-neighbor-changes network 10.10.5.5 mask 255.255.255.255 neighbor 172.16.45.4 remote-as 234 |
6 检查R5上的bgp会话
R5#sh ip bgp summary BGP router identifier 10.10.5.5, local AS number 5 BGP table version is 6, main routing table version 6 5 network entries using 720 bytes of memory 5 path entries using 400 bytes of memory 4/4 BGP path/bestpath attribute entries using 544 bytes of memory 2 BGP AS-PATH entries using 48 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 1712 total bytes of memory BGP activity 5/0 prefixes, 5/0 paths, scan interval 60 secs Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd 172.16.45.4 4 234 13 11 6 0 0 00:06:21 |
7 查看R5 邻居信息
R5#sh ip bgp neighbors 172.16.45.4 BGP neighbor is 172.16.45.4, remote AS 234, external link BGP version 4, remote router ID 10.10.4.4 BGP state = Established, up for 00:08:13 Last read 00:00:50, last write 00:00:19, hold time is 180, keepalive interval is 60 seconds Neighbor sessions: 1 active, is not multisession capable (disabled) Neighbor capabilities: Route refresh: advertised and received(new) Four-octets ASN Capability: advertised and received Address family IPv4 Unicast: advertised and received Enhanced Refresh Capability: advertised and received Multisession Capability: Stateful switchover support enabled: NO for session 1 Message statistics: InQ depth is 0 OutQ depth is 0
Sent Rcvd Opens: 1 1 Notifications: 0 0 Updates: 2 4 Keepalives: 10 10 Route Refresh: 0 0 Total: 13 15 Default minimum time between advertisement runs is 30 seconds For address family: IPv4 Unicast Session: 172.16.45.4 BGP table version 6, neighbor version 6/0 Output queue size : 0 Index 1, Advertise bit 0 1 update-group member Slow-peer detection is disabled Slow-peer split-update-group dynamic is disabled Sent Rcvd Prefix activity: ---- ---- Prefixes Current: 1 4 (Consumes 320 bytes) Prefixes Total: 1 4 Implicit Withdraw: 0 0 Explicit Withdraw: 0 0 Used as bestpath: n/a 4 Used as multipath: n/a 0 Outbound Inbound Local Policy Denied Prefixes: -------- ------- Bestpath from this peer: 4 n/a Total: 4 0 Number of NLRIs in the update sent: max 1, min 0 Last detected as dynamic slow peer: never Dynamic slow peer recovered: never Refresh Epoch: 1 Last Sent Refresh Start-of-rib: never Last Sent Refresh End-of-rib: never Last Received Refresh Start-of-rib: never Last Received Refresh End-of-rib: never Sent Rcvd Refresh activity: ---- ---- Refresh Start-of-RIB 0 0 Refresh End-of-RIB 0 0 Address tracking is enabled, the RIB does have a route to 172.16.45.4 Connections established 1; dropped 0 Last reset never Transport(tcp) path-mtu-discovery is enabled Graceful-Restart is disabled Connection state is ESTAB, I/O status: 1, unread input bytes: 0 Connection is ECN Disabled Mininum incoming TTL 0, Outgoing TTL 1 Local host: 172.16.45.5, Local port: 179 Foreign host: 172.16.45.4, Foreign port: 23300 Connection tableid (VRF): 0 Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes) Event Timers (current time is 0x44A56C): Timer Starts Wakeups Next Retrans 12 0 0x0 TimeWait 0 0 0x0 AckHold 11 9 0x0 SendWnd 0 0 0x0 KeepAlive 0 0 0x0 GiveUp 0 0 0x0 PmtuAger 0 0 0x0 DeadWait 0 0 0x0 Linger 0 0 0x0 iss: 2338122464 snduna: 2338122790 sndnxt: 2338122790 sndwnd: 16059 irs: 776550404 rcvnxt: 776550835 rcvwnd: 15954 delrcvwnd: 430 SRTT: 239 ms, RTTO: 712 ms, RTV: 473 ms, KRTT: 0 ms minRTT: 16 ms, maxRTT: 300 ms, ACK hold: 200 ms Status Flags: passive open, gen tcbs Option Flags: nagle, path mtu capable Datagrams (max data segment is 1460 bytes): Rcvd: 24 (out of order: 0), with data: 12, total data bytes: 430 Sent: 23 (retransmit: 0 fastretransmit: 0),with data: 13, total data bytes: 325 |
8 查看R5 上的BGP表
R5#sh ip bgp BGP table version is 6, local router ID is 10.10.5.5 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.10.1.1/32 172.16.45.4 0 234 1 i *> 10.10.2.2/32 172.16.45.4 0 234 i *> 10.10.3.3/32 172.16.45.4 0 234 i *> 10.10.4.4/32 172.16.45.4 0 0 234 i *> 10.10.5.5/32 0.0.0.0 0 32768 i |
9 查看R3上bgp路由详细信息
R3#sh ip bgp 10.10.5.5 BGP routing table entry for 10.10.5.5/32, version 6 Paths: (1 available, best #1, table default) Advertised to update-groups: 1 Refresh Epoch 1 5, (Received from a RR-client) 10.10.4.4 (metric 2) from 10.10.4.4 (10.10.4.4) Origin IGP, metric 0, localpref 100, valid, internal, best rx pathid: 0, tx pathid: 0x0 |
5 验证结果
R5上带源ping测试
R5#ping 10.10.1.1 source lo0 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.1.1, timeout is 2 seconds: Packet sent with a source address of 10.10.5.5 !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 96/112/136 ms |