You are on page 1of 33

ntphong2702@gmail.

com

BORDER GATEWAY PROTOCOL (BGP)


I - BACKGROUND
Routing involves two basic activities: determination of optimal routing paths and the transport of information groups (typically called packets) through an internetwork. The transport of packets through an internetwork is relatively straightforward. Path determination, on the other hand, can be very complex. One protocol that addresses the task of path determination in todays networks is the Border Gateway Protocol (BGP). This chapter summarizes the basic operations of BGP and provides a description of its protocol components. BGP performs interdomain routing in Transmission-Control Protocol/Internet Protocol (TCP/IP) networks. BGP is an exterior gateway protocol (EGP), which means that it performs routing between multiple autonomous systems or domains and exchanges routing and reachability information with other BGP systems. BGP was developed to replace its predecessor, the now obsolete Exterior Gateway Protocol (EGP), as the standard exterior gateway-routing protocol used in the global Internet. BGP solves serious problems with EGP and scales to Internet growth more efciently.

II- STRUCTURES PACKET BGP


Page 1

ntphong2702@gmail.com

BGP Message Types Four BGP message types are specied in RFC 1771, A Border Gateway Protocol 4 (BGP-4): open message, update message, notication message, and keep-alive message. The open message opens a BGP communications session between peers and is the rst message sent by each side after a transport-protocol connection is established. Open messages are conrmed using a keep-alive message sent by the peer device and must be conrmed before updates, notications, and keep-alives can be exchanged. An update message is used to provide routing updates to other BGP systems, allowing routers to construct a consistent view of the network topology. Updates are sent using the Transmission-Control Protocol (TCP) to ensure reliable delivery. Update messages can withdraw one or more unfeasible routes from the routing table and simultaneously can advertise a route while withdrawing others. The notication message is sent when an error condition is detected. Notications are used to close an active session and to inform any connected routers of why the session is being closed. The keep-alive message noties BGP peers that a device is active. Keep-alives are sent often enough to keep the sessions from expiring.

BGP Packet Formats The sections that follow summarize BGP open, updated, notication, and keepalive message types, as well as the basic BGP header format. Each is illustrated with a format drawing, and the elds shown are dened.

Header Format All BGP message types use the basic packet header. Open, update, and notication messages have additional elds, but keep-alive messages use only the basic packet header. Figure 35-3 illustrates the elds used in the BGP header. The section that follows summarizes the function of each eld. Page 2

ntphong2702@gmail.com

16 Marker

Variable

Length Type data A BGP packet header consists of four elds

BGP Packet-Header Fields Each BGP packet contains a header whose primary purpose is to identify the function of the packet in question. Marker Contains an authentication value that the message receiver can predict. Length Indicates the total length of the message in bytes. Type Species the message type as one of the following: Open Update Notication Keep-alive Data Contains upper-layer information in this optional eld.

Open Message Format BGP open messages are comprised of a BGP header and additional elds. Field length, in Bytes 1 Version 2 2 4 BGP Identifier 1 4 Optional Paramenters

Autonomous Hold-Time System

Optional Parameters Length A BGP open message consists of six elds.

Page 3

ntphong2702@gmail.com

BGP Open Message Fields BGP packets in which the type eld in the header identies the packet to be a BGP open message packet include the following elds. These elds provide the exchange criteria for two BGP routers to establish a peer relationship. VersionProvides the BGP version number so that the recipient can determine whether it is running the same version as the sender. Autonomous SystemProvides the autonomous system number of the sender.

Hold-TimeIndicates the maximum number of seconds that can elapse without receipt of a message before the transmitter is assumed to be nonfunctional. BGP IdentierProvides the BGP identier of the sender (an IP address), which is determined at startup and is identical for all local interfaces and all BGP peers. Optional Parameters LengthIndicates the length of the optional parameters eld (if present). Optional ParametersContains a list of optional parameters (if any). Only one optional parameter type is currently dened: authentication information. Authentication information consists of the following two elds: Authentication code: Indicates the type of authentication being used. Authentication data: Contains data used by the authentication mechanism (if used).

Update Message Format Page 4

ntphong2702@gmail.com

BGP update messages are comprised of a BGP header and additional elds. 2 Variable Withdrawn Routers 2 Variable Total Altribute Path Length Altributes Variable Network Layer Reachability Information

Unfessibl Router Length

A BGP update message contains ve elds

BGP Update Message Fields BGP packets in which the type eld in the header identies the packet to be a BGP update message packet include the following elds. Upon receiving an update message packet, routers will be able to add or delete specic entries from their routing tables to ensure accuracy. Update messages consist of the following packets: Unfeasible Routes LengthIndicates the total length of the withdrawn routes eld or that the eld is not present. Withdrawn RoutesContains a list of IP address prexes for routes being withdrawn from service. Total Path Attribute LengthIndicates the total length of the path attributes eld or that the eld is not present. Path AttributesDescribes the characteristics of the advertised path. The following are possible attributes for a path: Origin: Mandatory attribute that denes the origin of the path information AS Path: Mandatory attribute composed of a sequence of autonomous system path segments Next Hop: Mandatory attribute that denes the IP address of the border router that should be Page 5

