chuong6-bgp
-
Upload
bui-van-thieu -
Category
Documents
-
view
9 -
download
0
Transcript of chuong6-bgp
-
5/26/2018 chuong6-bgp
1/49
Gio trnh thc hnh BSCI Chng 6 - BGP
197
CChhnngg66-- BBGGPP
BBii66..11 CCuuhhnnhhBBGGPPvviiddeeffaauullttrroouuttiinngg
66..11..11 SSlluunnll
S0
S1 S0
S1
10.0.0.0/30 172.16.0.0/30
12.0.1.0/24 172.16.1.0/24
192.
168.0.0/24
192.168.1.0/2
4
ISP1 ISP2
Router1
AS 200 AS 300
AS 100
Hnh 6.1.1-1: Hnh v s lun l
66..11..22 MMccttiiuuccaabbiitthhcchhnnhh
Bi lab ny cu hnh BGP trao i thong tin nh tuyn vi 2 ISP.
66..11..33 HHnnggddnnccuuhhnnhh
Bc 1:Cu hnh c bn cho Router1, ISP1, ISP2.
Router1
Router(config)#hostname Router1
Router1(config)#enable password ciscoRouter1(config)#no ip domain-lookup
-
5/26/2018 chuong6-bgp
2/49
Gio trnh thc hnh BSCI Chng 6 - BGP
198
Router1(config)#banner motd ^C Router1^C
Router1(config)#line console 0
Router1(config-line)# logging synchronous
Router1(config-line)# password cisco
Router1(config-line)# loginRouter1(config)#line vty 0 4
Router1(config-line)# password cisco
Router1(config-line)# login
Router1(config)#interface Serial 1
Router1(config-if)#ip address 10.0.0.2 255.255.255.252
Router1(config-if)#no shutdown
Router1(config-if)#exit
Router1(config)#interface loopback 0
Router1(config-if)#ip address 192.168.0.1 255.255.255.0
Router1(config-if)#exit
Router1(config)#interface loopback 1
Router1(config-if)#ip address 192.168.1.1 255.255.255.0
Router1(config-if)#exit
ISP1
Router(config)#hostname ISP1ISP1(config)#enable password cisco
ISP1(config)#no ip domain-lookup
ISP1(config)#banner motd ^C ISP1^C
ISP1(config)#line console 0
ISP1(config-line)# logging synchronous
ISP1(config-line)# password cisco
ISP1(config-line)# login
ISP1(config)#line vty 0 4
ISP1(config-line)# password cisco
ISP1(config-line)# login
IPS1(config)#interface Serial 0
IPS1(config-if)#ip address 10.0.0.1 255.255.255.252
IPS1(config-if)#clock rate 64000
IPS1(config-if)#no shutdown
IPS1(config)#int loopback 0
IPS1(config-if)#ip address 12.0.1.1 255.255.255.0
-
5/26/2018 chuong6-bgp
3/49
Gio trnh thc hnh BSCI Chng 6 - BGP
199
IPS2
Router(config)#hostname ISP2
ISP2(config)#enable password cisco
ISP2(config)#no ip domain-lookup
ISP2(config)#banner motd ^C ISP2^CISP2(config)#line console 0
ISP2(config-line)# logging synchronous
ISP2(config-line)# password cisco
ISP2(config-line)# login
ISP2(config)#line vty 0 4
ISP2(config-line)# password cisco
ISP2(config-line)# login
ISP2(config)#interface serial 1
ISP2(config-if)#ip address 172.16.0.1 255.255.255.252
ISP2(config-if)#no shutdown
ISP2(config)#interface loopback 0
ISP2(config-if)#ip address 172.16.1.1 255.255.255.0
Bc 2:Cu hnh BGP trnRouter1, ISP1, ISP2.
Cu hnh BGP trn Router1
Router1(config)#router bgp 100Router1(config-router)#neighbor 10.0.0.1 remote-as 200
Router1(config-router)#neighbor 172.16.0.1 remote-as 300
Router1(config-router)#network 192.168.0.0
Router1(config-router)#network 192.168.1.0
Router1(config-router)#exit
Cu hnh BGP trn ISP1
IPS1(config)#router bgp 200
IPS1(config-router)#neighbor 10.0.0.2 remote-as 100
IPS1(config-router)#network 12.0.1.0 mask 255.255.255.0
IPS1(config-router)#exit
Cu hnh BGP trn ISP2
ISP2(config)#router bgp 300
ISP2(config-router)#neighbor 172.16.0.2 remote-as 100
ISP2(config-router)#network 172.16.1.0 mask 255.255.255.0
IPS2(config-router)#exit
Bc3:kim tra BGP.
Kim tra BGP trn Router1
-
5/26/2018 chuong6-bgp
4/49
Gio trnh thc hnh BSCI Chng 6 - BGP
200
Router1#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/30 is directly connected, Serial0B 172.16.1.0/24 [20/0] via 172.16.0.1, 00:01:31
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial1
C 192.168.0.0/24 is directly connected, Loopback0
12.0.0.0/24 is subnetted, 1 subnets
B 12.0.1.0 [20/0] via 10.0.0.1, 00:01:31
C 192.168.1.0/24 is directly connected, Loopback1
Router1#show ip bgp
BGP table version is 5, local router ID is 192.168.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 12.0.1.0/24 10.0.0.1 0 0 200 i
*> 172.16.1.0/24 172.16.0.1 0 0 300 i
*> 192.168.0.0 0.0.0.0 0 32768 i*> 192.168.1.0 0.0.0.0 0 32768 i
Kim tra BGP trn ISP1
IPS1#show ip route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 10.0.0.2, 00:03:07
10.0.0.0/30 is subnetted, 1 subnets
C 10.0.0.0 is directly connected, Serial0
B 192.168.0.0/24 [20/0] via 10.0.0.2, 00:03:36
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.1.0 is directly connected, Loopback0
B 192.168.1.0/24 [20/0] via 10.0.0.2, 00:02:37
IPS1#show ip bgp
BGP table version is 5, local router ID is 10.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
-
5/26/2018 chuong6-bgp
5/49
Gio trnh thc hnh BSCI Chng 6 - BGP
201
Network Next Hop Metric LocPrf Weight Path
*> 12.0.1.0/24 0.0.0.0 0 32768 i
*> 172.16.1.0/24 10.0.0.2 0 100 300 i
*> 192.168.0.0 10.0.0.2 0 0 100 i*> 192.168.1.0 10.0.0.2 0 0 100 i
Kim tra BGP trn ISP2
ISP2#show ip route
Gateway of last resort is not set
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.16.0.0/30 is directly connected, Serial1
C 172.16.1.0/24 is directly connected, Loopback0
B 192.168.0.0/24 [20/0] via 172.16.0.2, 00:02:53
12.0.0.0/24 is subnetted, 1 subnets
B 12.0.1.0 [20/0] via 172.16.0.2, 00:02:53
B 192.168.1.0/24 [20/0] via 172.16.0.2, 00:02:00
ISP2#show ip bgp
BGP table version is 5, local router ID is 172.16.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 12.0.1.0/24 172.16.0.2 0 100 200 i
*> 172.16.1.0/24 0.0.0.0 0 32768 i
*> 192.168.0.0 172.16.0.2 0 0 100 i
*> 192.168.1.0 172.16.0.2 0 0 100 i
-
5/26/2018 chuong6-bgp
6/49
Gio trnh thc hnh BSCI Chng 6 - BGP
202
BBii66..22 BBGGPP&&TThheeAASS__PPaatthhAAttttrriibbuuttee
66..22..11 SSlluunnll
S0/3/1
S0/3/0 S0/3/1
S0/0/0
192.168.1.4/30 172.25.1.16/30
12.0.1.0/24 172.16.1.0/24
202.0.0.0/24
Router1 Router2
ISP
AS 100 AS 65000
AS 300
Hnh 6.2.1-1: Hnh v s lun l
66..22..22 MMccttiiuuccaabbiitthhcchhnnhh
dng AS_PATH Attribute to Filter Routes
66..22..33 HHnnggddnnccuuhhnnhhvvhhnnhhvvmmiinnhhhhaa
Bc1:Cu hnh c bn cho ISP, Router1, Router2
Router1
Router(config)#hostname Router1
Router1(config)#enable password cisco
Router1(config)#no ip domain-lookup
Router1(config)#banner motd ^C Router1^C
Router1(config)#line console 0
Router1(config-line)# logging synchronousRouter1(config-line)# password cisco
-
5/26/2018 chuong6-bgp
7/49
Gio trnh thc hnh BSCI Chng 6 - BGP
203
Router1(config-line)# login
Router1(config)#line vty 0 4
Router1(config-line)# password cisco
Router1(config-line)# login
Router1(config)#interface serial 0/3/1
Router1(config-if)#ip address 192.168.1.5 255.255.255.252
Router1(config-if)#no shutdown
Router1(config)#interface loopback 0
Router1(config-if)#ip address 12.0.1.1 255.255.255.0
Router1(config-if)#exit
Router2
Router(config)#hostname Router2
Router2(config)#enable password cisco
Router2(config)#no ip domain-lookup
Router2(config)#banner motd ^C Router2^C
Router2(config)#line console 0
Router2(config-line)# logging synchronous
Router2(config-line)# password cisco
Router2(config-line)# login
Router2(config)#line vty 0 4
Router2(config-line)# password ciscoRouter2(config-line)# login
Router2(config)#interface Serial 0/0/0
Router2(config-if)#ip address 172.24.1.17 255.255.255.252
Router2(config-if)#clock rate 64000
Router2(config-if)#no shutdown
Router2(config)#interface loopback 0
Router2(config-if)#ip address 172.16.1.1 255.255.255.0
ISP
Router(config)#hostname ISP1
ISP(config)#enable password cisco
ISP(config)#no ip domain-lookup
ISP(config)#banner motd ^C ISP1^C
ISP(config)#line console 0
ISP(config-line)# logging synchronous
ISP(config-line)# password cisco
ISP(config-line)# login
ISP(config)#line vty 0 4
-
5/26/2018 chuong6-bgp
8/49
Gio trnh thc hnh BSCI Chng 6 - BGP
204
ISP(config-line)# password cisco
ISP(config-line)# login
IPS(config)#interface Serial 0/3/0
IPS(config-if)#ip address 192.168.1.6 255.255.255.252IPS(config-if)#clock rate 64000
IPS(config-if)#no shutdown
IPS(config)#interface interface Serial 0/3/1
IPS(config-if)#ip address 172.25.1.18 255.255.255.252
IPS(config-if)#no shutdown
IPS(config)#int loopback 0
IPS(config-if)#ip address 202.0.0.1 255.255.255.0
Bc 2:Cu hnh BGP
Cu hnh BGP trn Router1
Router1(config)#router bgp 100
Router1(config-router)#neighbor 192.168.1.6 remote-as 300
Router1(config-router)#network 12.0.1.0 mask 255.255.255.0
Router1(config-router)#exit
Router1#show ip route
Gateway of last resort is not set
B 202.0.0.0/24 [20/0] via 192.168.1.6, 00:00:39
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 192.168.1.6, 00:00:39
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.1.0 is directly connected, Loopback0
192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.4 is directly connected, Serial0/3/1Cu hnh BGP trn Router2
Router2(config)#router bgp 65000
Router2(config-router)#neighbor 172.25.1.18 remote-as 300
Router2(config-router)#network 172.16.1.0 mask 255.255.255.0
Router2(config-router)#exit
Router2#show ip route
Gateway of last resort is not set
-
5/26/2018 chuong6-bgp
9/49
Gio trnh thc hnh BSCI Chng 6 - BGP
205
B 202.0.0.0/24 [20/0] via 172.25.1.18, 00:01:55
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Loopback0
172.25.0.0/24 is subnetted, 1 subnets
C 172.25.1.0 is directly connected, Serial0/0/012.0.0.0/24 is subnetted, 1 subnets
B 12.0.1.0 [20/0] via 172.25.1.18, 00:01:24
Cu hnh BGP trn ISP
ISP(config)#router bgp 300
ISP(config-router)#neighbor 192.168.1.5 remote-as 100
ISP(config-router)#neighbor 172.26.1.17 remote-as 65000
ISP(config-router)#network 202.0.0.0 mask 255.255.255.0
ISP(config-router)#exit
ISP#show ip route
Gateway of last resort is 10.11.6.2 to network 0.0.0.0
C 202.0.0.0/24 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [20/0] via 172.25.1.17, 00:00:37
172.25.0.0/30 is subnetted, 1 subnets
C 172.25.1.16 is directly connected, Serial0/3/110.0.0.0/24 is subnetted, 1 subnets
C 10.11.6.0 is directly connected, GigabitEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
B 12.0.1.0 [20/0] via 192.168.1.5, 00:00:02
192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.4 is directly connected, Serial0/3/0
Bc3:Remove the Private AS
ISP(config)#router bgp 300
ISP(config-router)#neighbor 192.168.1.5 remove-private-as
-
5/26/2018 chuong6-bgp
10/49
Gio trnh thc hnh BSCI Chng 6 - BGP
206
Kim tra trn Router1
Hnh 6.2.3-1: Show ip bgp trn Router1 kim tra
Bc 4:dng AS_PATH Attribute to Filter Routes
ISP(config)#ip as-path access-list 1 deny ^100$
ISP(config)#ip as-path access-list 1 permit .*
ISP(config)#router bgp 300
ISP(config-router)#neighbor 172.25.1.17 filter-list 1 out
Hnh 6.2.3-2: Show ip route trn Router1
Hnh 6.2.3-3: Show ip route trn Router2
-
5/26/2018 chuong6-bgp
11/49
Gio trnh thc hnh BSCI Chng 6 - BGP
207
Hnh 6.2.3-4: Show ip bgp regexp ^100$
-
5/26/2018 chuong6-bgp
12/49
Gio trnh thc hnh BSCI Chng 6 - BGP
208
BBii66..33 eeBBGGPPmmuullttiihhoopp
66..33..11 SSlluunnll
R1 R2
10.0.0.0/30
Lo0 : 2.2.2.2/32
Lo1 : 192.168.1.1/24
10.0.0.4/30
Fa0/0 Fa0/0
Fa0/1 Fa0/1
1.1.1.1/32
BGP AS 1 BGP AS 2
Hnh 6.3.1-1: S lun l
66..33..22 MMccttiiuuccaabbiitthhcchhnnhh
eBGP multihop c th dng loadshare traffic qua nhiu link eBGP
peers.
66..33..33 HHnnggddnnccuuhhnnhhvvhhnnhhvvmmiinnhhhhaa
Bc 1:Cu hnh c bn R1, R2
R1
Router(config)#hostname R1
R1(config)#enable password cisco
R1(config)#no ip domain-lookup
R1(config)#banner motd ^C Router1^C
R1(config)#line console 0
R1(config-line)# logging synchronous
R1(config-line)# password cisco
R1(config-line)# login
R1(config)#line vty 0 4
R1(config-line)# password cisco
R1(config-line)# login
R1(config)# interface FastEthernet0/0
R1(config-if)#ip address 10.0.0.1 255.255.255.252
R1(config-if)#no shutdown
R1(config)# interface FastEthernet0/1R1(config-if)#ip address 10.0.0.5 255.255.255.252
-
5/26/2018 chuong6-bgp
13/49
Gio trnh thc hnh BSCI Chng 6 - BGP
209
R1(config-if)#no shutdown
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#exit
R2Router(config)#hostname R2
R2(config)#enable password cisco
R2(config)#no ip domain-lookup
R2(config)#banner motd ^C Router2^C
R2(config)#line console 0
R2(config-line)# logging synchronous
R2(config-line)# password cisco
R2(config-line)# login
R2(config)#line vty 0 4
R2(config-line)# password cisco
R2(config-line)# login
R2(config)# interface FastEthernet0/0
R2(config-if)#ip address 10.0.0.2 255.255.255.252
R2(config-if)#no shutdown
R2(config)# interface FastEthernet0/0
R2(config-if)#ip address 10.0.0.6 255.255.255.252R2(config-if)#no shutdown
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config)#interface loopback 1
R2(config-if)#ip address 192.168.1.1 255.255.255.0
Bc 2:Cu hnh eBGP multihop trn R1, R2
Cu hnh eBGP multi ho p trn Router1
R1(config)#router bgp 1
R1(config-router)# neighbor 2.2.2.2 remote-as 2
R1(config-router)# neighbor 2.2.2.2 ebgp-multihop 2
R1(config-router)# neighbor 2.2.2.2 update-source Loopback0
R1(config-router)#exit
R1(config)#ip route 2.2.2.2 255.255.255.255 10.0.0.2
R1(config)#ip route 2.2.2.2 255.255.255.255 10.0.0.6
Cu hnh eBGP multi ho p trn Router2
R2(config)#router bgp 2
-
5/26/2018 chuong6-bgp
14/49
Gio trnh thc hnh BSCI Chng 6 - BGP
210
R2(config-router)#network 192.168.1.0
R2(config-router)# neighbor 1.1.1.1 remote-as 1
R2(config-router)# neighbor 1.1.1.1 ebgp-multihop 2
R2(config-router)#neighbor 1.1.1.1 update-source Loopback0
R2(config-router)#exitR2(config)#ip route 1.1.1.1 255.255.255.255 10.0.0.1
R2(config)#ip route 1.1.1.1 255.255.255.255 10.0.0.5
Bc 3:Kim tra cu hnh
Hnh 6.3.3-1: Show ip route trn R1
Hnh 6.3.3-2: Show ip cef 192.168.1.0
-
5/26/2018 chuong6-bgp
15/49
Gio trnh thc hnh BSCI Chng 6 - BGP
211
BBii66..44 CCuuhhnnhhIIBBGGPPvvEEBBGGPP,,LLooccaallPPrreeffeerreenncceevvMMEEDD((MMuullttii--
EExxiittDDiissccrriimmiinnaattoorr))
66..44..11 SSlluunnll
S0/3/0
S0/3/1 S0/3/0
S0/0/1
192.168.1.4/30 172.16.1.0/24
Lo0: 192.168.100.0/24 Lo0: 172.16.32.0/24
Lo0: 172.16.64.0/24
ISP R2
R1
AS 64512
EIGRP
192.168.1.0/30S0/3/1
S0/0/0
iBGP
EBGP
EBGP
Hnh 6.4.1-1: Hnh v s lun l
66..44..22 MMccttiiuuccaabbiitthhcchhnnhh
Cu hnh IBGP v EBGP, Local Preference v MED (Multi-Exit
Discriminator)
66..44..33 HHnnggddnnccuuhhnnhhvvhhnnhhvvmmiinnhhhhaa
Bc 1:Cu hnh c bn trn Router1, Router2, ISP
Router1
Router(config)#hostname Router1
Router1(config)#enable password ciscoRouter1(config)#no ip domain-lookup
-
5/26/2018 chuong6-bgp
16/49
Gio trnh thc hnh BSCI Chng 6 - BGP
212
Router1(config)#banner motd ^C Router1^C
Router1(config)#line console 0
Router1(config-line)# logging synchronous
Router1(config-line)# password cisco
Router1(config-line)# loginRouter1(config)#line vty 0 4
Router1(config-line)# password cisco
Router1(config-line)# login
Router1(config)#interface Serial 0/3/0
Router1(config-if)#ip address 172.16.1.1 255.255.255.0
Router1(config-if)#clock rate 64000
Router1(config-if)#no shutdown
Router1(config)#interface serial 0/3/1
Router1(config-if)#ip address 192.168.1.6 255.255.255.252
Router1(config-if)#no shutdown
Router1(config)#interface loopback 0
Router1(config-if)#ip address 172.16.64.1 255.255.255.0
Router1(config-if)#exit
Router2
Router(config)#hostname Router2
Router2(config)#enable password ciscoRouter2(config)#no ip domain-lookup
Router2(config)#banner motd ^C Router2^C
Router2(config)#line console 0
Router2(config-line)# logging synchronous
Router2(config-line)# password cisco
Router2(config-line)# login
Router2(config)#line vty 0 4
Router2(config-line)# password cisco
Router2(config-line)# login
Router2(config)#interface Serial 0/0/0
Router2(config-if)#ip address 192.168.1.2 255.255.255.252
Router2(config-if)#clock rate 64000
Router2(config-if)#no shutdown
Router2(config)#interface Serial 0/0/1
Router2(config-if)#ip address 172.16.1.2 255.255.255.0
Router2(config-if)#no shutdown
Router2(config)#interface loopback 0
-
5/26/2018 chuong6-bgp
17/49
Gio trnh thc hnh BSCI Chng 6 - BGP
213
Router2(config-if)#ip address 172.16.32.1 255.255.255.0
ISP
Router(config)#hostname ISP
ISP(config)#enable password cisco
ISP(config)#no ip domain-lookupISP(config)#banner motd ^C ISP^C
ISP(config)#line console 0
ISP(config-line)# logging synchronous
ISP(config-line)# password cisco
ISP(config-line)# login
ISP(config)#line vty 0 4
ISP(config-line)# password cisco
ISP(config-line)# login
IPS(config)#interface Serial 0/3/0
IPS(config-if)#ip address 192.168.1.5 255.255.255.252
IPS(config-if)#clock rate 64000
IPS(config-if)#no shutdown
IPS(config)#interface interface Serial 0/3/1
IPS(config-if)#ip address 192.168.1.1 255.255.255.252
IPS(config-if)#no shutdown
IPS(config)#int loopback 0IPS(config-if)#ip address 192..168.100.1 255.255.255.0
Bc 2:Cu hnh EIGRP trn Router1 v Router2
Cu hnh EIGRP trn Router1
Router1(config)#router eigrp 64512
Router1(config-router)#network 172.16.1.1 0.0.0.0
Router1(config-router)#network 172.16.64.1 0.0.0.0
Router1(config-router)#no auto-summary
Hnh 6.4.3-1: Show ip eirgp neighbors trn Router1
Cu hnh EIGRP trn Router2
Router2(config)#router eigrp 64512
Router2(config-router)#network 172.16.1.2 0.0.0.0
Router2(config-router)#network 172.16.32.1 0.0.0.0Router2(config-router)#no auto-summary
-
5/26/2018 chuong6-bgp
18/49
Gio trnh thc hnh BSCI Chng 6 - BGP
214
Hnh 6.4.3-2: Show ip eirgp neighbors trn Router1
Bc3:Cu hnh iBGP trn Router1 v Router2
Cu hnh iBGP trn Router1
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 172.16.32.1 remote-as 64512
Router1(config-router)#neighbor 172.16.32.1 update-source loopback 0
Router1(config-router)#end
Hnh 6.4.3-3: Show ip bgp neighbors trn Router1
Cu hnh iBGP trn Router2
Router2(config)#router bgp 64512
Router2(config-router)#neighbor 172.16.64.1 remote-as 64512
Router2(config-router)#neighbor 172.16.64.1 update-source loopback 0
Router2(config-router)#end
Hnh 6.4.3-4: Show ip bgp neighbors trn Router2
Bc4:Cu hnh EBGP(ISP run EBGP vi Router1v Router2)
Cu hnh EBGP trn ISP
ISP(config)#router bgp 200
ISP(config-router)#neighbor 192.168.1.6 remote-as 64512
ISP(config-router)#neighbor 192.168.1.2 remote-as 64512
ISP(config-router)#network 192.168.100.0 mask 255.255.255.0
ISP(config-router)#network 192.168.1.4 mask 255.255.255.252
ISP(config-router)#network 192.168.1.0 mask 255.255.255.252
ISP(config-router)#end
Cu hnh EBGP trn Router1
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 192.168.1.5 remote-as 200
Router1(config-router)#network 172.16.64.0 mask 255.255.255.0
Router1(config-router)#network 172.16.1.0 mask 255.255.255.0
Router1(config-router)#end
-
5/26/2018 chuong6-bgp
19/49
Gio trnh thc hnh BSCI Chng 6 - BGP
215
Cu hnh EBGP trn Router2
Router2(config)#router bgp 64512
Router2(config-router)#neighbor 192.168.1.1 remote-as 200
Router2(config-router)#network 172.16.32.0 mask 255.255.255.0
Router2(config-router)#network 172.16.1.0 mask 255.255.255.0Router2(config-router)#end
Bc5:Kim tra BGP Neighbors
Hnh 6.4.3-5: Show ip bgp neighbors trn ISP
Hnh 6.4.3-6: Show ip bgp neighbors trn Router1
Hnh 6.4.3-7: Show ip bgp neighbors trn Router2
Bc 6Kim tra Which Path Traffic Takes
Hnh 6.4.3-8: Show ip bgp trn ISP
-
5/26/2018 chuong6-bgp
20/49
Gio trnh thc hnh BSCI Chng 6 - BGP
216
Hnh 6.4.3-9: Show ip bgp trn Router1
Hnh 6.4.3-10: Show ip bgp trn Router2
Bc 7: BGP Next-Hop-Self
Kim tra trc khi s dng Next-Hop-Seft
Hnh 6.4.3-11: Show ip bgp Router1 trc khi dng Next-Hop-Self
-
5/26/2018 chuong6-bgp
21/49
Gio trnh thc hnh BSCI Chng 6 - BGP
217
Hnh 6.4.3-12: Show ip route Router1 trc khi dng Next-Hop-Self
Hnh 6.4.3-13: Show ip bgp Router2 trc khi dng Next-Hop-Self
Hnh 6.4.3-14: Show ip route Router2 trc khi dng Next-Hop-Self
Cu hnh Next-Hop -Self t rn Rou ter1
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 172.16.32.1 next-hop-self
Cu hnh Next-Hop -Self t rn Rou ter2
Router2(config)#router bgp 64512
-
5/26/2018 chuong6-bgp
22/49
Gio trnh thc hnh BSCI Chng 6 - BGP
218
Router2(config-router)#neighbor 172.16.64.1 next-hop-self
Kim tra sau khi s dng Next-Hop-Self
Hnh 6.4.3-15: Show ip route Router1 sau khi dng Next-Hop-Self
Hnh 6.4.3-16: Show ip route Router2 sau khi dng Next-Hop-Self
Bc8:Set BGP Local Preference
Set BGP Lo cal Preferen ce trn Router1
Router1(config)#route-map PRIMARY_LocPrf_IN permit 10
Router1(config-route-map)#set local-preference 150
Router1(config-route-map)#exit
Router1(config)#router bgp 64512Router1(config-router)#neighbor 192.168.1.5 route-map PRIMARY_ LocPrf_IN
in
Router1(config-router)#end
Router1#clear ip bgp * soft
Set BGP Lo cal Preferen ce trn Router2
Router2(config)#route-map SECONDARY_ LocPrf_IN permit 10
Router2(config-route-map)#set local-preference 125
Router2(config-route-map)#exit
Router2(config)#router bgp 64512
-
5/26/2018 chuong6-bgp
23/49
Gio trnh thc hnh BSCI Chng 6 - BGP
219
Router2(config-router)#neighbor 192.168.1.1 route-map SECONDARY_
LocPrf_IN in
Router2(config-router)#end
Router2#clear ip bgp * soft
Kim tra kt qu sau khi set BGP Local Preference
Hnh 6.4.3-17: Show ip bgp sau khi set BGP Local Preference trn Router1
Hnh 6.4.3-18: Show ip bgp sau khi set BGP Local Preference trn Router2
Bc 9:Set BGP MED
Set BGP MED trn Ro uter1
Router1(config)#route-map PRIMARY_MED_OUT permit 10
Router1(config-route-map)#set metric 50
Router1(config-route-map)#exit
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 192.168.1.5 route-map
PRIMARY_MED_OUT out
Router1(config-router)#end
Router1#clear ip bgp * soft
Set BGP MED trn Ro uter2
Router2(config)#route-map SECONDARY_MED_OUT permit 10
Router2(config-route-map)#set metric 100Router2(config-route-map)#exit
-
5/26/2018 chuong6-bgp
24/49
Gio trnh thc hnh BSCI Chng 6 - BGP
220
Router2(config)#router bgp 64512
Router2(config-router)#neighbor 192.168.1.1 route-map
SECONDARY_MED_OUT out
Router2(config-router)#end
Router2#clear ip bgp * softKim tra kt qu sau khi set BGP MED
Hnh 6.4.3-19: Show ip bgp trn ISP sau khi set BGP MED
Bc 10:Establish a Default Network
Router1(config)#ip default-network 192.168.100.0
Router1(config)#router bgp 64512
Router1(config-router)#neighbor 172.16.32.1 default-originate
Router1(config-router)#endKim tra cu hnh trn Router1 v Rout2
Hnh 6.4.3-20: Show ip route trn Router1 sau khi c default network
-
5/26/2018 chuong6-bgp
25/49
Gio trnh thc hnh BSCI Chng 6 - BGP
221
Hnh 6.4.3-21: Show ip route tren Router2 sau khi c default network
-
5/26/2018 chuong6-bgp
26/49
Gio trnh thc hnh BSCI Chng 6 - BGP
222
BBii66..55 BBGGPPvvEEIIGGRRPP
66..55..11 SSlluunnll
Fa0/1
S0/0/1 S0/0/0
S0/1
10.1.102.0/29 10.1.203.0/29
Lo0: 10.1.1.1/24
Lo0:10.3.
3.3/24
R1 R3
R2
10.1.103.0/29S0/3/1
S0/0
SW1
192.168.34.0/30
192.168.14.0/30
Lo0 : 10.2.2.2/24
Lo1 : 10.20.0.1/24
Lo2 : 10.20.1.1/24
Lo3 : 10.20.2.1/24
Lo4 : 10.20.3.1/24
Lo1 : 172.16.0.1/22
Lo2 : 172.16.4.1/22
Lo3 : 172.16.8.1/22
Lo4 : 172.16.12.1/22
BGP AS 65001
&
EIGRP AS 65001
International
BGP AS 65002
&
EIGRP AS 65002
Providers
S0/3/0
S0/2Gi0/0
Fa0/2 Fa0/0
R4
S0/3/0
Hnh 6.5.1-1: Hnh v s lun l
66..55..22 MMccttiiuuccaabbiitthhcchhnnhh
Cu hnh Provider network vi EIGRP AS 65002 (Tt chc nng
automatic summarization trn c 2 domain ca EIGRP)
-
5/26/2018 chuong6-bgp
27/49
Gio trnh thc hnh BSCI Chng 6 - BGP
223
Cu hnh International network vi BGP AS 65001 v Provider network
vi BGP 65002
Qung b mng 192.168.14.0/30 v 192.168.34.0/30 trn c 2 AS ca
EIGRP
Tt c router tham gia vo BGP. Cu hnh tt c router dng full mest
iBGP. Qung b tt c interface loopback vo BGP, ngoi tr R2, ch
qun b loopback 10.2.2.0/24.
Trn R2, to mt static summary route cho cc interface loopback cn
li v qun b static route ny vo BGP.
R4 gi mt summary route ca tt c interface loopback ti vng
International.
Nhng Router trong vng International s dng ng i ti vng
Provider thng qua lin kt Ethernet gia R1 v R4. hon thnh
vic ny, cn phi chnh sa thng s Local Preference ca cc ng
route qun b t Providers.
66..55..33 HHnnggddnnccuuhhnnhhvvhhnnhhvvmmiinnhhhhaa
Bc 1:Cu hnh c bn cho R1, R2, R3, R4
R1
Router(config)#hostname R1
R1(config)#enable password cisco
R1(config)#no ip domain-lookup
R1(config)#banner motd ^C R1^C
R1(config)#line console 0
R1(config-line)# logging synchronous
R1(config-line)# password ciscoR1(config-line)# login
R1(config)#line vty 0 4
R1(config-line)# password cisco
R1(config-line)# login
R1(config)#interface Serial 0/3/0
R1(config-if)#ip address 10.1.102.1 255.255.255.248
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
-
5/26/2018 chuong6-bgp
28/49
Gio trnh thc hnh BSCI Chng 6 - BGP
224
R1(config-if)#exit
R1(config)#interface Serial 0/3/1
R1(config-if)#ip address 10.1.103.1 255.255.255.248
R1(config-if)#no shutdown
R1(config-if)#exitR1(config)#interface loopback 0
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface GigabitEthernet 0/0
R1(config-if)#ip add 192.168.14.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#exit
R2
Router(config)#hostname R2
R2(config)#enable password cisco
R2(config)#no ip domain-lookup
R2(config)#banner motd ^C R2^C
R2(config)#line console 0
R2(config-line)# logging synchronous
R2(config-line)# password cisco
R2(config-line)# login
R2(config)#line vty 0 4R2(config-line)# password cisco
R2(config-line)# login
R2(config)#interface serial 0/0/0
R2(config-if)#ip address 10.1.203.2 255.255.255.248
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface serial 0/0/1
R2(config-if)#ip address 10.1.102.2 255.255.255.248
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface loopback 0
R2(config-if)#ip address 10.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#interface loopback 1
R2(config-if)#ip address 10.20.0.1 255.255.255.0
R2(config-if)#exit
-
5/26/2018 chuong6-bgp
29/49
Gio trnh thc hnh BSCI Chng 6 - BGP
225
R2(config)#interface loopback 2
R2(config-if)#ip address 10.20.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#interface loopback 3
R2(config-if)#ip address 10.20.2.1 255.255.255.0R2(config-if)#exit
R2(config)#interface loopback 4
R2(config-if)#ip address 10.20.3.1 255.255.255.0
R2(config-if)#exit
R3
Router(config)#hostname R3
R3(config)#enable password cisco
R3(config)#no ip domain-lookup
R3(config)#banner motd ^C R3^C
R3(config)#line console 0
R3(config-line)# logging synchronous
R3(config-line)# password cisco
R3(config-line)# login
R3(config)#line vty 0 4
R3(config-line)# password cisco
R3(config-line)# login
R3(config)#interface Serial 0/0
R3(config-if)#ip address 10.1.103.3 255.255.255.248
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface Serial 0/1
R3(config-if)#ip address 10.1.203.3 255.255.255.248
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface Serial 0/3
R3(config-if)#ip address 192.168.34.1 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface loopback 0
R3(config-if)# ip address 10.3.3.3 255.255.255.0
R3(config-if)#exit
R4Router(config)#hostname R4
-
5/26/2018 chuong6-bgp
30/49
Gio trnh thc hnh BSCI Chng 6 - BGP
226
R4(config)#enable password cisco
R4(config)#no ip domain-lookup
R4(config)#banner motd ^C R4^C
R4(config)#line console 0
R4(config-line)# logging synchronousR4(config-line)# password cisco
R4(config-line)# login
R4(config)#line vty 0 4
R4(config-line)# password cisco
R4(config-line)# login
R4(config)#interface Serial 0/3/0
R4(config-if)# ip address 192.168.34.2 255.255.255.252
R4(config-if)#clock rate 64000
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#interface FastEthernet 0/0
R4(config-if)#ip add 192.168.14.2 255.255.255.252
R4(config-if)#no shut
R4(config-if)#no shutdown
R4(config-if)#exit
R4(config)#interface loopback 0R4(config-if)# ip address 10.4..4.4 255.255.255.0
R4(config-if)#exit
R4(config)#interface loopback 1
R4(config-if)# ip address 172.16.0.1 255.255.252.0
R4(config-if)#exit
R4(config)#interface loopback 2
R4(config-if)# ip address 172.16.4.1 255.255.252.0
R4(config-if)#exit
R4(config)#interface loopback 3
R4(config-if)# ip address 172.16.8.1 255.255.252.0
R4(config-if)#exit
R4(config)#interface loopback 4
R4(config-if)# ip address 172.16.12.1 255.255.252.0
R4(config-if)#exit
Bc 2:Cu hnh International network vi EIGRP AS 65001
Cu hnh EIGRP trn R1R1(config)#router eigrp 65001
-
5/26/2018 chuong6-bgp
31/49
Gio trnh thc hnh BSCI Chng 6 - BGP
227
R1(config-router)#network 10.1.1.1 0.0.0.0
R1(config-router)#network 10.1.102.1 0.0.0.0
R1(config-router)#network 10.1.103.1 0.0.0.0
R1(config-router)#no auto-summary
R1(config-router)#exitCu hnh EIGRP trn R2
R2(config)#router eigrp 65001
R2(config-router)#network 10.2.2.2 0.0.0.0
R2(config-router)#network 10.1.102.2 0.0.0.0
R2(config-router)#network 10.1.203.2 0.0.0.0
R2(config-router)#network 10.20.0.1 0.0.0.0
R2(config-router)#network 10.20.1.1 0.0.0.0
R2(config-router)#network 10.20.2.1 0.0.0.0
R2(config-router)#network 10.20.3.1 0.0.0.0
R2(config-router)#no auto-summary
R2(config-router)#exit
Cu hnh EIGRP trn R3
R3(config)#router eigrp 65001
R3(config-router)#network 10.3.3.3 0.0.0.0
R3(config-router)#network 10.1.103.3 0.0.0.0
R3(config-router)#network 10.1.203.3 0.0.0.0
R3(config-router)#no auto-summaryR3(config-router)#exit
Kim tra cu hnh
Hnh 6.5.3-1: Show ip eigrp neighbors trn R1
Hnh 6.5.3-2: Show ip route eigrp trn R1
-
5/26/2018 chuong6-bgp
32/49
Gio trnh thc hnh BSCI Chng 6 - BGP
228
Hnh 6.5.3-3: Show ip eigrp neighbors trn R2
Hnh 6.5.3-4: Show ip route eigrp trn R2
Hnh 6.5.3-5: Show ip eigrp neighbors trn R3
Hnh 6.5.3-6: Show ip route eigrp trn R3
Bc 3:Cu hnh Provider network vi EIGRP AS 65002 (Tt chc
nngautomatic summarization trn c 2 domain ca EIGRP)
Cu hnh EIGRP trn R1
R1(config)#router eigrp 65002
R1(config-router)#network 192.168.14.1 0.0.0.0
R1(config-router)#no auto-summary
R1(config-router)#exit
Cu hnh EIGRP trn R3
R3(config)#router eigrp 65002
R3(config-router)#network 192.168.34.1 0.0.0.0
R3(config-router)#no auto-summary
R3(config-router)#exit
Cu hnh EIGRP trn R4
R4(config)#router eigrp 65002
R4(config-router)#network 192.168.14.2 0.0.0.0
R4(config-router)#network 192.168.34.2 0.0.0.0R4(config-router)#network 10.4.4.4 0.0.0.0
-
5/26/2018 chuong6-bgp
33/49
Gio trnh thc hnh BSCI Chng 6 - BGP
229
R4(config-router)#no auto-summary
R4(config-router)#exit
Bc 4: Cu hnh International network vi BGP AS 65001 v
Provider network vi BGP 65002
Cu hnh BGP trn R1
R1(config)#router bgp 65001
R1(config-router)#neighbor 10.2.2.2 remote-as 65001
R1(config-router)#neighbor 10.3.3.3 remote-as 65001
R1(config-router)#neighbor 10.2.2.2 update-source loopback 0
R1(config-router)#neighbor 10.3.3.3 update-source loopback 0
R1(config-router)#neighbor 192.168.14.2 remote-as 65002
R1(config-router)#exit
Cuhnh BGP trn R2
R2(config)#router bgp 65001
R2(config-router)#neighbor 10.1.1.1 remote-as 65001
R2(config-router)#neighbor 10.3.3.3 remote-as 65001
R2(config-router)#neighbor 10.1.1.1 update-source loopback 0
R2(config-router)#neighbor 10.3.3.3 update-source loopback 0
R2(config-router)#exit
Cu hnh BGP trn R3
R3(config)#router bgp 65001R3(config-router)#neighbor 10.1.1.1 remote-as 65001
R3(config-router)#neighbor 10.2.2.2 remote-as 65001
R3(config-router)#neighbor 10.1.1.1 update-source loopback 0
R3(config-router)#neighbor 10.2.2.2 update-source loopback 0
R3(config-router)#neighbor 192.168.34.2 remote-as 65002
R3(config-router)#exit
Cu hnh BGP trn R4
R4(config)#router bgp 65002
R4(config-router)#neighbor 192.168.14.1 remote-as 65001
R4(config-router)#neighbor 192.168.34.1 remote-as 65001
R4(config-router)#exit
Kim tra cu hnh
Hnh 6.5.3-7: Show ip bgp neighbors trn R1
-
5/26/2018 chuong6-bgp
34/49
Gio trnh thc hnh BSCI Chng 6 - BGP
230
Hnh 6.5.3-8: Show ip bgp neighbors trn R2
Hnh 6.5.3-9: Show ip bgp neighbors trn R3
Hnh 6.5.3-10: Show ip bgp neighbors trn R4
Bc 5:Qung b mng 192.168.14.0/30 v 192.168.34.0/30 trn c
2 AS ca EIGRP
Cu hnh EIGRP trn R1
R1(config)#router eigrp 65001
R1(config-router)#network 192.168.14.1 0.0.0.0
R1(config-router)#exit
Cu hnh EIGRP trn R3
R3(config)#router eigrp 65001
R3(config-router)#network 192.168.34.1 0.0.0.0
R3(config-router)#exit
Kim tra cu hnh
Hnh 6.5.3-11: Show ip route eigrp trn R1
-
5/26/2018 chuong6-bgp
35/49
Gio trnh thc hnh BSCI Chng 6 - BGP
231
Hnh 6.5.3-12: Show ip route eigrp trn R3
Bc 6:Tt c router tham gia vo BGP. Cu hnh tt c router dng
full mest iBGP. Qung b tt c interface loopback vo BGP, ngoi trR2, ch qun b loopback 10.2.2.0/24.
Cu hnh BGP trn R1
R1(config)#router bgp 65001
R1(config-router)#network 10.1.1.0 mask 255.255.255.0
R1(config-router)#network 10.1.102.0 mask 255.255.255.248
R1(config-router)#network 10.1.103.0 mask 255.255.255.248
R1(config-router)#exit
Cu hnh BGP trn R2
R2(config)#router bgp 65001
R2(config-router)#network 10.2.2.0 mask 255.255.255.0
R2(config-router)# network 10.1.102.0 mask 255.255.255.248
R2(config-router)# network 10.1.203.0 mask 255.255.255.248
R2(config-router)#network 10.20.0.0 mask 255.255.255.0
R2(config-router)#network 10.20.1.0 mask 255.255.255.0
R2(config-router)#network 10.20.2.0 mask 255.255.255.0
R2(config-router)#network 10.20.3.0 mask 255.255.255.0R2(config-router)#exit
Cu hnh BGP trn R3
R3(config)#router bgp 65001
R3(config-router)#network 10.3.3.0 mask 255.255.255.0
R3(config-router)#network 10.1.203.0 mask 255.255.255.248
R3(config-router)#network 10.1.103.0 mask 255.255.255.248
R3(config-router)#exit
Cu hnh BGP trn R4
R4(config)#router bgp 65002R4(config-router)#network 10.4.4.0 mask 255.255.255.0
-
5/26/2018 chuong6-bgp
36/49
Gio trnh thc hnh BSCI Chng 6 - BGP
232
R4(config-router)#network 192.168.14.0 mask 255.255.255.252
R4(config-router)#network 192.168.34.0 mask 255.255.255.252
R4(config-router)#network 172.16.0.0 mask 255.255.252.0
R4(config-router)#network 172.16.4.0 mask 255.255.252.0
R4(config-router)#network 172.16.8.0 mask 255.255.252.0R4(config-router)#network 172.16.12.0 mask 255.255.252.0
R4(config-router)#exit
Kim tra cu hnh
Hnh 6.5.3-13: Show ip bgp trn R1
Hnh 6.5.3-14: Show ip route bgp trn R1
-
5/26/2018 chuong6-bgp
37/49
Gio trnh thc hnh BSCI Chng 6 - BGP
233
Hnh 6.5.3-15: Show ip bgp trn R2
Hnh 6.5.3-16: Show ip route bgp trn R2
-
5/26/2018 chuong6-bgp
38/49
Gio trnh thc hnh BSCI Chng 6 - BGP
234
Hnh 6.5.3-17: Show ip bgp trn R3
Hnh 6.5.3-18: Show ip route bgp trn R3
-
5/26/2018 chuong6-bgp
39/49
Gio trnh thc hnh BSCI Chng 6 - BGP
235
Hnh 6.5.3-19: Show ip bgp trn R4
Hnh 6.5.3-20: Show ip route bgp trn R4
Bc 7: Trn R2, to mt static summary route cho cc interface
loopback cn li v qun b static route ny vo BGP.
R2(config)#router bgp 65001
R2(config-router)#aggregate-address 10.20.0.0 255.255.252.0
R2(config-router)#exit
-
5/26/2018 chuong6-bgp
40/49
Gio trnh thc hnh BSCI Chng 6 - BGP
236
Hnh 6.5.3-21: Show ip bgp trn R2
-
5/26/2018 chuong6-bgp
41/49
Gio trnh thc hnh BSCI Chng 6 - BGP
237
Hnh 6.5.3-22: Show ip bgp trn R4
Hnh 6.5.3-23: show ip route bgp trn R4
Bc 8:R4 gi mt summary route ca tt c interface loopback ti
vng International.
R4(config)#router bgp 65002
R4(config-router)#aggregate-address 172.16.0.0 255.255.240.0
R4(config-router)#end
-
5/26/2018 chuong6-bgp
42/49
Gio trnh thc hnh BSCI Chng 6 - BGP
238
Hnh 6.5.3-24: Show ip bgp trn R4
-
5/26/2018 chuong6-bgp
43/49
Gio trnh thc hnh BSCI Chng 6 - BGP
239
Hnh 6.5.3-25: Show ip bgp trn R2
Hnh 6.5.3-26: Show ip route bgp trn R2
Bc 9:R4 s dng ng n vng International bng lin kt giaR1 v R4. Hon thnh vic ny bng vic thay i thng s MED qun
b ti v Providers.
R4(config)#route-map PRIMARY_MED_OUT permit 10
R4(config-route-map)#set metric 50
R4(config-route-map)#exit
R4(config)#route-map SECONDARY_MED_OUT permit 10
R4(config-route-map)#set metric 100
R4(config-route-map)#exitR4(config)#router bgp 65002
-
5/26/2018 chuong6-bgp
44/49
Gio trnh thc hnh BSCI Chng 6 - BGP
240
R4(config-router)#neighbor 192.168.14.1 route-map PRIMARY_MED_OUT
out
R4(config-router)#neighbor 192.168.34.1 route-map
SECONDARY_MED_OUT out
R4(config-router)#endR4#clear ip bgp * soft
Kim tra kt qu sau khi set BGP MED
Bc 10: Nhng Router trong vng International s dng ng i ti
vng Provider thng qua lin kt Ethernet gia R1 v R4. hon
thnh vic ny, cn phi chnh sa thng s Local Preference ca cc
ng route qun b t Providers.
Set BGP Lo cal Preferen ce trn Router1
R1(config)#route-map PRIMARY_LocPrf_IN permit 10
R1(config-route-map)#set local-preference 150
R1(config-route-map)#exit
R1(config)#router bgp 65001
R1(config-router)#neighbor 192.168.14.2 route-map PRIMARY_ LocPrf_IN in
R1(config-router)#end
R1#clear ip bgp * soft
Set BGP Lo cal Preferen ce trn Router2
R3(config)#route-map SECONDARY_ LocPrf_IN permit 10R3(config-route-map)#set local-preference 50
R3(config-route-map)#exit
R3(config)#router bgp 64512
R3(config-router)#neighbor 192.168.34.2 route-map SECONDARY_
LocPrf_IN in
R3(config-router)#end
R3#clear ip bgp * soft
-
5/26/2018 chuong6-bgp
45/49
Gio trnh thc hnh BSCI Chng 6 - BGP
241
BBii66..66 BBGGPPRRoouutteeRReefflleeccttoorrss&&FFiilltteerrss
66..66..11 SSlluunnll
200.100.50.0/24
199.9.9.0/24
172.24.1.0/24192.168.1.4/30
AS 100AS 100
S0/3/1 S0/3/0
S0/0/1S0/3/0
R2
R1 R3
Hnh 6.6.1-1: Hnh v s lun l
66..66..22 MMccttiiuubbiitthhcchhnnhh
Bi lab ny cu hnh IBGP routers dng route reflector v route filter
66..66..33 HHnnggddnnccuuhhnnhhvvhhnnhhvvmmiinnhhhhaa
Bc 1:Cu hnh c bn cho R1, R2, R3
R1
Router(config)#hostname R1R1(config)#enable password cisco
R1(config)#no ip domain-lookup
R1(config)#banner motd ^C R1^C
R1(config)#line console 0
R1(config-line)# logging synchronous
R1(config-line)# password cisco
R1(config-line)# login
R1(config)#line vty 0 4
R1(config-line)# password cisco
-
5/26/2018 chuong6-bgp
46/49
Gio trnh thc hnh BSCI Chng 6 - BGP
242
R1(config-line)# login
R1(config)#interface Serial 0/3/0
R1(config-if)#ip address 192.168.1.5 255.255.255.252
R1(config-if)#clock rate 64000R1(config-if)#no shutdown
R1(config)#int loopback 0
R1(config-if)#ip address 192..168.100.1 255.255.255.0
R2
Router(config)#hostname R2
R2(config)#enable password cisco
R2(config)#no ip domain-lookup
R2(config)#banner motd ^C R2^C
R2(config)#line console 0
R2(config-line)# logging synchronous
R2(config-line)# password cisco
R2(config-line)# login
R2(config)#line vty 0 4
R2(config-line)# password cisco
R2(config-line)# login
R2(config)#interface Serial 0/3/0R2(config-if)#ip address 172.24.1.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config)#interface serial 0/3/1
R2(config-if)#ip address 192.168.1.6 255.255.255.252
R2(config-if)#no shutdown
R2(config)#interface loopback 0
R2(config-if)#ip address 200.100.50.1 255.255.255.0
R2(config-if)#exit
R3
Router(config)#hostname R3
R3(config)#enable password cisco
R3(config)#no ip domain-lookup
R3(config)#banner motd ^C R3^C
R3(config)#line console 0
R3(config-line)# logging synchronous
R3(config-line)# password cisco
R3(config-line)# login
-
5/26/2018 chuong6-bgp
47/49
Gio trnh thc hnh BSCI Chng 6 - BGP
243
R3(config)#line vty 0 4
R3(config-line)# password cisco
R3(config-line)# login
R3(config)#interface Serial 0/0/1R3(config-if)#ip address 172.24.1.2 255.255.255.0
R3(config-if)#no shutdown
R3(config)#interface loopback 0
R3(config-if)# ip address 199.9.9.1 255.255.255.0
R3(config-if)#exit
Bc 2:Cu hnh IBGP peers cho BGP. Sau cu hnh R2 route
reflector. Sau khi cu hnh xong R2, cu hnh 2 router cn li l route
reflector clients. IBGP kg cn cu hnh full mesh. Kim tra R2 cestablished peering vi R1 v R3 hay khng?
Cu hnh EIGRP cho R1, R2, R3
R1(config)#router eigrp 100
R1(config-router)#network 192.168.1.5 0.0.0.0
R1(config-router)#no auto-summary
R1(config-router)#end
R2(config)#router eigrp 100R2(config-router)#network 172.24.1.1 0.0.0.0
R2(config-router)#network 192.168.1.6 0.0.0.0
R2(config-router)#network 200.100.50.1 0.0.0.0
R2(config-router)#passive-interface loopback 0
R2(config-router)#no auto-summary
R2(config-router)#end
R3(config)#router eigrp 100
R3(config-router)#network 172.24.1.2 0.0.0.0
R3(config-router)#passive-interface loopback 0
R3(config-router)#no auto-summary
R3(config-router)#end
Cu hnh iBGP cho R1, R2, R3
R1(config)#router bgp 100
R1(config-router)#neighbor 192.168.1.6 remote-as 100
R1(config-router)#end
R2(config)#router bgp 100
-
5/26/2018 chuong6-bgp
48/49
Gio trnh thc hnh BSCI Chng 6 - BGP
244
R2(config-router)#neighbor 192.168.1.5 remote-as 100
R2(config-router)#neighbor 172.24.1.2 remote-as 100
R2(config-router)#end
R3(config)#router bgp 100R3(config-router)#neighbor 172.24.1.1 remote-as 100
R3(config-router)#end
Bc 3:Inject an External Route vo BGP
R3(config)#router bgp 100
R3(config-router)#network 199.9.9.0 mask 255.255.255.0
Hnh 6.6.3-1: show ip route tren R1
R2(config)#router bgp 100
R2(config-router)#neighbor 192.168.1.5 route-reflector-client
R2(config-router)#neighbor 172.24.1.2 route-reflector-client
R2(config-router)#end
Hnh 6.6.3-2: Show ip route tren R1 khi su dung route-reflector-client
-
5/26/2018 chuong6-bgp
49/49
Gio trnh thc hnh BSCI Chng 6 - BGP
245
Bc 4:Inject mtSummary Address vo BGP, cu hnh R3 inject mt
summary address vo BGP
R3(config)#router bgp 100
R3(config-router)#aggregate-address 199.0.0.0 255.0.0.0R3(config-router)#end
Hnh 6.6.3-3: Show ip route tren R1
Hnh 6.6.3-4: show ip bgp trn R2
R2(config)#ip prefix-list SUPERNETONLY permit 199.0.0.0/8
R2(config)#router bgp 100
R2(config-router)#neighbor 192.168.1.5 prefix-list SUPERNETONLY out
R2(config-router)#end
Hnh 6.6.3-5: show ip route tren R1 khi su dung prefix-list