BGP knowledges
BGP neighbor states
- idle
- connect
- active
- opensent
- openconfirm
- establisted
BGP message type
- open
- keepalive
- update
- notification
Requirements of forming ebgp neighborship
-AS numbers must match
-Router ID must be different
-if exits md5 auth must pass
Router ID
-configured / highest loopback / higheset other ( up )
MD5 auth
neighbor 192.168.1.1 password almakorte
Preferred option loopback ip source of bgp endpoints
1. configure ip address of loopback interface each router
R1(config)#interface loopback0
R1(config)#ip address 192.168.1.1 255.255.255.255
R2(config)#interface loopback1
R2(config)#ip address 192.168.2.1 255.255.255.255
2. Configure each router to update source
R1(config)#neighbor 192.168.2.1 55000
R1(config)#neighbor 192.168.2.1 update-source loopback0
R1(config)#neighbor 192.168.2.1 ebgp-multihop 2
R2(config)#neighbor 192.168.1.1 55001
R2(config)#neighbor 192.168.1.1 update-source loopback1
R2(config)#neighbor 192.168.1.1 ebgp-multihop 2
Verify ebgp status
show ip bgp summary
memory, and neighbors stats
show ip bgp neighbors
show ip bgp neighbors neighbors neighbor_id
neighbor id, remote as, external/internal link, state of bgp session, uptime, router refresh message counters, hop count, tcp-session ports
show tcp brief
Routing table
show ip bgp
- s -> supressed
- d -> dumped
- h -> history
- * -> valid
- > -> best
- i -> internal
- r -> ribfaulure
- S -> stale
show ip bgp 0.0.0.00.0.0.0
avaidable routers with as_path interal/external, best mark
controlling neighbor status
neighbor neighbor_ip shutdown
BGP path attributes
- next hop
- weight
- local preference
- as_path
- origin
- multi_exit discriminator (MED)
BGP best Path Attributes
0. Next hop is reachable?
1. Weight ( bigger is preferred )
2. Local_pref ( bigger is preferred )
3. Locally injected routes
4. As Path Length
5. Origin
6. MED ( smaller )
7. Neighbor type ( ebgp is preferred than igbp )
8. Igp metric to next hop
Weight
- It is a cisco attribute and assigned locally to the router.
- 0-65535
- higher weight is preferred
neighbor 192.0.80.2 weight 300
Local pref
- whitch path is preferred to exit the AS
- default=100
set default local preference
neighbor 192.0.80.2 remote-as 30
bgp default local-preference 200
set local preference with route-map
ip as-path 7 permit ^300$
route-map almakorte permit 10
match as-path 65101
set local-preference 400
router-map almakorte permit 20
set local-preference 140
neighbor 192.0.80.2 almakorte in
Metric
- also called Multi Exit Discriminator
- Is a hint to external neighors about the preferred path into an as
- Lower is preferred
- exhanged between ASs
bgp always-compared-med if is have to set and compare between ASs
With route-map
route-map setmetric 10 permit
set metric 120
neighbor 192.0.80.2 route-map setmetric out
Default metric
default-metric 10
Community attribute
- Transitive, optional attribute in the range 0- 4,294,967,200
- Is a way to group destinations in a centrain community and apply routig decisions
set community community-number [additive]
With route-map
ip access-list standard 1
10 permit ip host 192.168.25.2
route-map setcommunity permit 10
math ip address 1
set community 200 additive
router bgp 100
neighbor 192.0.20.1 remote-as 300
neighbor 192.0.20.1 send-community
neighbor 192.0.20.1 route-map setcommunits out
BGP good to know
Path filtering
ip as-path access-list 1 deny ^200$
ip as-path access-list 1 permit .*
neighbor 192.0.20.2 filter-list 1 out
BGP regular expressions
single characters
. any single character
^ matches the beginning or the input string
$ and of an input string
\character match the caracter
- match one of the following characters , { } ^ $ space
single character follows by this
* 0 or more
+ 1 or more
? match the atom or the null string
Expressions:
_100_ -> via AS100
^100$ -> origin
^100 .* come from
^$ form this as
as-path prepend
- Able the manipulate as-path
route-map SETASPATH
set as-path prepend 300 300
peer-groups
- more peers with same policie
neighbor 192.0.80.2 peer-group almakorte
neighbor 192.0.82.2 peer-group almakorte
neighbor almakorte remote-as 300