PDA

View Full Version : Lab 8-2: THUỘC TÍNH COMMUNITIES TRONG BGP



admin
31-01-2005, 02:15 PM
Lab 8-2: THUỘC TÍNH COMMUNITIES TRONG BGP

Trong bài thực hành này, chúng ta sẽ sử dụng thuộc tính COMMUNITIES áp dụng vào routing chính sách định tuyến

http://vnpro.org/forum/files/labrouting/lab82/lab82.JPG

Mạng của Công ty ABC ở Sài Gòn, được ISPA cung cấp AS number 100. ISP (AS 200) sử dụng BGP để trao đổi thông tin định tuyến với ABC và ISPB (AS 300). Công ty ABC không muốn một số route được ISPA quảng bá cho ISPB. Nhiệm vụ của phòng kỹ thuật công ty ABC là cấu hình router SaiGon sao cho đạt được yêu cầu trên.


Thực hiện



1. Kết nối mạng theo sơ đồ như trên. Cấu hình hostname, địa chỉ IP các cổng serial, loopback theo đúng sơ đồ. Chưa cấu hình giao thức định tuyến. Kiểm tra các kết nối trực tiếp bằng lệnh ping và show cdp neighbor.



2. Cấu hình định tuyến EBGP cho các router:



SaiGon(config)#router bgp 100

SaiGon(config-router)neighbor 192.168.1.6 remote-as 200

SaiGon(config-router)network 1.0.0.0



ISPA(config)#router bgp 200

ISPA(config-router)neighbor 192.168.1.5 remote-as 100

ISPA(config-router)neighbor 172.24.1.18 remote-as 300

ISPA(config-router)network 2.0.0.0



ISPB(config)#router bgp 300

ISPB(config-router)neighbor 172.24.1.17 remote-as 200

ISPB(config-router)network 3.0.0.0



Sau đó, kiểm tra cấu hình trên tất cả các router, dùng lệnh show ip route và show ip bgp. Router ISPB phải có route đến network 1.0.0.0/8 thuộc router SaiGon



ISPB#show ip route

Gateway of last resort is not set

B 1.0.0.0/8 [20/0] via 172.24.1.17, 00:01:32

B 2.0.0.0/8 [20/0] via 172.24.1.17, 00:01:32

C 3.0.0.0/8 is directly connected, Loopback0

172.24.0.0/30 is subnetted, 1 subnets

C 172.24.1.16 is directly connected, Serial0/1



ISPB#show ip bgp

Network Next Hop Metric LocPrf Weight Path

*> 1.0.0.0 172.24.1.17 0 200 100 i

*> 2.0.0.0 172.24.1.17 0 0 200 i

*> 3.0.0.0 0.0.0.0 0 32768 i



3. Áp dụng routing chính sách định tuyến không cho router ISPA quảng bá network 1.0.0.0 cho ISPB:



SaiGon(config)#access-list 1 permit 1.0.0.0 0.255.255.255

SaiGon(config)#route-map No_One_Net 10

SaiGon(config-route-map)#match ip address 1

SaiGon(config-route-map)#set community no-export

SaiGon(config-route-map)#route-map No_One_Net 20

SaiGon(config-route-map)#exit

SaiGon(config)#router bgp 100

SaiGon(config-router)#neighbor 192.168.1.6 route-map No_One_Net out

SaiGon(config-router)#neighbor 192.168.1.6 send-community



Sau đó, dùng lệnh clear ip bgp * trên các router để reset các kết nối BGP. Dùng lệnh show ip bgp 1.0.0.0 trên router ISPA xem kết quả



ISPA#show ip bgp 1.0.0.0

BGP routing table entry for 1.0.0.0/8, version 4

Paths: (1 available, best #1, not advertised to EBGP peer)

100

192.168.1.5 from 192.168.1.5 (1.0.0.1)

Origin IGP, metric 0, localpref 100, valid, external, best

Community: no-export



Router ISPA đã nhận route 1.0.0.0 có thuộc tính COMMUNITY là no-export, tức là không quảng bá route này cho các AS khác (trong trường hợp này là router ISPB). Trên router ISPB, ta dùng lệnh show ip bgp và show ip route để kiểm chứng



ISPB#show ip bgp

Network Next Hop Metric LocPrfWeight Path

*> 2.0.0.0 172.24.1.17 0 0 200 i

*> 3.0.0.0 0.0.0.0 0 32768 i



ISPB#show ip route

Gateway of last resort is not set

B 2.0.0.0/8 [20/0] via 172.24.1.17, 00:05:41

C 3.0.0.0/8 is directly connected, Loopback0

172.24.0.0/30 is subnetted, 1 subnets

C 172.24.1.16 is directly connected, Serial0/1



Ta thấy trong bảng BGP và bảng định tuyến của ISPB đã không còn xuất hiện network 1.0.0.0 nữa.


Cấu hình



SaiGon#show running-config

Building configuration...



Current configuration:

!

version 12.0

service timestamps debug uptime

service timestamps log uptime

no service password-encryption

!

hostname SaiGon

!

ip subnet-zero

no ip domain-lookup

!

interface Loopback0

ip address 1.0.0.1 255.0.0.0

no ip directed-broadcast

!

interface Serial0/1

ip address 192.168.1.5 255.255.255.252

no ip directed-broadcast

!

router bgp 100

network 1.0.0.0

neighbor 192.168.1.6 remote-as 200

neighbor 192.168.1.6 send-community

neighbor 192.168.1.6 route-map No_One_Net out

!

ip classless

!

access-list 1 permit 1.0.0.0 0.255.255.255

route-map No_One_Net permit 10

match ip address 1

set community no-export

!

route-map No_One_Net permit 20

!

line con 0

logging synchronous

transport input none

line aux 0

line vty 0 4

privilege level 15

no login

!

no scheduler allocate

end

ISPA#show running-config

!

hostname ISPA

!

no ip domain-lookup

!

interface Loopback0

ip address 2.0.0.1 255.0.0.0

!

interface Serial0/0

ip address 192.168.1.6 255.255.255.252

clockrate 64000

!

interface Serial0/1

ip address 172.24.1.17 255.255.255.252

clockrate 64000

!

router bgp 200

network 2.0.0.0

neighbor 172.24.1.18 remote-as 300

neighbor 192.168.1.5 remote-as 100

!

ip classless

!

line con 0

logging synchronous

line aux 0

line vty 0 4

privilege level 15

no login

!

no scheduler allocate

end

ISPB#show running-config

Building configuration...

Current configuration : 1005 bytes

!

version 12.1

no service single-slot-reload-enable

service timestamps debug uptime

service timestamps log uptime

no service password-encryption

!

hostname ISPB

!

no logging buffered

logging rate-limit console 10 except errors

!

ip subnet-zero

!

no ip domain-lookup

!

interface Loopback0

ip address 3.0.0.1 255.0.0.0

!

interface Serial0/1

ip address 172.24.1.18 255.255.255.252

!

router bgp 300

bgp log-neighbor-changes

network 3.0.0.0

neighbor 172.24.1.17 remote-as 200

!

ip kerberos source-interface any

ip classless

no ip http server

!

line con 0

logging synchronous

transport input none

line aux 0

line vty 0 4

privilege level 15

no login

!

no scheduler allocate

end