BGP LAB Guide v1.2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

BGP LAB Guide

BGP LAB Guide

1. BGP -iBGP Configuration


2. BGP -iBGP Update via Loopback
3. BGP –eBGP Configuration
4. BGP Attribute -Weight
5. BGP Attribute – Local Pre

1
1. BGP -iBGP Configuration

Lab 1 Skenario:
sebuah router yang menjalankan routing BGP dalam satu AS yang sama,
dinamakan dengan iBGP (internal BGP). Agar bisa saling terhubung, maka
setiap router harus melakukan peering ke semua router di AS tersebut,
sehingga terciptalah topologi iBGP full mesh. di Lab ini akan kita lakukan
peering menggunakan IP Interface Fisik

Konfigurasi
R1
R1(config)#int gig0/0
R1(config-if)#ip add 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#router ospf 1
R1(config-router)#net 12.12.12.0 255.255.255.255 area 0

R2
R2(config)#int gig 0/0
R2(config-if)#ip add 12.12.12.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int gig0/1
R2(config-if)#ip add 23.23.23.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#router ospf 1
2
R2(config-router)#net 23.23.23.0 0.0.0.255 area 0
R2(config-router)#net 12.12.12.0 0.0.0.255 area 0

R3
R3(config)#int gig0/1
R3(config-if)#ip add 23.23.23.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#int gig0/0
R3(config-if)#ip add 34.34.34.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#router ospf 1
R3(config-router)#network 23.23.32.0 0.0.0.255 area 0
R3(config-router)#passive-interface fa0/0

Pastikan R1 bisa Ping ke R3


R1
R1#ping 23.23.23.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.23.23.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/3 ms

Konfigurasi iBGP

R1
R1(config)#router bgp 10
R1(config-router)#neighbor 12.12.12.2 remote-as 10
R1(config-router)#neighbor 23.23.23.2 remote-as 10

3
R2
R2(config)#router bgp 10
R2(config-router)#neighbor 12.12.12.1 remote-as 10
R2(config-router)#neighbor 23.23.23.2 remote-as 10

R3
R3(config)#router bgp 10
R3(config-router)# neighbor 23.23.23.1 remote-as 10
R3(config-router)# neighbor 12.12.12.1 remote-as 10

Verifikasi pada router IOS


show ip bgp summary
show ip bgp
show ip route

Selanjutnya Cek show ip bgp summary pastikan sudah neighbornya sudah


ada.

R1#show ip bgp sum


Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State /PfxRcd
12.12.12.2 4 10 39 39 2 0 0 00:32:49

4
R3#sh ip bgp sum
BGP router identifier 23.23.23.2, local AS number 10
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
23.23.23.1 4 10 19 19 1 0 0 00:13:41

Sekarang buat interface loopback yang akan di advertise ke iBGP.


R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config)#router bgp 10
R1(config-router)#network 1.1.1.1 mask 255.255.255.255

Cek ping dan sukses.


R3#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

5
2. BGP -iBGP Update via Loopback

Lab 2 Skenario: Selain bisa melakukan peering ke semua router menggunakan IP


Interface fisik, routing BGP juga bisa terbentuk peering antar router menggunakan
Interface logic / loopback. Hal ini biasanya dilakukan untuk beberapa keperluan
seperti: Load Balancing (ECMP), menjaga kestabilan, dan fleksibilitas port.

Konfigurasi
Buat dulu IP addres di R1, R2 , R3, dan Loopback R1,R2,R3
R1
R1(config)#int fa0/0
R1(config-if)#ip add 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no sh
R1(config)#int lo1
R1(config-if)#ip add 11.11.11.11 255.255.255.255
R1(config-if)#no sh

6
R2
R2(config)#int fa0/0
R2(config-if)#ip add 12.12.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config)#int fa0/1
R2(config-if)#ip add 23.23.23.1 255.255.255.0
R2(config-if)#no shutdown
R2(config)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config-if)#no shutdown
R2(config)#int lo1
R2(config-if)#ip add 22.22.22.22 255.255.255.255
R2(config-if)#no shutdown

R3
R3(config)#int gig0/0
R3(config-if)#ip add 34.34.34.1 255.255.255.0
R3(config-if)#no sh
R3(config)#int gig0/1
R3(config-if)#ip add 23.23.23.1 255.255.255.0
R3(config-if)#no sh
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#no sh
R3(config)#int lo1
R3(config-if)#ip add 33.33.33.33 255.255.255.255
R3(config-if)#no sh

