Showing posts with label BGP. Show all posts
Showing posts with label BGP. Show all posts

Wednesday, May 23, 2018

Challenge: BGP

I was hanging out in theLANtamer's Discord server and a friend showed me this challenge.

I later found out after I had completed the challenge, it was a BGP challenge from the Great Vinit Jain (https://twitter.com/vinugenie) from his Cisco Live presentation, at around 12 minutes in: ( https://www.ciscolive.com/global/on-demand-library/?search=BRKRST%203320#/video/1519328378542002IVEW )


The Challenge:


The Solution:


The Configs:


R1:



hostname R1

interface Loopback100
 ip address 100.1.1.1 255.255.255.255

interface FastEthernet0/0
 description "To R2"
 ip address 10.1.12.1 255.255.255.0


router bgp 100
 bgp log-neighbor-changes
 network 100.1.1.1 mask 255.255.255.255
 neighbor 10.1.12.2 remote-as 200


R2:



hostname R2

ip vrf 200
 rd 200:200


interface FastEthernet0/0
 description "To R1"
 ip vrf forwarding 200
 ip address 10.1.12.2 255.255.255.0

interface FastEthernet1/0
 description "To R3"
 ip vrf forwarding 200
 ip address 10.1.23.2 255.255.255.0


router bgp 200
 bgp log-neighbor-changes
 !
 address-family ipv4 vrf 200
  neighbor 10.1.12.1 remote-as 100
  neighbor 10.1.12.1 activate
  neighbor 10.1.23.3 remote-as 100
  neighbor 10.1.23.3 activate
  neighbor 10.1.23.3 as-override
 exit-address-family


R3:


hostname R3

interface FastEthernet0/0
 description "To R4"
 ip address 10.1.34.3 255.255.255.0

interface FastEthernet1/0
 description "To R2"
 ip address 10.1.23.3 255.255.255.0

router bgp 250
 bgp log-neighbor-changes
 neighbor 10.1.23.2 remote-as 200
 neighbor 10.1.23.2 local-as 100 no-prepend replace-as
 neighbor 10.1.34.4 remote-as 200
 neighbor 10.1.34.4 local-as 200 no-prepend replace-as


R4:


hostname R4

interface FastEthernet0/0
 description "To R3"
 ip address 10.1.34.4 255.255.255.0

interface FastEthernet1/0
 description "To R5"
 ip address 10.1.45.4 255.255.255.0

router bgp 200
 bgp log-neighbor-changes
 neighbor 10.1.34.3 remote-as 200
 neighbor 10.1.45.5 remote-as 300


R5:


hostname R5

interface FastEthernet1/0
 description "To R4"
 ip address 10.1.45.5 255.255.255.0

router bgp 300
 bgp log-neighbor-changes
 neighbor 10.1.45.4 remote-as 200


R5 - Verify:


R5#sho ip bgp
BGP table version is 13, local router ID is 10.1.45.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  100.1.1.1/32     10.1.45.4                              0 200 200 200 i
R5#

Sunday, December 3, 2017

TIL: as-path prepending

Today I learned: You can prepend any AS numbers in the prepended string.


They typical method of as-path prepending is to prepend or add your autonomous system number to the AS_PATH attribute to influence inbound traffic patterns.

You can technically add any autonomous system to the AS_PATH even AS's that don't belong to you.

NOTE: This is frowned upon in production. "Just because you can doesn't mean you should!"

See the example below:

Without context or a topology this seems a little bland but the results are there. You can see from the BGP table below we have prepended a bunch of AS's that do not belong to us.

Prepeding configured out-bound from R3 --> R1:


R3#sho run | s as-path|route-map|router bgp
router bgp 200

 neighbor 155.1.13.1 remote-as 100
 neighbor 155.1.13.1 route-map AS_254 out

ip as-path access-list 254 permit ^254$

route-map AS_254 permit 10
 match as-path 254
 set as-path prepend 254 250 123

route-map AS_254 permit 20


Showing the R1 partial BGP table:


R1#sho ip bgp neighbors 155.1.13.3 routes

[ ... OUTPUT OMITTED ... ]

     Network          Next Hop            Metric LocPrf Weight Path
 *>  28.119.16.0/24   155.1.13.3                             0 200 54 i
 *>  28.119.17.0/24   155.1.13.3                             0 200 54 i
 *   51.51.51.51/32   155.1.13.3                             0 200 254 250 123 254 ?
 *   205.90.31.0      155.1.13.3                             0 200 254 250 123 254 ?
 *   220.20.3.0       155.1.13.3                             0 200 254 250 123 254 ?
 *   222.22.2.0       155.1.13.3                             0 200 254 250 123 254 ?


Credit: This was influenced by a lab from the INE workbook.