• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
Xin chào ! Nếu đây là lần đầu tiên bạn đến với diễn đàn, xin vui lòng danh ra một phút bấm vào đây để đăng kí và tham gia thảo luận cùng VnPro.

Announcement

Collapse
No announcement yet.

BGP With Community Attribute

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • BGP With Community Attribute

    THUỘC TÍNH COMMUNITIES TRONG BGP

    1. Mục tiêu
    Trong bài lab này, chúng ta sẽ sử dụng thuộc tính COMMUNITIES áp dụng vào routing policy

    2. Hoàn cảnh



    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.

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

    b. Bước 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
    BGP table version is 4, local router ID is 3.0.0.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
    *> 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

    c. Bước 3:
    Áp dụng routing policy 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. Chờ một thời gian, 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
    [fade:e847b974f6]Community: no-export[/fade:e847b974f6]

    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
    BGP table version is 7, local router ID is 3.0.0.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
    *> 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 database BGP và bảng routing của ISPB đã không còn xuất hiện network 1.0.0.0 nữa.

    4. 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
    Building configuration...

    Current configuration:
    !
    version 11.3
    service timestamps debug uptime
    service timestamps log uptime
    no service password-encryption
    !
    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
Working...
X