7
Selanjutnya Buat routing IGP (ospf) , biar antar loopback bisa saling Ping

R1(config)#router ospf 1
R1(config-router)#network 12.12.12.0 0.0.0.255 area 0
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0

R2(config)#router ospf 1
R2(config-router)#network 12.12.12.0 0.0.0.255 area 0
R2(config-router)#network 23.23.23.0 0.0.0.255 area 0
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0

R3(config)#router ospf 1
R3 (config-router)#network 34.34.34.0 0.0.0.255 area 0
R3 (config-router)#network 23.23.23.0 0.0.0.255 area 0
R3 (config-router)#network 3.3.3.3 0.0.0.0 area 0

Selanjutnya kita konfigurasi BGP


R1(config)#router bgp 10
R1(config-router)#network 11.11.11.11 mask 255.255.255.255
R1(config-router)# neighbor 2.2.2.2 remote-as 10
R1(config-router)# neighbor 2.2.2.2 update-source Loopback0
R1(config-router)# neighbor 3.3.3.3 remote-as 10
R1(config-router)# neighbor 3.3.3.3 update-source Loopback0

R2(config-router)#router bgp 10
R2(config-router)#network 22.22.22.22 mask 255.255.255.255
R2(config-router)# neighbor 1.1.1.1 remote-as 10
R2(config-router)# neighbor 1.1.1.1 update-source Loopback0
R2(config-router)# neighbor 3.3.3.3 remote-as 10

8
R2(config-router)# neighbor 3.3.3.3 update-source Loopback0

R3(config)#router bgp 10
R3 (config-router)#network 33.33.33.33 mask 255.255.255.255
R3 (config-router)# neighbor 1.1.1.1 remote-as 10
R3 (config-router)# neighbor 1.1.1.1 update-source Loopback0
R3 (config-router)# neighbor 2.2.2.2 remote-as 10
R3 (config-router)# neighbor 2.2.2.2 update-source Loopback0

Verifikasi pada router IOS


show ip bgp summary
show ip bgp
show ip route

Jadi sekarang Coba ping dari R1 ke R3

R1#ping 33.33.33.33
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 33.33.33.33, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms

9
lalu kita cek apakah prefix R1 dan R3 sudah diterima dari R2

10
3. BGP –eBGP Configuration

Lab 3 Skenario : untuk bisa terhubung dengan jaringan BGP diluar sana
seperti internet, maka router kita harus melakukan peering dengan router lain
yang berbeda AS, sehingga bisa saling bertukar informasi routing dengan
router router yang ada di AS lain diluar sana.

berikut adalah contoh konfigurasi eBGP (external BGP)

Konfigurasi
R1
Router(config)#hostname R1
Router(config)#int gig0/0
Router(config-if)#ip add 12.12.12.1 255.255.255.0
Router(config-if)#no sh
Router(config)#int lo0
Router(config-if)#ip add 1.1.1.1 255.255.255.255

11
Router(config-if)#no shutdown
Router(config)#int lo1
Router(config-if)#ip add 11.11.11.11 255.255.255.255
Router(config-if)#no shutdown

R2
R2 (config)#hostname R2
R2 (config)#int gig0/0
R2 (config-if)#ip add 12.12.12.2 255.255.255.0
R2 (config-if)#no shut
R2 (config-if)#int gig0/1
R2 (config-if)#ip add 23.23.23.1 255.255.255.0
R2 (config-if)#no shut
R2 (config)#int lo0
R2 (config-if)#ip add 2.2.2.2 255.255.255.255
R2 (config-if)#no shut
R2(config)#int lo1
R2(config-if)#ip add 22.22.22.22 255.255.255.255
R2(config-if)#no shut

R3
Router(config)#hostname R3
R3(config)#int gig0/1
R3(config-if)#ip add 23.23.23.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#int gig0/0
R3(config-if)#ip add 34.34.34.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.255

12
R3(config-if)#no shut
R3(config)#int lo1
R3(config-if)#ip add 33.33.33.33 255.255.255.255

R4
R4 (config-if)#int gig0/0
R4 (config-if)#ip add 34.34.34.2 255.255.255.0
R4 (config-if)#no shut
R4 (config-if)#int lo0
R4 (config-if)#ip add 4.4.4.4 255.255.255.255