ntphong2702@gmail.com

used as the next hop to destinations listed in the network layer reachability information eld Mult Exit Disc: Optional attribute used to discriminate between multiple exit points to a neighboring autonomous system Local Pref: Discretionary attribute used to specify the degree of preference for an advertised route Atomic Aggregate: Discretionary attribute used to disclose information about route selections Aggregator: Optional attribute that contains information about aggregate routes Network Layer Reachability InformationContains a list of IP address prexes for the

advertised routes. Notication Message Format 1 Error Code 1 Variable

Error Subcode Error Data A BGP notication message consists of three elds.

BGP Notication Message Fields BGP packets in which the type eld in the header identies the packet to be a BGP notication message packet include the following elds. This packet is used to indicate some sort of error condition to the peers of the originating router. Error CodeIndicates the type of error that occurred. The following are the error types dened Page 6

ntphong2702@gmail.com

by the eld: Message Header Error: Indicates a problem with a message header, such as unacceptable message length, unacceptable marker eld value, or unacceptable message type. Open Message Error: Indicates a problem with an open message, such as unsupported version number, unacceptable autonomous system number or IP address, or unsupported authentication code. Update Message Error: Indicates a problem with an update message, such as a malformed attribute list, attribute list error, or invalid next-hop attribute. Hold Time Expired: Indicates that the hold-time has expired, after which time a BGP node will be considered nonfunctional. Finite State Machine Error: Indicates an unexpected event. Cease: Closes a BGP connection at the request of a BGP device in the absence of any fatal errors. Error SubcodeProvides more specic information about the nature of the reported error. Error DataContains data based on the error code and error subcode elds. This eld is used to diagnose the reason for the notication message.

III PRACTICE 2.1 MODEL


Page 7

ntphong2702@gmail.com

2.2 GOAL:
Configure all IP addresses. Configure OSPF routing for all routers. Configure IBGP within AS 1. Use the loopback0 interfaces to source the BGP updates from. Configure IBGP within AS 2. Use the loopback0 interfaces to source the BGP updates from. Configure EBGP between AS 1 and AS 2. Ensure traffic from router Athens is load balanced proportionally over all available links.

2.3 SOLUTION ATHENS:


Router Athens(config)#router ospf 1 Router Athens(config-router)#network 192.168.123.0 0.0.0.255 area 0 Router Athens(config-router)#network 192.1.1.1.0 0.0.0.255 area 0 Router Athens(config)# router bgp 1 Router Athens(config-router)# neighbor 2.2.2.2 remote-as 1 Page 8

ntphong2702@gmail.com

Router Athens(config-router)# neighbor 2.2.2.2 update-source Loopback0 Router Athens(config-router)# neighbor 3.3.3.3 remote-as 1 Router Athens(config-router)# neighbor 3.3.3.3 update-source Loopback0 Router Athens(config-router)# bgp dmzlink-bw Router Athens(config-router)# maximum-paths ibgp 3

SPARTA
Router Sparta(config)#router ospf 1 Router Sparta(config-router)#network 2.2.2.0 0.0.0.255 area 0 Router Sparta(config-router)#network 192.168.123.0 0.0.0.255 area 0 Router Sparta(config-router)#router bgp 1 Router Sparta(config-router)#bgp dmzlink-bw Router Sparta(config-router)# network 192.168.24.0 Router Sparta(config-router)#network 192.168.25.0 Router Sparta(config-router)# network 192.168.123.0 Router Sparta(config-router)# neighbor 1.1.1.1 remote-as 1 Router Sparta(config-router)# neighbor 1.1.1.1 update-source Loopback0 Router Sparta(config-router)# neighbor 1.1.1.1 send-community extended Router Sparta(config-router)# neighbor 3.3.3.3 remote-as 1 Router Sparta(config-router)# neighbor 3.3.3.3 update-source Loopback0 Router Sparta(config-router)# neighbor 192.168.24.4 remote-as 2 Router Sparta(config-router)# neighbor 192.168.24.4 dmzlink-bw Router Sparta(config-router)# neighbor 192.168.25.5 remote-as 2 Router Sparta(config-router)# neighbor 192.168.25.5 dmzlink-bw Page 9

ntphong2702@gmail.com

