[1] Configure the IP address
[2] AS2 uses the ospf protocol to achieve internal communication
[3] Configure BGP
(1) Establish neighbor relationships (routes must be reachable, otherwise it cannot be established)
[1] Single link
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
[r2]bgp 2
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.1.1.1 as-number 1
[2] Multiple physical links—>It is recommended to use loopback interfaces to establish neighbors
{1}IP is reachable, static routing is recommended
{2} Normal loopback is used as source and destination ip address to establish neighbor relationship
peer 5.5.5.5 as-number 3
peer 5.5.5.5 connect-interface LoopBack0
peer 4.4.4.4 as-number 2
peer 4.4.4.4 connect-interface LoopBack0
{3} By default, the TTL value of data packets between IBGP neighbors is 255, and the TTL between EBGP neighbors is 1. Therefore, once loopback is used to establish an ebgp neighbor relationship, the TTL value must be modified, otherwise it cannot be established.
[r4-bgp]peer 5.5.5.5 ebgp-max-hop 255
[r5-bgp]peer 4.4.4.4 ebgp-max-hop 255
[2] Announcement of BGP
[r1-bgp]network 1.1.1.0 24
[r2-bgp]network 2.2.2.0 24
[r3-bgp]network 3.3.3.0 24
[r4-bgp]network 4.4.4.0 24
[r5-bgp]network 5.5.5.0 24
Based on the AS-BY-AS rule, the entry attribute will not be modified when the entry is transmitted within an AS; the next hop of the BGP route learned through the IBGP neighbor may be unreachable; the entry is not optimal;
[r2-bgp]peer 3.3.3.3 next-hop-local
[r2-bgp]peer 4.4.4.4 next-hop-local
[r4-bgp]peer 3.3.3.3 next-hop-local
[r4-bgp]peer 2.2.2.2 next-hop-local
When the BGP route is passed to the local neighbor 3.3.3.3, the next hop address is changed to the local source IP address that establishes a neighbor relationship with 3.3.3.3.
When the route entry is passed to the local EBGP neighbor, the attributes will automatically change, including the next Jump address
Checking the BGP table shows that all loopbacks can communicate