Selanjutnya, kita buat routing IGP terlebih dahulu sebagai underlay dari
iBGP nya. routing IGP yang kita gunakan yaitu OSPF

R1(config)#router ospf 1
R1(config-router)#network 12.12.12.0 0.0.0.255 area 0
R1(config-router)#network 1.1.1.1 0.0.0.0 area 0

R2(config)#router ospf 1
R2(config-router)#network 12.12.12.0 0.0.0.255 area 0
R2(config-router)#network 23.23.23.0 0.0.0.255 area 0
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0

R3(config)#router ospf 1
R3(config-router)#network 23.23.23.0 0.0.0.255 area 0
R3(config-router)#network 3.3.3.3 0.0.0.
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0

13
Setelah kita buat routing IGP pastikan R1 bisa PING ke R3
R1#ping 3.3.3.3 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 2/2/2 ms

Lalu lanjut buat Routing BGP


R1
R1(config)#router bgp 10
R1(config-router)#network 11.11.11.11 mask 255.255.255.255
R1(config-router)#neighbor 2.2.2.2 remote-as 10
R1(config-router)#neighbor 2.2.2.2 update-source lo0
R1(config-router)#neighbor 3.3.3.3 remote-as 10
R1(config-router)#neighbor 3.3.3.3 update-source lo0

R2
R2(config)#router bgp 10
R2(config-router)#network 22.22.22.22 mask 255.255.255.255
R2(config-router)#neighbor 1.1.1.1 remote-as 10
R2(config-router)#neighbor 3.3.3.3 remote
R2(config-router)#neighbor 3.3.3.3 remote-as 10

R3
R3(config-router)#network 33.33.33.33 mask 255.255.255.255
R3(config-router)#neighbor 1.1.1.1 remote-as 10
R3(config-router)#neighbor 1.1.1.1 next-hop-self
R3(config-router)#neighbor 2.2.2.2 remote-as 10
R3(config-router)#neighbor 2.2.2.2 next-hop-self

14
Konfigurasi eBGP Pada R3 dan R4

R3(config)#router bgp 10
R3(config-router)#neighbor 34.34.34.2 remote-as 20
R3(config-router)#network 3.3.3.3 mask 255.255.255.255

R4(config)#router bgp 20
R4 (config-router)#neighbor 34.34.34.1 remote-as 10
R4 (config-router)#network 4.4.4.4 mask 255.255.255.255

Verifikasi pada router IOS


show ip bgp summary
show ip bgp
show ip route

15
4. BGP Attribute –Weight

Lab 4 Skenario: Dalam BGP Path Selection, weight biasa digunakan untuk
menentukan jalur mana yg terbaik yg bisa dilewati si router untuk sampai ketujuan.
Lab kali ini bertujuan untuk dapat memilih jalur routing terbaik dari router yang
mempunyai 2 jalur yg berbeda. Kita akan coba mengkonfigurasi Weight di BGP
Konfigurasi

16
R1
Router(config)#hostname R1
R1(config)#int gig0/0
R1(config-if)#ip add 12.12.12.1 255.255.255.0
R1(config-if)#no shut
R1(config)#int gig0/1
R1(config-if)#ip add 14.14.14.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no shut

R2
Router(config)#hostname R2
R2(config)#int gig0/0
R2(config-if)#ip add 12.12.12.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int gig0/1
R2(config-if)#ip add 23.23.23.1 255.255.255.0
R2(config-if)#no shut
R2(config)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.255

R3
Router(config)#hostname R3
R3(config)#int gig0/1
R3(config-if)#ip add 23.23.23.2 255.255.255.0

17
R3(config-if)#no shut
R3(config)#int gig0/0
R3(config-if)#ip add 34.34.34.1 255.255.255.0
R3(config-if)#no shut
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.255

R4
Router(config)#hostname R4
R4(config)#int gig0/1
R4(config-if)#ip add 14.14.14.2 255.255.255.0
R4(config)#int gig0/0
R4(config-if)#ip add 34.34.34.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int lo0
R4(config-if)#ip add 4.4.4.4 255.255.255.255

Konfigurasi BGP