DELPHI
Router Delphi(config)#router ospf 1 Router Delphi(config-router)# network 3.3.3.0 0.0.0.255 area 0 Router Delphi(config-router)# network 192.168.123.0 0.0.0.255 area 0 Router Delphi(config-router)#router bgp 1 Router Delphi(config-router)# bgp dmzlink-bw Router Delphi(config-router)# network 192.168.35.0 Router Delphi(config-router)# network 192.168.123.0 Router Delphi(config-router)# neighbor 1.1.1.1 remote-as 1 Router Delphi(config-router)# neighbor 1.1.1.1 update-source Loopback0 Router Delphi(config-router)# neighbor 1.1.1.1 send-community extended Router Delphi(config-router)# neighbor 2.2.2.2 remote-as 1 Router Delphi(config-router)# neighbor 2.2.2.2 update-source Loopback0 Router Delphi(config-router)# neighbor 192.168.35.5 remote-as 2 Router Delphi(config-router)# neighbor 192.168.35.5 dmzlink-bw

THEBES
Router Thebes(config)# router ospf 1 Router Thebes(config-router)# network 5.5.5.0 0.0.0.255 area 0 Router Thebes(config-router)# network 192.168.45.0 0.0.0.255 area 0 Router Thebes(config-router)#router bgp 2 Router Thebes(config-router)# network 192.168.45.0 Router Thebes(config-router)# neighbor 4.4.4.4 remote-as 2 Router Thebes(config-router)# neighbor 4.4.4.4 update-source Loopback0 Page 10

ntphong2702@gmail.com

Router Thebes(config-router)# neighbor 192.168.25.2 remote-as 1 Router Thebes(config-router)# neighbor 192.168.35.3 remote-as 1

OLYMPIA
Router Olympia(config)#router ospf 1 Router Olympia(config-router)#network 4.4.4.0 0.0.0.255 area 0 Router Olympia(config-router)# network 192.168.45.0 0.0.0.255 area 0 Router Olympia(config-router)#router bgp 2 Router Olympia(config-router)# network 192.168.45.0 Router Olympia(config-router)# neighbor 5.5.5.5 remote-as 2 Router Olympia(config-router)# neighbor 5.5.5.5 update-source Loopback0 Router Olympia(config-router)# neighbor 192.168.24.2 remote-as 1

Athens router config file:


!

! ! version 12.4 service timestamps debug datetime msec Page 11

ntphong2702@gmail.com

service timestamps log datetime msec no service password-encryption ! hostname Athens ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ! ! ip cef no ip domain lookup ! interface Loopback0 ip address 1.1.1.1 255.255.255.0 ! interface FastEthernet0/0 ip address 192.168.123.1 255.255.255.0 duplex auto speed auto ! Page 12

ntphong2702@gmail.com

router ospf 1 log-adjacency-changes network 1.1.1.0 0.0.0.255 area 0 network 192.168.123.0 0.0.0.255 area 0 ! router bgp 1 no synchronization bgp log-neighbor-changes bgp dmzlink-bw neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 update-source Loopback0 neighbor 3.3.3.3 remote-as 1 neighbor 3.3.3.3 update-source Loopback0 maximum-paths ibgp 3 no auto-summary ! no ip http server no ip http secure-server ! ! ! ! ! ! Page 13

ntphong2702@gmail.com

control-plane ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! ! End

Delphi router config file:


!

! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! Page 14

ntphong2702@gmail.com

hostname Delphi ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ! ! ip cef no ip domain lookup ! interface Loopback0 ip address 3.3.3.3 255.255.255.0 ! interface FastEthernet0/0 ip address 192.168.123.3 255.255.255.0 duplex auto speed auto ! interface Ethernet1/0 ip address 192.168.35.3 255.255.255.0 half-duplex Page 15

ntphong2702@gmail.com

! interface Ethernet1/1 no ip address shutdown half-duplex ! interface Ethernet1/2 no ip address shutdown half-duplex ! interface Ethernet1/3 no ip address shutdown half-duplex ! router ospf 1 log-adjacency-changes network 3.3.3.0 0.0.0.255 area 0 network 192.168.123.0 0.0.0.255 area 0 ! router bgp 1 no synchronization bgp log-neighbor-changes Page 16

ntphong2702@gmail.com

bgp dmzlink-bw network 192.168.35.0 network 192.168.123.0 neighbor 1.1.1.1 remote-as 1 neighbor 1.1.1.1 update-source Loopback0 neighbor 1.1.1.1 send-community extended neighbor 2.2.2.2 remote-as 1 neighbor 2.2.2.2 update-source Loopback0 neighbor 192.168.35.5 remote-as 2 neighbor 192.168.35.5 dmzlink-bw no auto-summary ! no ip http server no ip http secure-server ! ! ! ! ! ! control-plane ! ! ! Page 17

ntphong2702@gmail.com

! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! ! End

Olympia router config file:


!

! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec Page 18

ntphong2702@gmail.com

no service password-encryption ! hostname Olympia ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ! ! ip cef no ip domain lookup ! interface Loopback0 ip address 4.4.4.4 255.255.255.0 ! interface FastEthernet0/0 ip address 192.168.24.4 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/0 Page 19

