• 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.

Lab 4.2: Cấu hình bgp cơ bản (bài số 2)

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

  • Lab 4.2: Cấu hình bgp cơ bản (bài số 2)

    Click image for larger version  Name:	30-3 HÌNH 1.jpg Views:	0 Size:	65.9 KB ID:	427124
    1. Yêu cầu

    Chạy định tuyến BGP, đảm bảo:
    • Các địa chỉ Public của AS1 và AS2 có thể ping lẫn nhau không cần NAT.
    • Các địa chỉ Private của AS1 và AS2 muốn đi ra ngoài (đến ISP) thì phải thực hiện NAT.
    2. Thực hiện

    Ta thực hiện các yêu cầu nêu trên theo trình tự các bước như sau:
    • Đặt IP trên các cổng như hình 4.2 rồi chạy định tuyến nội OSPF trong ISP.
    • Chạy BGP trên các router. Với các router trong ISP phải thiết lập IBGP full – mesh.
    • Sử dụng câu lệnh “network” trên các router để chọn các route thích hợp quảng bá vào BGP.
    Bước 1: Sau khi đặt IP như hình vẽ, ta chạy định tuyến OSPF trên các router của ISP:


    R2
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    R3
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    R4
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    Bước 2: Chạy BGP trên các router.


    R1
    router bgp 1
    no synchronization
    bgp log-neighbor-changes
    network 100.1.1.0 mask 255.255.255.0
    neighbor 192.168.12.2 remote-as 234
    no auto-summary
    R2
    router bgp 234
    no synchronization
    bgp log-neighbor-changes
    network 102.1.1.0 mask 255.255.255.0
    neighbor 192.168.12.1 remote-as 1
    neighbor 192.168.23.3 remote-as 234
    neighbor 192.168.34.4 remote-as 234
    no auto-summary
    R3
    router bgp 234
    no synchronization
    bgp log-neighbor-changes
    network 103.1.1.0 mask 255.255.255.0
    neighbor 192.168.23.2 remote-as 234
    neighbor 192.168.34.4 remote-as 234
    no auto-summary
    R4
    router bgp 234
    no synchronization
    bgp log-neighbor-changes
    network 104.1.1.0 mask 255.255.255.0
    neighbor 192.168.23.2 remote-as 234
    neighbor 192.168.34.3 remote-as 234
    neighbor 192.168.45.5 remote-as 2
    no auto-summary
    R5
    router bgp 2
    no synchronization
    bgp log-neighbor-changes
    network 200.1.1.0
    neighbor 192.168.45.4 remote-as 234
    no auto-summary

    Để đáp ứng được yêu cầu bài lab, lưu ý rằng hai router R1 và R5 không quảng bá các mạng private ra ngoài AS bằng BGP, chỉ quảng bá các mạng public. Từ đó hai router R1 và R5 sẽ thấy được các địa chỉ public của nhau thông qua BGP và vì vậy các địa chỉ public này có thể đi đến nhau được mà không cần NAT.
    Để cho các địa chỉ Private có thể đi ra ngoài các AS của chúng và các gói tin có thể trả về được, chúng ta phải thực hiện NAT với các địa chỉ này, ta cũng cần default – route trỏ về ISP để các địa chỉ này có thể đi ra ngoài AS:

    R1
    !
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.12.2
    R5
    !
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.45.4

    Xem bảng định tuyến trên R3:

    R3#show ip route
    (đã bỏ qua một số dòng)
    102.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    B 102.1.1.0/24 [200/0] via 192.168.23.2, 00:54:10
    O 102.1.1.1/32 [110/2] via 192.168.23.2, 00:54:02, FastEthernet0/1
    O 192.168.12.0/24 [110/2] via 192.168.23.2, 00:54:02, FastEthernet0/1
    103.0.0.0/24 is subnetted, 1 subnets
    C 103.1.1.0 is directly connected, Loopback0
    100.0.0.0/24 is subnetted, 1 subnets
    B 100.1.1.0 [200/0] via 192.168.12.1, 00:47:37
    O 192.168.45.0/24 [110/2] via 192.168.34.4, 00:54:02, FastEthernet0/0
    B 200.1.1.0/24 [200/0] via 192.168.45.5, 00:40:55
    C 192.168.23.0/24 is directly connected, FastEthernet0/1
    C 192.168.34.0/24 is directly connected, FastEthernet0/0
    104.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    B 104.1.1.0/24 [200/0] via 192.168.34.4, 01:09:46
    O 104.1.1.1/32 [110/2] via 192.168.34.4, 00:54:03, FastEthernet0/0

    Các route BGP học được trên R3 đều chỉ next – hop về các router bên ngoài AS. Để hiển thị next – hop là router đã gửi thông tin cập nhật trên R3, các router R2 và R4 phải sử dụng thông số “next-hop-self” trong câu lệnh “neighbor”.

    R2
    router bgp 234
    neighbor 192.168.23.3 next-hop-self
    neighbor 192.168.34.4 next-hop-self
    R4
    router bgp 234
    neighbor 192.168.23.2 next-hop-self
    neighbor 192.168.34.3 next-hop-self

    Xem lại bảng định tuyến trên R3:

    R3#show ip route
    (đã bỏ qua một số dòng)
    102.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    B 102.1.1.0/24 [200/0] via 192.168.23.2, 00:54:10
    O 102.1.1.1/32 [110/2] via 192.168.23.2, 00:54:02, FastEthernet0/1
    O 192.168.12.0/24 [110/2] via 192.168.23.2, 00:54:02, FastEthernet0/1
    103.0.0.0/24 is subnetted, 1 subnets
    C 103.1.1.0 is directly connected, Loopback0
    100.0.0.0/24 is subnetted, 1 subnets
    B 100.1.1.0 [200/0] via 192.168.23.2, 00:47:37
    O 192.168.45.0/24 [110/2] via 192.168.34.4, 00:54:02, FastEthernet0/0
    B 200.1.1.0/24 [200/0] via 192.168.34.4, 00:40:55
    C 192.168.23.0/24 is directly connected, FastEthernet0/1
    C 192.168.34.0/24 is directly connected, FastEthernet0/0
    104.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    B 104.1.1.0/24 [200/0] via 192.168.34.4, 01:09:46

    Ta thấy địa chỉ next – hop cho các mạng được học từ bên ngoài đã thay đổi.
    Ta thực hiện NAT để các mạng private đi ra được bên ngoài:

    R1
    R1(config)#access-list 1 permit 192.168.1.0 0.0.0.255
    R1(config)#ip nat inside source list 1 int f0/0 overload
    R1(config)#int f0/0
    R1(config-if)#ip nat outside
    R1(config-if)#int loopback 0
    R1(config-if)#ip nat inside

    Thực hiện ping kiểm tra từ một địa chỉ private trên R1:

    R1#ping 102.1.1.1 source 192.168.1.1
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 102.1.1.1, timeout is 2 seconds:
    Packet sent with a source address of 192.168.1.1
    !!!!!
    Success rate is 100 percent (5/5), round-trip min/avg/max = 24/42/96 ms

    Xem kết quả NAT trên bảng NAT:

    R1#sh ip nat translations
    Pro Inside global Inside local Outside local Outside global
    icmp 192.168.12.1:3 192.168.1.1:3 102.1.1.1:3 102.1.1.1:3

    Thực hiện tương tự với R5:

    R5
    R5(config)#access-list 1 permit 192.168.2.0
    R5(config)#ip nat inside source list 1 int f0/1 overload
    R5(config)#
    R5(config)#int f0/1
    R5(config-if)#ip nat outside
    R5(config-if)#int loopback 0
    R5(config-if)#ip nat inside
    3. Cấu hình cuối cùng

    R1
    interface Loopback0
    ip address 192.168.1.1 255.255.255.0
    !
    interface Loopback1
    ip address 100.1.1.1 255.255.255.0
    !
    interface FastEthernet0/0
    ip address 192.168.12.1 255.255.255.0
    ip nat outside
    !
    router bgp 1
    no synchronization
    bgp log-neighbor-changes
    network 100.1.1.0 mask 255.255.255.0
    neighbor 192.168.12.2 remote-as 234
    no auto-summary
    !
    ip nat inside source list 1 interface FastEthernet0/0 overload
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.12.2

    R2
    interface Loopback0
    ip address 102.1.1.1 255.255.255.0
    !
    interface FastEthernet0/0
    ip address 192.168.12.2 255.255.255.0
    duplex auto
    speed auto
    !
    interface FastEthernet0/1
    ip address 192.168.23.2 255.255.255.0
    !
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    !
    router bgp 234
    no synchronization
    bgp log-neighbor-changes
    network 102.1.1.0 mask 255.255.255.0
    neighbor 192.168.12.1 remote-as 1
    neighbor 192.168.23.3 remote-as 234
    neighbor 192.168.23.3 next-hop-self
    neighbor 192.168.34.4 remote-as 234
    neighbor 192.168.34.4 next-hop-self
    no auto-summary

    R3
    interface Loopback0
    ip address 103.1.1.1 255.255.255.0
    !
    interface FastEthernet0/0
    ip address 192.168.34.3 255.255.255.0
    duplex auto
    speed auto
    !
    interface FastEthernet0/1
    ip address 192.168.23.3 255.255.255.0
    !
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    !
    router bgp 234
    no synchronization
    bgp log-neighbor-changes
    network 103.1.1.0 mask 255.255.255.0
    neighbor 192.168.23.2 remote-as 234
    neighbor 192.168.23.2 next-hop-self
    neighbor 192.168.34.4 remote-as 234
    neighbor 192.168.34.4 next-hop-self
    no auto-summary

    R4
    interface Loopback0
    ip address 104.1.1.1 255.255.255.0
    !
    interface FastEthernet0/0
    ip address 192.168.34.4 255.255.255.0
    duplex auto
    speed auto
    !
    interface FastEthernet0/1
    ip address 192.168.45.4 255.255.255.0
    !
    router ospf 1
    log-adjacency-changes
    network 0.0.0.0 255.255.255.255 area 0
    !
    router bgp 234
    no synchronization
    bgp log-neighbor-changes
    network 104.1.1.0 mask 255.255.255.0
    neighbor 192.168.23.2 remote-as 234
    neighbor 192.168.23.2 next-hop-self
    neighbor 192.168.34.3 remote-as 234
    neighbor 192.168.34.3 next-hop-self
    neighbor 192.168.45.5 remote-as 2
    no auto-summary

    R5
    interface Loopback0
    ip address 192.168.2.1 255.255.255.0
    ip nat inside
    !
    interface Loopback1
    ip address 200.1.1.1 255.255.255.0
    !
    interface FastEthernet0/1
    ip address 192.168.45.5 255.255.255.0
    ip nat outside
    !
    router bgp 2
    no synchronization
    bgp log-neighbor-changes
    network 200.1.1.0
    neighbor 192.168.45.4 remote-as 234
    no auto-summary
    !
    ip nat inside source list 1 interface FastEthernet0/1 overload
    ip classless
    ip route 0.0.0.0 0.0.0.0 192.168.45.4
    Email : vnpro@vnpro.org
    ---------------------------------------------------------------------------------------------------------------
Trung Tâm Tin Học VnPro
149/1D Ung Văn Khiêm P25 Q.Bình thạnh TPHCM
Tel : (08) 35124257 (5 lines)
Fax: (08) 35124314

Home page: http://www.vnpro.vn
Support Forum: http://www.vnpro.org
- Chuyên đào tạo quản trị mạng và hạ tầng Internet
- Phát hành sách chuyên môn
- Tư vấn và tuyển dụng nhân sự IT
- Tư vấn thiết kế và hỗ trợ kỹ thuật hệ thống mạng

Network channel: http://www.dancisco.com
Blog: http://www.vnpro.org/blog
Working...
X