Advertisements
Home

BGP Configuration (Part 2)

2 Comments

Today…we learn about how to change path the packets travel in BGP environment, in IGP such as OSPF…we can modify the metric or even Administrative Distance (AD)

In BGP we call them Path Attributes…

Some say…Path Attributes in BGP is like Metric in IGP Analogy, Some say…Path Attribute is different at all

All we know is…He’s Called THE STIG !!!

The design we throughout the article is like this

=====================================================

Initial Config

Hey…in R1 and R2 we use network command, but in R3 we use redistribute connected ?!?

I just want to show you that both command function do the same effect…advertise route

But the difference is..Network command do advertise route that we exactly want to advertise

But in redistribute connected, ALL OF CONNECTED ROUTE will be advertised

So which is better ?! of course network command, redistribute make router do processing alot more

Remember, redistribute command is used when we want to “join” different routing protocols right ?!?

========================================================

BGP Route Change with Path Attibute called “WEIGHT”

See the BGP Theory (warning: in Indonesian Language/Bahasa) for the list of BGP Path Attributes

When we see the picture above, AS 1 want to sent packet to AS 3…It send directly to AS 3 (13.13.13.3 – R3)

But lets change it, we want to sent packet to AS 2 first, and then to AS 3

Explanation:

  • We using route-map for setting weight value
  • Default Weight value is ZERO(0)..just check in show ip bgp, and the weight value is defined on Cisco Router only
  • ALWAYS USE route-map in for weight (because we want to “weighten” the inbound interface which is affecting the outbound connection)
  • And then clear ip bgp peering first to see the effect

Lets trace it

Done…the packet sent to R2 (12.12.12.2) first, and then to AS 3

Note: why do we have to input trace [ip] source [ip] ?!?

Because if we just trace without defining which interface ip we use, default interface to send is physical one first

Lets see…

Now lets check in R3…is there any route to 12.12.12.2 ?!?

Thats why we can’t ping/trace without mentioning the source ip, because when we configure BGP, we not advertising 12.12.12.0 (using network command) to BGP right ?!?

===============================================

BGP Route Change with Path Attibute called “MED”, ” Local Pref”, and AS PATH”

It is the same like weight configuration, just differ in route-map

MED

Local Preference

Explanation:

  • In MED (Multi Exit Discriminator), the lowest one is preferred
  • In Weight and Local Pref, the Heaviest value is preferred

Choosing best route via AS Path

Explanation:

  • AS 1 send packet to AS 3 directly, from AS 1-to-AS 3 (1 -> 3), how do we change it to send via AS 1-to-AS 2-to-AS 3 (1 -> 2 -> 3) ?!?
  • Prepend it !!! (make it longer)…the longer the path, the most unreliable to send packet
  • Lets see the example:

  • from the value ?!? just look at the next hop AS path…after AS 1…to AS 3….isn’t it obvious it will choose the second path ?!?
  • So thats why I’m typing prepend 3 3 3 3 3 (just to make that route longer to read literally, BGP doest read the VALUE of number for AS_PATH selection eventhough the next-hop AS Path is number 3)

Lets check it…

See…the best path to 3.3.3.3 now to R2 then to R3

But we see the 13.13.13.0 and 23.23.23.0 in the show ip bgp 3.3.3.3 also get the same effect, isn’t it dangerous ?!? yes..

Thats why we use another route-map for filtering which AS_PATH get the prepend

now only route 3.3.3.3 that get the prepend effect

Note for BGP MED and Local Pref:

When Local ISP choose the best path/route to another ISP, they use Local Pref

But when Another ISP want to send packet to Local ISP, local ISP can use MED to select which door/route that Allowed for Another ISP

You can say “traffic from Indonesia goes to Singapore first before entering China” (Local Pref, configured in Indonesia)

but traffic from China to Indonesia only accepted if travel to Malaysia first before entering Indonesia” (MED, configured in Indonesia)

we can force to use MED by typing bgp always-compare-med and bgp deterministic-med in router bgp [as] sub-config

Choosing best route via Origin