ntphong2702@gmail.com

ip address 192.168.45.4 255.255.255.0 duplex auto speed auto ! router ospf 1 log-adjacency-changes network 4.4.4.0 0.0.0.255 area 0 network 192.168.45.0 0.0.0.255 area 0 ! router bgp 2 no synchronization bgp log-neighbor-changes network 192.168.45.0 neighbor 5.5.5.5 remote-as 2 neighbor 5.5.5.5 update-source Loopback0 neighbor 192.168.24.2 remote-as 1 no auto-summary ! no ip http server no ip http secure-server ! ! ! ! Page 20

ntphong2702@gmail.com

! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! ! End

Sparta router config file:


! Page 21

ntphong2702@gmail.com

! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname Sparta ! boot-start-marker boot-end-marker ! ! no aaa new-model memory-size iomem 5 ! ! ip cef no ip domain lookup interface Loopback0 ip address 2.2.2.2 255.255.255.0 ! interface FastEthernet0/0 Page 22

ntphong2702@gmail.com

ip address 192.168.123.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/0 ip address 192.168.24.2 255.255.255.0 duplex auto speed auto ! interface Serial2/0 ip address 192.168.25.2 255.255.255.0 serial restart-delay 0 ! interface Serial2/1 no ip address shutdown serial restart-delay 0 ! interface Serial2/2 no ip address shutdown serial restart-delay 0 ! interface Serial2/3 Page 23

ntphong2702@gmail.com

no ip address shutdown serial restart-delay 0 ! router ospf 1 log-adjacency-changes network 2.2.2.0 0.0.0.255 area 0 network 192.168.123.0 0.0.0.255 area 0 ! router bgp 1 no synchronization bgp log-neighbor-changes bgp dmzlink-bw network 192.168.24.0 network 192.168.25.0 network 192.168.123.0 neighbor 1.1.1.1 remote-as 1 neighbor 1.1.1.1 update-source Loopback0 neighbor 1.1.1.1 send-community extended neighbor 3.3.3.3 remote-as 1 neighbor 3.3.3.3 update-source Loopback0 neighbor 192.168.24.4 remote-as 2 neighbor 192.168.24.4 dmzlink-bw neighbor 192.168.25.5 remote-as 2 Page 24

ntphong2702@gmail.com

neighbor 192.168.25.5 dmzlink-bw no auto-summary ! no ip http server no ip http secure-server ! ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 Page 25

ntphong2702@gmail.com

logging synchronous line aux 0 line vty 0 4 login ! ! End

Thebes router config file:


!

! ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname Thebes ! boot-start-marker boot-end-marker ! ! no aaa new-model Page 26

ntphong2702@gmail.com

memory-size iomem 5 ! ! ip cef no ip domain lookup interface Loopback0 ip address 5.5.5.5 255.255.255.0 ! interface Serial0/0 ip address 192.168.25.5 255.255.255.0 serial restart-delay 0 ! interface Serial0/1 no ip address shutdown serial restart-delay 0 ! interface Serial0/2 no ip address shutdown serial restart-delay 0 ! interface Serial0/3 no ip address Page 27

ntphong2702@gmail.com

shutdown serial restart-delay 0 ! interface Ethernet1/0 ip address 192.168.35.5 255.255.255.0 half-duplex ! interface Ethernet1/1 no ip address shutdown half-duplex ! interface Ethernet1/2 no ip address shutdown half-duplex ! interface Ethernet1/3 no ip address shutdown half-duplex ! interface FastEthernet2/0 ip address 192.168.45.5 255.255.255.0 Page 28

ntphong2702@gmail.com

duplex auto speed auto ! router ospf 1 log-adjacency-changes network 5.5.5.0 0.0.0.255 area 0 network 192.168.45.0 0.0.0.255 area 0 ! router bgp 2 no synchronization bgp log-neighbor-changes network 192.168.45.0 neighbor 4.4.4.4 remote-as 2 neighbor 4.4.4.4 update-source Loopback0 neighbor 192.168.25.2 remote-as 1 neighbor 192.168.35.3 remote-as 1 no auto-summary ! no ip http server no ip http secure-server ! ! ! ! Page 29

ntphong2702@gmail.com

! ! control-plane ! ! ! ! ! ! ! ! ! ! line con 0 exec-timeout 0 0 logging synchronous line aux 0 line vty 0 4 login ! ! end

Page 30

ntphong2702@gmail.com

WIRESHARK CAPTURES

THE BGP OPEN MESSAGE PACKET:

Page 31

ntphong2702@gmail.com

BGP UPDATE MESSAGE:

Page 32

ntphong2702@gmail.com

Resource : http://www.pulsewan.com/data101/pdfs/bgp.pdf

Page 33