SECCIÓN II. EVALUACIÓN DE LOS RIESGOS PARA LOS EXPORTADORES LOCALES, LOS RECICLADORES, LOS
C. Realizar un esquema de las circunstancias de hecho de las cadenas de suministro afectadas por señales de alerta de la
A router configured to send and receive route information via BGP is known as a BGP speaker. To exchange route information, a BGP speaker forms adjacencies with peer routers. BGP peers establish a TCP session using port number 179.
Both peers attempt to open a connection to port 179, but only one connection is kept up for the peer adjacency. The peer initiating the connection uses a random port number on its side of the BGP
session. All BGP packets have the following format:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| IP Header | TCP Header | BGP Header | BGP Message |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The BGP header contains three fields:
Marker: Can be used for authentication and synchronization of the BGP session Length: Indicates the total length of the message, including the BGP header, in octets Type: Indicates the type of message to follow
BGP has four types of messages:
Open Update Notification Keepalive
An explanation of how these messages are used requires an understanding of the BGP adjacency finite state machine. The clearest way to explain this state machine is to walk through the flow when
everything works properly—that is, the connection comes up and routes are exchanged. The following example describes what happens when two routers, router A and router B, are configured as BGP peers for the first time.
Router A CONNECT; router B IDLE
Router A is configured, identifying router B as a potential BGP peer. This configuration shifts router A into the CONNECT state, and it tries to initiate a TCP connection with router B on port 179.
1.
Router A ACTIVE; router B IDLE
This connection fails because router B has yet to be configured. This failure shifts router A into ACTIVE state. In ACTIVE state, router A listens on port 179 for a connection initiated by router B. Every few seconds, router A again attempts to initiate a TCP session.
2.
Router A ACTIVE; router B CONNECT
Router B is configured, identifying router A as a BGP peer. This configuration shifts router B into the CONNECT state; then router B tries to initiate a TCP connection with router A on port 179.
3.
Router A OPENSENT; router B OPENSENT
This connection succeeds. Each side sends out an Open message and changes its state to OPENSENT.
4.
Router A OPENCONFIRM; router B OPENCONFIRM
Upon the receipt of the Open message from the peer, each side checks the message for errors. If everything checks out all right, a Keepalive message is sent, and the state is changed to
OPENCONFIRM.
5.
Router A ESTABLISHED; router B ESTABLISHED
Upon the receipt of the Keepalive message, each peer switches to ESTABLISHED state. In ESTABLISHED state, the peers are free to exchange Update messages containing route information. Keepalive messages are sent periodically to ensure that the connection is still up.
6.
If anything goes wrong during the previously described process, a Notification message is sent, and the router shifts back to IDLE state.
When discussing MBGP, we are primarily concerned with the Update message. The following diagram depicts the various fields in the BGP Update message:
+---+
| Unfeasible Routes Length (2 octets) |
+---+
| Withdrawn Routes (variable) |
+---+
| Total Path Attribute Length (2 octets) |
+---+
| Path Attributes (variable) |
+---+
| Network Layer Reachability Information (variable) |
+---+
BGP considers every route to be a destination with the attributes of a path to that destination. The
Network Layer Reachability Information (NLRI) field contains a list of destination prefixes that
share the same path attributes. Path attributes are used by each router for next-hop selection when more than one path to the destination prefix is learned via BGP. The following depicts the Path Attributes field:
0 1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Attr. Flags |Attr. Type Code|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
ORIGIN AS_PATH NEXT_HOP LOCAL_PREF ATOMIC_AGGREGATE AGGREGATOR MULTI_EXIT_DISC (MED) COMMUNITY
Path attributes fall into four categories:
Well-known mandatory Well-known discretionary Optional transitive Optional nontransitive
Well-known attributes are recognized by the BGP implementations of all router vendors. Well-known
mandatory attributes are included in every BGP Update message, whereas well-known discretionary attributes are not required to be incorporated in every Update message.
Both categories of well-known attributes are transferred to other BGP peers. ORIGIN, AS_PATH, and NEXT_HOP are well-known mandatory attributes. LOCAL_PREF and ATOMIC_AGGREGATE are well-known discretionary attributes.
In addition to well-known attributes, each path may contain one or more optional attributes. It is not required or expected that all BGP implementations support all optional attributes.
If a router receives a BGP Update message containing an unrecognized optional attribute, the optional attribute is quietly ignored, and the NLRI is accepted and passed on to other BGP peers. "Quietly ignored" means no Notification message is sent, and the BGP session is not torn down. The handling of the unrecognized optional attribute depends on whether it is transitive or nontransitive.
Unrecognized optional transitive path attributes are passed along to other BGP peers. Unrecognized optional nontransitive path attributes are not passed along to other BGP peers. For example,
AGGREGATOR is an optional transitive attribute. MULTI_EXIT_DISC (MED—multiple exit discriminator) is an optional nontransitive attribute.
7.3.1 NLRI
The NLRI field is used to convey IP address prefix and subnet mask information. The NLRI consists of multiple instances of two fields, Length and Prefix. The Length field indicates the length in bits of the IP address prefix. The Prefix field contains IP address prefixes followed by enough trailing bits to make the end of the field fall on an octet boundary. Note that the value of the trailing bits is irrelevant.
7.3.2 BGP Route Selection
RFC 1771 does not define any hard-and-fast rules about BGP route selection. Therefore, each router vendor's implementation may be slightly different. The following is an example of a route-selection process. When two or more BGP routes are being compared, the first attribute that is different for the two paths eliminates the loser.
Highest LOCAL_PREF value
1.
Shortest AS_PATH length (fewest AS hops)
2.
Lowest ORIGIN code (IGP = 0, EGP = 1, incomplete = 2)
3.
If neighbor AS is same, then lowest MED metric
4.
Prefer strictly internal paths
5.
Prefer strictly external paths
6.
Lowest IGP metric
7.
Lowest peer router ID