when the next hop AS Path is same from all direction to destination, BGP choose Origin attribute

Origin means “where this AS Path originally came from

take a look at this pic

ORIGIN X

just look at the origin status code…BGP prefer path from  i-BGP > e-BGP > incomplete

take a look at the new design I draw here…

ORIGIN MAP

R1 want to send packet to 4.4.4.4 in R4

here is the initial configuration (just change the respectives IP in R2, R3, R4)

ORIGIN SHOW IP BGP

from show ip bgp, we know that if R1 want to send packet to 4.4.4.4, He had two options…using AS 2 Route…,or using AS 3 route

which way does R1 take ?!?

now we trace it…

ORIGIN TRACE 1

why R1 choose AS 2 ?!? because of BGP behavior that cannot perform load balancing, the first one that enter R1 routing table…that is the primary route (I’m configuring AS 2 right after AS 1 configuration is done, thats why R1 choose AS 2)

now lets change the BGP Attribute called ORIGIN, lets change AS 2 route become “incomplete” (incomplete means this route came from something others than BGP, such as Redistribution)

ORIGIN CONFIG

Explanation:

  • because AS 2 came from 12.12.12.2 (R2), I use route-map in this neighbor
  • and to forbid anoher network get the “incomplete” status, i’m filtering them using ACL

let see the effect

ORIGIN AFTER CONFIG

done…now R1 route to 4.4.4.4 si via AS 3

remember the rules… i-bgp > e-bgp >incomplete (?)

let see if I change AS 2 path to e-bgp origin

ORIGIN AFTER 2

it still chooes AS 3 over AS 2

BGP Route Selection Process in brief:

1. Weight (Cisco Only)

2. Local Preference

3. AS-Path

4. Origin

5. MED (if all of the above requirement is same value)

next…advanced BGP (Insya Allah)

Advertisements

BGP (Border Gateway Protocol)

7 Comments

BGP adalah salah satu routing protocol selain RIP, EIGRP, & OSPF

klo RIP, EIGRP, & OSPF tugas nya menghubungkan router satu dengan router yang lain (Interior Gateway Protocol / IGP)

klo BGP ini EGP (Emang Gua Pikirin *maap* Exterior Gateway Protocol), menghubungkan antar AS

BGP ini tugasnya menghubungkan antar ISP (yang masing2 ISP punya nomor unique sendiri2 yang disebut AS / Autonomous System)

AS = collection of networks under single administration

lalu apa bedanya AS EIGRP dengan AS BGP (ISP) ??? AS EIGRP itu kek OSPF Area…beda antara mereka adalah

  • OSPF
    • Area OSPF beda bisa saling terhubung (asal terhubung ke area 0 atau kondisi lainnya terpenuhi)
    • Update hanya berlangsung dan di proses di Area itu saja (tidak nyebar ke Area lain)
  • EIGRP
    • Beda Area (Baca: Beda AS)…ga bisa saling terhubung, HARUS PAKE REDISTRIBUTION

EGP sebener nya routing protocol tersendiri yang terpisah dari BGP, cuma EGP uda obsolete(kuno)…akhirnya BGP itu sendirilah yang diafiliasikan dengan EGP

nah…klo AS EIGRP bisa kita set sendiri (toh masih IGP…masi didalam satu ISP), klo AS BGP yang ngatur adalah IANA (ICANN) tepatnya RIR (Regional Internet Registry)

RIR ini adalah anak organisasi IANA yang ngatur alokasi IP (public) dan AS BGP (link IANA vs ICANN)

ada 5 RIR:

  • AfriNIC (African Network Information Centre)
  • APNIC (Asia Pacific Network Information Centre)
  • ARIN (American Registry for Internet Numbers – North America)
  • LACNIC (Latin American and Carribean Network Information Centre)
  • RIPE NCC (Reseaux IP Europeens Network Coordination Centre – Europe, Timur Tengah, Central Asia)

AS BGP itu size nya 16 bit yang berarti dari 1 sampai 65,535, dimana AS 64,512 sampai 65,535 (1023 buah) itu buat private use (mirip ke Private IP)