R1
R1(config)#router bgp 1
R1(config-router)#network 1.1.1.1 mask 255.255.255.255
R1(config-router)#neighbor 12.12.12.2 remote-as 2
R1(config-router)#neighbor 14.14.14.2 remote-as 4

R2
R2 (config)#router bgp 2
R2 (config)# bgp router-id 2.2.2.2
R2 (config-router)#network 1.1.1.2mask 255.255.255.255
R2 (config-router)# neighbor 12.12.12.1 remote-as 1
R2 (config-router)# neighbor 23.23.23.2 remote-as 3

18
R3
R3(config)#router bgp 3
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#network 3.3.3.3 mask 255.255.255.255
R3(config-router)#neighbor 23.23.23.1 remote-as 2
R3(config-router)#neighbor 34.34.34.2 remote-as 4

R4
R4(config)#router bgp 4
R4(config-router)#network 4.4.4.4 mask 255.255.255.255
R4(config-router)#neighbor 34.34.34.1 remote-as 3
R4(config-router)#neighbor 14.14.14.1 remote-as 1

Verifikasi pada router IOS


show ip bgp summary
show ip bgp
show ip route

Traceroute R1 ke R3
R1#traceroute 3.3.3.3 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 3.3.3.3
VRF info: (vrf in name/id, vrf out name/id)
1 12.12.12.2 1 msec 1 msec 2 msec
2 23.23.23.2 2 msec * 2 msec

Dari hasil Traceroute di atas jalur R1 ke R3 melalui R2, Sekarang kita


belokkan jalurnya agar melalui 14.14.14.2 dengan konfigurasi weight
attribute.

19
R1(config)#route-map BpnWeight permit 10
R1(config-route-map)#set weight 700
R1(config)#route-map BpnWeight permit 20
R1(config-route-map)#set weight 400

Sekarang kita check


R1(config-router)#do sh ip bgp 3.3.3.3
BGP routing table entry for 3.3.3.3/32, version 0
Paths: (2 available, no best path)
Not advertised to any peer
Refresh Epoch 2
23
12.12.12.2 (inaccessible) from 12.12.12.2 (2.2.2.2)
Origin IGP, localpref 100, weight 700, valid, external
rx pathid: 0, tx pathid: 0
Refresh Epoch 2
43
14.14.14.2 (inaccessible) from 14.14.14.2 (4.4.4.4)
Origin IGP, localpref 100, valid, external
rx pathid: 0, tx pathid: 0

20
5. BGP Attribute – Local Pre

Lab 4 Skenario: selain attribute weight, ada juga atribute lain yang bisa digunakan
untuk menentukan jalur terbaik sesuai dengan keinginan kita, yaitu local
preference. locpref ini biasa digunakan untuk router router dibelakang iBGP, agar
bisa menentukan kearah router mana ia akan lewati agar sampai ketujuan

Oke, pada lab kali ini kita akan menggunakan BGP Attribute Local-Preference
Konfigurasi

R1
Router(config)#hostname R1
R1(config)#int gig0/0

21
R1(config-if)#ip add 12.12.12.1 255.255.255.0
R1(config-if)#no shut
R1(config)#int gig0/1
R1(config-if)#ip add 13.13.13.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.255

R2
Router(config)#hostname R2
R2(config)#int gig0/0
R2(config-if)#ip add 12.12.12.2 255.255.255.0
R2(config-if)#no sh
R2(config)#int gig0/1
R2(config-if)#ip add 24.24.24.1 255.255.255.0
R2(config-if)#no shut
R2(config)#int lo0
R2(config-if)#ip add
R2(config-if)#ip add 2.2.2.2 255.255.255.255
R2(config)#int lo1
R2(config-if)#ip add 22.22.22.22 255.255.255.255
R2(config-if)#no shut

R3
Router(config)#hostname R3
R3(config)#int gig0/0
R3(config-if)#ip add 34.34.34.1 255.255.255.0
R3(config-if)#no shut
R3(config)#int gig
R3(config)#int gi0/1
R3(config-if)#ip add 13.13.13.2 255.255.255.0
R3(config-if)#no sh
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.255
R3(config-if)#no sh
R3(config)#int lo1
22
R3(config-if)#ip add 33.33.33.33 255.255.255.255
R3(config-if)#no sh

