# Wiki source code of Setting up an BGP Neighborship Connection

Last modified by Jean Franco on 2024/06/09 20:48
Export
Office Formats
Export as PDF Export as ODT Export as RTF
Other Formats

Select the pages to export:

select all/ none

Legend:
  Created Page
  Modified Extension Page
  Clean Extension Page

Export as HTML

Show last authors

author | version | line-number | content
--- | --- | --- | ---
|  | 1 | [[//In the example diagram above, an eBGP neighborship is set up between ER-L (**AS 64512**) and ER-R (**AS 65000**) which allows the neighbors to exchange routing information. In this case, ER-L will advertise the 198.51.100.x/26 networks to ER-R. //>>image:1-topology.png]]
|  | 2 |
|  | 3 | Follow the steps below to configure the BGP protocol on both routers:
|  | 4 |
|  | 5 | **CLI:** Access the Command Line Interface on ER-L.You can do this using the CLI button in the GUI or by using a program such as PuTTY.
|  | 6 |
|  | 7 | ~1. Enter configuration mode.
|  | 8 |
|  | 9 | {{{configure}}}
|  | 10 |
|  | 11 | 2. Define the BGP Autonomous System (AS) number and the Router ID.
|  | 12 |
|  | 13 | Copy
|  | 14 |
|  | 15 | {{{set protocols bgp 64512 parameters router-id 203.0.113.1}}}
|  | 16 |
|  | 17 | 3. Define the IP address and AS number used by the BGP neighbor.
|  | 18 |
|  | 19 | Copy
|  | 20 |
|  | 21 | {{{set protocols bgp 64512 neighbor 192.0.2.1 remote-as 65000}}}
|  | 22 |
|  | 23 | 4. As the neighbors are not directly connected, enable **ebgp-multihop** and additional options such as **soft-reconfiguration**.
|  | 24 |
|  | 25 | Copy
|  | 26 |
|  | 27 | {{{set protocols bgp 64512 neighbor 192.0.2.1 ebgp-multihop 255
|  | 28 | set protocols bgp 64512 neighbor 192.0.2.1 soft-reconfiguration inbound}}}
|  | 29 |
|  | 30 | **NOTE:**The value set in the **ebgp-multihop...** command can be customized.
|  | 31 |
|  | 32 | 5. Create **blackhole** routes for the 198.51.100.x/26 networks that should be advertised into BGP.
|  | 33 |
|  | 34 | Copy
|  | 35 |
|  | 36 | {{{set protocols static route 198.51.100.0/26 blackhole
|  | 37 | set protocols static route 198.51.100.64/26 blackhole
|  | 38 | set protocols static route 198.51.100.128/26 blackhole
|  | 39 | set protocols static route 198.51.100.192/26 blackhole}}}
|  | 40 |
|  | 41 | 6. Advertise the 198.51.100.x/26 routes into BGP by using the **network** statement.
|  | 42 |
|  | 43 | Copy
|  | 44 |
|  | 45 | {{{set protocols bgp 64512 network 198.51.100.0/26
|  | 46 | set protocols bgp 64512 network 198.51.100.64/26
|  | 47 | set protocols bgp 64512 network 198.51.100.128/26
|  | 48 | set protocols bgp 64512 network 198.51.100.192/26}}}
|  | 49 |
|  | 50 | **NOTE:**The **network...** statements in BGP must match the routes present in the routing table.
|  | 51 |
|  | 52 | 7. Commit the changes and save the configuration.
|  | 53 |
|  | 54 | {{{commit ; save}}}
|  | 55 |
|  | 56 | **CLI:** Access the Command Line Interface on ER-R.You can do this using the CLI button in the GUI or by using a program such as PuTTY.
|  | 57 |
|  | 58 | ~1. Enter configuration mode.
|  | 59 |
|  | 60 | {{{configure}}}
|  | 61 |
|  | 62 | 2. Define the BGP Autonomous System (AS) number and the Router ID.
|  | 63 |
|  | 64 | Copy
|  | 65 |
|  | 66 | {{{set protocols bgp 65000 parameters router-id 192.0.2.1}}}
|  | 67 |
|  | 68 | 3. Define the IP address and AS number used by the BGP neighbor.
|  | 69 |
|  | 70 | Copy
|  | 71 |
|  | 72 | {{{set protocols bgp 65000 neighbor 203.0.113.1 remote-as 64512}}}
|  | 73 |
|  | 74 | 4. As the neighbors are not directly connected, enable **ebgp-multihop** and additional options such as **soft-reconfiguration**.
|  | 75 |
|  | 76 | Copy
|  | 77 |
|  | 78 | {{{set protocols bgp 65000 neighbor 203.0.113.1 ebgp-multihop 255
|  | 79 | set protocols bgp 65000 neighbor 203.0.113.1 soft-reconfiguration inbound}}}
|  | 80 |
|  | 81 | **NOTE:**The value set in the **ebgp-multihop...** command can be customized.
|  | 82 |
|  | 83 | 5. Commit the changes and save the configuration.
|  | 84 |
|  | 85 | {{{commit ; save}}}
|  | 86 |
|  | 87 | The BGP neighborship and advertised/received routes can be verified with the following commands:
|  | 88 |
|  | 89 | {{{show ip bgp summary
|  | 90 | show ip bgp
|  | 91 | show ip bgp neighbors 192.0.2.1 advertised-routes
|  | 92 | show ip bgp neighbors 192.0.2.1 received-routes}}}
|  | 93 |
|  | 94 |
|  | 95 | == Additional BGP Options ==
|  | 96 |
|  | 97 | There are many other BGP options and additional features that can be configured when using BGP. Some of the more popular options are:
|  | 98 |
|  | 99 | * Route-Maps
|  | 100 | * Prefix-Lists
|  | 101 | * BGP Communities
|  | 102 | * Peer Groups
|  | 103 | * Route Reflectors
|  | 104 | * Confederations
|  | 105 |
|  | 106 | See the output below for a list of available commands (output may differ between firmware versions):
|  | 107 |
|  | 108 | {{{set protocols bgp 64512 ?
|  | 109 | Possible completions:
|  | 110 | address-family BGP address-family parameters
|  | 111 | aggregate-address BGP aggregate network
|  | 112 | dampening Enable route-flap dampening
|  | 113 | maximum-paths BGP multipaths
|  | 114 | neighbor BGP neighbor
|  | 115 | network BGP network
|  | 116 | parameters BGP parameters
|  | 117 | peer-group BGP peer-group
|  | 118 | redistribute Redistribute routes from other protocols into BGP
|  | 119 | timers BGP protocol timers
|  | 120 |
|  | 121 | set protocols bgp 64512 parameters ?
|  | 122 | Possible completions:
|  | 123 | always-compare-med Always compare MEDs from different neighbors
|  | 124 | bestpath Default bestpath selection mechanism
|  | 125 | cluster-id Route-reflector cluster-id
|  | 126 | confederation AS confederation parameters
|  | 127 | dampening Enable route-flap dampening
|  | 128 | default BGP defaults
|  | 129 | deterministic-med Compare MEDs between different peers in the same AS
|  | 130 | distance Administratives distances for BGP routes
|  | 131 | enforce-first-as Require first AS in the path to match peer's AS
|  | 132 | graceful-restart Graceful restart capability parameters
|  | 133 | log-neighbor-changes Log neighbor up/down changes and reset reason
|  | 134 | no-client-to-client-reflection Disable client to client route reflection
|  | 135 | no-fast-external-failover Disable immediate sesison reset if peer's connected link goes down
|  | 136 | router-id BGP router id
|  | 137 | scan-time BGP route scanner interval
|  | 138 |
|  | 139 | set protocols bgp 64512 neighbor 192.0.2.1 ?
|  | 140 | Possible completions:
|  | 141 | address-family Parameters relating to IPv4 or IPv6 routes
|  | 142 | advertisement-interval Minimum interval for sending routing updates
|  | 143 | allowas-in Accept a route that contains the local-AS in the as-path
|  | 144 | attribute-unchanged BGP attributes are sent unchanged
|  | 145 | capability Advertise capabilities to this neighbor
|  | 146 | default-originate Send default route to this neighbor
|  | 147 | description Description for this neighbor
|  | 148 | disable-capability-negotiation Disable capability negotiation with this neighbor
|  | 149 | disable-send-community Disable sending community attributes to this neighbor
|  | 150 | distribute-list Access-list to filter route updates to/from this neighbor
|  | 151 | ebgp-multihop Allow this EBGP neighbor to not be on a directly connected network
|  | 152 | fall-over Fall-over detection
|  | 153 | filter-list As-path-list to filter route updates to/from this neighbor
|  | 154 | local-as Local AS number
|  | 155 | maximum-prefix Maximum number of prefixes to accept from this neighbor
|  | 156 | nexthop-self Nexthop for routes sent to this neighbor to be the local router
|  | 157 | no-activate Disable the Address Family for this Neighbor
|  | 158 | override-capability Ignore capability negotiation with specified neighbor
|  | 159 | passive Do not initiate a session with this neighbor
|  | 160 | password BGP MD5 password
|  | 161 | peer-group IPv4 peer group for this peer
|  | 162 | port Neighbor's BGP port
|  | 163 | prefix-list Prefix-list to filter route updates to/from this neighbor
|  | 164 | remote-as Neighbor BGP AS number [REQUIRED]
|  | 165 | remove-private-as Remove private AS numbers from AS path in outbound route updates
|  | 166 | route-map Route-map to filter route updates to/from this neighbor
|  | 167 | route-reflector-client Neighbor as a route reflector client
|  | 168 | route-server-client Neighbor is route server client
|  | 169 | shutdown Administratively shut down neighbor
|  | 170 | soft-reconfiguration Soft reconfiguration for neighbor
|  | 171 | strict-capability-match Enable strict capability negotiation
|  | 172 | timers Neighbor timers
|  | 173 | unsuppress-map Route-map to selectively unsuppress suppressed routes
|  | 174 | update-source Source IP of routing updates
|  | 175 | weight Default weight for routes from this neighbor}}}

# Applications

# Tips

Did you know that you can improve XWiki? Take 5 minutes to fill this survey and help this open source project!

Maila Networks
XWiki Debian 14.4.1