makanya klo tes ato contoh soal/lab yang menggunakan BGP pasti pake AS yang ga jauh2 dari yang diatas (supaya ga ngambil AS orang/organisasi lain yang Legal)

sekarang sudah ada AS yang 32 bit (yang artinya nomor AS itu bisa ampe 4 milyar, untuk mengatasi depleted AS…kek IP juga yang depleted *facepalm*)

Requirement for Implementing BGP is

  • Public IP address ^_^ (klo ga pake aja NAT)
  • Routing Protocol (bisa statis ato dinamis)

BGP pake TCP port 179 untuk metode pengiriman packet dan triggered update nya

BGP “hold down” timer dikirim tiap 60 detik sekali (istilah di BGP namanya keepalive message)

Any Router that runs BGP is called a BGP speaker.

and Any Router that form BGP neighborship is called BGP Peers.

dibandingkan routing protocol lain, config BGP terhitung paling ribet dan kompleks

klo RIP pake metric nya HOP, IS-IS bandwidth, OSPF cost, EIGRP banyak *wkwkw*

nah klo BGP pake metricnya apa ?? BGP kaga pake metric

BGP itu policy-based routing protocol, dia ngontrol traffic packet berdasarkan attibut2 (bukan metric) yang dia punya

untuk traffic A dia pake attibut X…untuk traffic B dia pake attribut Y..dst

klo IGP router konfig/announce list network-nya (contoh: router rip lalu network x.x.x.x)

klo BGP itu announce network reachability information

contoh:

(sorry…harusnya ip add 1.1.1.1 dan 2.2.2.2)

baik R1 dan R2 men-define neighbor nya (yang pake BGP tentunya)

lalu memutuskan network2 mana saja yang mau dikasi ke neighbornya itu

When to Use BGP??

  • when multi-homed (see below)
  • Network kita (AS Kita) adalah transit AS (menghubungkan AS satu ke yang lain)
  • Inter-AS policy harus di modifikasi

When Not??

  • Single homed (see below)
  • RAM dan CPU router ga cukup kuat untuk menunjang BGP
  • lo kaga bisa make Route-Filtering dan Route-Mapping…hahah

=====================================================

BGP Connectivity Type

single homed: 1 router kita cuma punya 1 jalan ke ISP

single homing biasanya ga pake BGP…pake static route aja cukup

biasanya klo single homing pake BGP tu buat announce public network nya Company ke ISP dan ISP announce default route ke Client (toh untuk internetan doank kan?!?)

dual homed: kita punya 2 router yang punya jalan ke 1 ISP (atau 1 router tapi punya 2 jalan ke ISP)

biasanya tipe ini pake BGP, dan juga IP SLA untuk “bring-up” backup route ato interface nya

dan juga provide buat load balancing antar interface dengan CEF (Cisco Express Forwarding)

apa itu CEF?? klo dulu router ngirim paket lewat routing table, yang mana perlu RAM dan makan CPU, sekarang dengan CEF…routing process itu melalui Hardware

processing routing lewat hardware lebih cepat dari software

multi homed: 1 router lo ke ISP A, 1 router lagi ke ISP B

lebih flexibel, resilient network…disini juga bisa dimplementasikan BGP

tapi hati2…

klo AS 65500 dapet rute 172.16.0.0/16 dari ISP A Router D, (klo kita konfig nya ga bener) trus di Advertise ke ISP-B

maka ISP-B bisa saja menganggap rute 172.16.0.0/16 itu harus lewat AS 65500 (padahal bisa langsung dari ISP B)

alhasil….AS 65500 akan jadi semacam rute transit

nah…salah satu troubleshooting implementasi BGP ya seperti itu…

dual-multi homed: 2 router lo punya link ke masing2 ISP

masalah2 BGP biasanya terdapat di multi-homed dan dual multi-homed (biasanya suboptimal routing)

maksud hati ingin supaya ada rute backup…salah2 konfig, malah rute backup yang ngirimin traffic dari dia ke network kita…repot kan