R4
Router(config)#hostname R4
R4(config)#int gig0/1
R4(config-if)#ip add 24.24.24.2 255.255.255.0
R4(config-if)#no shut
R4(config)#int gig0/0
R4(config-if)#ip add 34.34.34.2 255.255.255.0
R4(config-if)#no shut
R4(config)#int lo1
R4(config-if)#ip add 44.44.44.44 255.255.255.255

Selanjutnya kita buat dulu routing IGP


R2
R2(config)#router ospf 10
R2(config-router)#network 24.24.24.0 0.0.0.255 area 0
R2(config-router)#network 2.2.2.2 0.0.0.0 area 0

R3
R3(config)#router ospf 10
R3(config-router)#network 34.34.34.0 0.0.0.255 area 0
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0

R4
R4(config)#router ospf 10
R4(config-router)#network 24.24.24.0 0.0.0.255 area 0
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R4(config-router)#network 34.34.34.0 0.0.0.255 area 0

23
Selanjutnya kita Konfigurasi BGP

R2
R2#conf t
R2(config)#router bgp 1
R2(config-router)#bgp router-id 2.2.2.2
R2(config-router)#network 22.22.22.22 mask 255.255.255.255
R2(config-router)#neighbor 12.12.12.1 remote-as 2
R2(config-router)#neighbor 4.4.4.4 remote-as 1
R2(config-router)#neighbor 4.4.4.4 update-source lo0
R2(config-router)#neighbor 4.4.4.4 next-hop-self
R2(config-router)#neighbor 3.3.3.3 remote-as 1
R2(config-router)#neighbor 3.3.3.3 update-source lo0
R2(config-router)#neighbor 3.3.3.3 next-hop-self

R4
R4(config)#router bgp 1
R4(config-router)#bgp router-id 4.4.4.4
R4(config-router)#network 44.44.44.44 mask 255.255.255.255
R4(config-router)#neighbor 2.2.2.2 remote-as 1
R4(config-router)#neighbor 2.2.2.2 update-source lo0
R4(config-router)#neighbor 3.3.3.3 remote-as 1
R4(config-router)#neighbor 3.3.3.3 update-source lo0

R3
R3(config)#router bgp 1
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#network 33.33.33.33 mask 255.255.255.255
R3(config-router)#neighbor 13.13.13.1 remote-as 2
R3(config-router)#neighbor 2.2.2.2 remote-as 1
R3(config-router)#neighbor 2.2.2.2 update-source lo0
R3(config-router)# neighbor 2.2.2.2 next-hop-self
R3(config-router)#neighbor 4.4.4.4 remote-as 1
R3(config-router)#neighbor 4.4.4.4 update-source lo0

24
R3(config-router)#neighbor 4.4.4.4 next-hop-self

Selanjutkan kita advertise Router R1


R1
R1(config)#router bgp 2
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#bgp log-neighbor-changes
R1(config-router)#network 1.1.1.1 mask 255.255.255.255
R1(config-router)#neighbor 12.12.12.2 remote-as 1
R1(config-router)#neighbor 13.13.13.2 remote-as 1

Sekarang juga kita Traceroute R4 menuju R1 melalui path mana


R4#traceroute 1.1.1.1 source 44.44.44.44
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 34.34.34.1 2 msec 3 msec 1 msec
2 13.13.13.1 2 msec 4 msec *

Naah… . dari traceroute di atas R4 menuju R1, dia melewati R3, Sekarang
kita coba manipulasi jalur pada iBGP ASN 1 supaya menggunaakn path R2.

R2(config)#router bgp 1
R2(config-router)#bgp default local-preference 700
setelah kita buat local-preference di R2 , Sekarang kita coba traceroute
kembali
R4#traceroute 1.1.1.1 source 44.44.44.44
Type escape sequence to abort.

25
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 24.24.24.1 2 msec 1 msec 1 msec
2 12.12.12.1 3 msec * 2 msec

Nah berhasill…. Sekarang jalur utama menuju R1 , melewati R2


R4#sh ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 6
Paths: (1 available, best #1, table default)
Not advertised to any peer
Refresh Epoch 3
2
2.2.2.2 (metric 2) from 2.2.2.2 (2.2.2.2)
Origin IGP, metric 0, localpref 700, valid, internal, best
rx pathid: 0, tx pathid: 0x0

Verifikasi pada router IOS


show ip bgp sum
show ip bgp
show ip route

26

You might also like