When BGP is running between routers in different autonomous systems, it is called External BGP (EBGP).

When BGP is running between routers in the same autonomous system, it is called Internal BGP (IBGP).

trus bedanye apee itu be-2?!?!

klo E-BGP itu untuk menghubungkan ISP satu dengan yang lain

klo I-BGP itu seperti contoh dibawah ini:

Customer A (AS 65010) punya dual ISP (1 Main 1 Backup), masing2 ISP kirim default-route nya masing2

nah, taro lah ISP 1 jadi main Route (karena Metric IGP ato karena konfig dari R1&R2)

Customer A ingin kirim traffic ke 172.17.0.0 (di ISP 2 network)

karena ISP 1 jadi main route…it may cause suboptimal route, because to send data into 172.17.0.0 network must travel to ISP 1 first instead of ISP 2 (network 172.17.0.0 kan adanya di ISP 2)

nah, R1 dan R2 memakai BGP internal untuk mereka sendiri guna menentukan best path to destination based on policy yang mereka buat (inget…BGP itu policy based routing)

jadi kek R1 & R2 ngobrol…”yuk..klo kirim data A lewat sini…data B lewat sana

inilah yang dinamakan I-BGP

untuk ngobrol R1 dan R2 dalam menentukan rute keluar pake I-BGLu (ai-biji lu !!…hhahaha)…I-BGP maksudnya

untuk ngobrol R1 dan R2 dengan masing2 ISP disebut E-BGP

makanya…BGP sering juga disebut Path Vector Protocol

dan karena BGP behavior itu policy-based…this protocol cannot perform Load-balancing

==================================================

BGP Message Type

1. Open Message

didalam nya terdapat beberapa informasi

  • Version number: BGP version
  • AS Number
  • Hold Time: jarak waktu interval antara successive keepalive dan update message dari pengirim (dalam detik)
  • BGP Router ID: 32 bit size, BGP ID ini sama persis kek OSPF Router ID (bahkan proses pemilihannya juga)
  • Optional Parameter: authentication (klo ada, namanya juga optional ^_^ )

2. Keepalive Message

keepalive message ini untuk me-refresh hold time supaya ga expiring (klo expired hold timenya, BGP adjacency nya putus)

3. Update Message

BGP update message hanya punya informasi untuk 1 jalur saja, maksudnya ??

klo IGP kirim update message ke suatu router, isinya adalah jalur2/rute2 yang dia ketahui

klo BGLu *ehm* BGP maksudnya…kirim update message ke suatu router, hanya 1 jalur…lebih dari 1 jalur = lebih dari 1 update message

eh…gw punya update nih…gw tau jalan ke network A” = 1 update message

eh…gw punya update nih…gw tau jalan ke network A, trus ke network B, trus ke network C” = 3 update message

isi dari Update Message:

  • Withdrawn Routes:

    berisi list2 dari Route2 yang dicabut (termasuk IP Prefix nya) dari BGP (jadi kek kasi notifikasi gitu loh)

  • Path attributes:

    isinya “metric2” alias attribute2 dari BGP…kek AS Path, Origin, Local Preference, dll

  • Network-Layer Reachability Information:

    kebalikan dari Withdrawn Route, isinya adalah rute2 yang reachable oleh BGP

4. Notification Message

ini mah klo ada error…hahaha

===========================================

BGP “Metric” that called Attributes

BGP ga punya metric, cuma karena gw tau lo uda terbiasa ama metric…gw bilang aja ini “seakan2” metric…hahaha

BGP Attribute inilah yang bertugas men-decide mana best path (best route), remember BGP cannot Load Balancing…only 1 path (but can perform load sharing)

Load sharing
is the ability to distribute incoming/outgoing traffic over multiple paths

Load balancing
is the ability to split the load (split packet) toward the same destination (host or IP) over multiple paths.

  • “Well-Known” BGP Attributes (attribut2 BGP yang harus “dikenali” oleh BGP Speaker ketika peering)
    • Mandatory “Well-Known” (attribut2 yang harus appear disetiap update message)
      • Origin = tempat asal dari BGP route…apakah itu rute BGP di-announce oleh IGP router, oleh BGP router yang lain, ato dari redistribusi
      • AS-Path = ini kek ip route…cuma namanya kita ganti jadi AS Route
      • Next-Hop = ip address dari next -hop router
    • Discretionary “Well-Known” (may / may not appear in update message, tapi tetap harus disupport klo di implementasikan ini attribut)
      • Local Preference =rute BGP yang diterima dari BGP neighbor, default value nya adalah 100
      • Aggregation = klo di IGP ini attribute dinamakan “Route Summarization
  • Optional BGP Attribute (atribut2 BGP yang disupport atau tidak disupport oleh BGP Speaker)
    • Transitive (support ato ga support itu BGP Speaker yang receive  update, kalo update message nya contain attribute ini…tetep harus di-pass ke next AS, kali2 aja AS lain tau attribute2 itu buat apa)
      • Aggregator = IP address dan AS number nya si Router yang perform route aggregation
      • Community = isi nya route-tagging…nah lo…
    • Non-Transitive (klo pun ga support, BGP Receiver…ga ada kewajiban untuk ngoper update nya ke AS lain)
      • MED (multi exit discriminator) = attribute ini berguna untuk membedakan/memisahkan multiple entry points yang masuk kedalam satu AS

Next Hop BGP Attibutes

BGP 1

biasanya next-hop emang ip address dari sending router nya

BGP 2

tapi akan bahaya klo switch nya FRAME-RELAY (NBMA)

BGP 3

BGP Path Selection Process (klo ada beberapa path/jalur ke satu tempat yang sama)

  1. Weight (Cisco Propiertary), klo lo konfig BGP…yang pertama diliat adalah Weight untuk menentukan best path (local router akan nentuin mana Weight yang lebih besar untuk best path.., INGET…CISCO ONLY

    weight ini value nya dari 0 – 65535, defaultnya 32768 (dari Router itu sendiri) dan 0 dari dari path lain, weight ini hanya dikonfig di router local dan ga dikasi ke router lainjadi weight ini ibarat kita setting di router, yang mana dari path2 BGP ini yang kita “beratin timbangannya“, untuk dipilih duluan adalah yang paling berat

  2. Local Preference, klo attribute Weight nya sama (Cisco) atau klo vendor lain…ini yang dilihat selanjutnya, para router di AS yang sama akan ngeliat attribute ini

    yang paling tinggi yang dipilih. default value nya adalah 100

  3. Default Route, klo local preference dari beberapa path yang ditawarkan BGP itu sama, di local router akan memilih Default Route
  4. Shortest AS Path, klo ga ada default route, para router akan ngeliat berdasarkan path AS yang paling pendek (kek RIP…yang paling kecil AS hop count nya)
  5. klo masih sama, liat dari Origin of path (yang paling kecil yang dipilih), para router akan memilih best path yang dipilihkan oleh IGP (IGP origin < EGP Origin)
  6. MED (multi exit discriminator), ini tu bisa diibaratkan BGP metric, jika origin sama (tarolah dari 1 EIGRP AS), MED ini di-exchange between AS, yang paling rendah yang dipilih
  7. prefer liat i-BGP daripada e-BGP
  8. prefer shortest Path to closest IGP Neighbor, jadi router milih jalan terdekat ke BGP Speaker (masih dalam IGP yang sama)
  9. prefer oldest route, liat route yang paling lama di routing table (cocok untuk interface BGP yang up down terus2an…alias “flapping”)
  10. prefer lowest BGP Router ID
  11. jika sama BGP Router ID nya, prefer lowest IP address

banyak kan ?!?!?! @_@

dan attribute2 itulah yang kita setting untuk BGP

belum lagi ada regular expression (REGEXP) kek ^, $, [], , (), ., *, +, ? untuk modifikasi Shortest AS Path yang kita mo buat

konfig BGP nya dibagi jadi 4 part…silakan liat di indeks