<?xml version="1.0" encoding="UTF-8" ?><!-- generator=Zoho Sites --><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><atom:link href="https://www.daihockhonggiay.com/blogs/tag/pbr/feed" rel="self" type="application/rss+xml"/><title>Đại học Không Giấy - Blog #PBR</title><description>Đại học Không Giấy - Blog #PBR</description><link>https://www.daihockhonggiay.com/blogs/tag/pbr</link><lastBuildDate>Wed, 10 Sep 2025 16:39:59 -0700</lastBuildDate><generator>http://zoho.com/sites/</generator><item><title><![CDATA[ Cấu hình Policy based Routing (PBR)]]></title><link>https://www.daihockhonggiay.com/blogs/post/cau-hinh-policy-based-routing-pbr</link><description><![CDATA[<img align="left" hspace="5" src="https://www.daihockhonggiay.com/pbr.jpg"/>Bài viết này sẽ hướng dẫn các bạn cấu hình Policy based Routing]]></description><content:encoded><![CDATA[<div class="zpcontent-container blogpost-container "><div data-element-id="elm_xWqLVHq9TjGQg3uTQUyqmA" data-element-type="section" class="zpsection "><style type="text/css"></style><div class="zpcontainer-fluid zpcontainer"><div data-element-id="elm_0pnVpUBLRXOYtuq8QGp2vQ" data-element-type="row" class="zprow zprow-container zpalign-items- zpjustify-content- " data-equal-column=""><style type="text/css"></style><div data-element-id="elm_VQfA0lb-RSucCEyoWRysKg" data-element-type="column" class="zpelem-col zpcol-12 zpcol-md-12 zpcol-sm-12 zpalign-self- "><style type="text/css"> [data-element-id="elm_VQfA0lb-RSucCEyoWRysKg"].zpelem-col{ border-style:none; } </style><div data-element-id="elm_rTuUEjfFSPqDj0LwDoWODQ" data-element-type="text" class="zpelement zpelem-text "><style> [data-element-id="elm_rTuUEjfFSPqDj0LwDoWODQ"].zpelem-text { border-style:none; } </style><div class="zptext zptext-align-center " data-editor="true"><p style="text-align:left;"><span style="font-weight:700;">I. Nội dung</span></p><p style="text-align:left;"><span style="font-size:14px;">PBR là 1 giải pháp giúp người quản trị mạng có thể điều khiển đường đi của gói tin bằng cách quy định các chính sách. Từ đó giúp cho người quản trị có thể phân luồng dữ liệu tốt hơn trong quá trình hoạt động. PBR có thể chuyển tiếp gói tin mà không cần quan tâm tới địa chỉ mạng đích của gói tin, thậm chí thông tin về đường đi đến mạng đích đó không có trong bảng định tuyến.</span></p><p style="text-align:left;"><span style="font-size:14px;">Khi sử dụng PBR quá trình chuyển tiếp gói tin theo ip đích sẽ bị chèn bởi chính sách định tuyến của PBR. Điều kiện của PBR sẽ được kiểm tra trước so với bảng định tuyến, nếu gói tin đáp ứng thì thực thi chính sách của PBR, trong trường hợp gói tin đó không đáp ứng, gói tin sẽ được định tuyến dựa trên bảng định tuyến của router như bình thường.</span></p><p style="text-align:left;"><span style="color:inherit;font-size:14px;"></span></p><p style="text-align:left;"><span style="font-size:14px;">PBR lựa chọn tuyến đường đi cho gói tin bằng cách sử dụng một bộ lọc với các điều kiện được thiếp lập thông qua Route map. Một route map được định nghĩa bằng các câu lệnh match để thiết lập điều kiện sau đó thực thi các chính sách bằng câu lệnh set. Sau khi tạo ra route map, nó sẽ được gán với 1 interface của router, và bất cứ gói tin nào đi vào interce đó đều sẽ được kiểm tra và so sánh với các điều kiện của route map.</span></p><p><span></span></p><h1 style="margin-bottom:10px;"><div style="text-align:left;"><span style="font-size:14px;color:rgb(0, 0, 0);font-weight:bold;">II. Cấu hình</span></div><p style="margin-bottom:20px;"><img src="/Network/5/17.jpg"><br></p><p style="margin-bottom:20px;"></p><div style="text-align:left;"><span style="font-size:14px;color:rgb(0, 0, 0);">Ví dụ: &nbsp;PC1 PC3 đi ra Internet qua đường R2 -&gt; ISP-Viettel và PC2 PC4 đi ra Internet bằng đường R3 -&gt; ISP-VNPT</span></div><span style="font-size:14px;"><span style="color:rgb(0, 0, 0);"><div style="text-align:left;">Khi R2 ISP-Viettel đứt PC1 PC3 đi Internet bằng đường R3 -&gt; ISP-VNPT, khi phục hồi, sẽ đi như cũ.</div></span><p></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Khi R3 ISP-VNPT đứt PC2 PC4 đi Internet bằng đường R2 -&gt; ISP-Viettel, khi phục hồi, sẽ đi như cũ.</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Các bước làm:</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Đặt địa chỉ ip cho các PC</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1 cấu hình sub interface cho vlan 10, vlan 20, địa chỉ ip cho cổng</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Cấu hình static route cho R1: Định tuyến đến R2, R3</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">172.16.16.2: R2 f0/1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">172.16.17.2: R3 f0/1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config)#ip route 0.0.0.0 0.0.0.0 172.16.16.2 250</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config)#ip route 0.0.0.0 0.0.0.0 172.16.17.2 254</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Chỉ số 250, 254 là distance metric, là khoảng cách từ router hiện tại đến IP đích, giá trị có ý nghĩa so sánh, 250 nhỏ hơn vậy R1 sẽ ưu tiên đi theo ISP Viettel trước.</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R2 cấu hình địa chỉ ip cho cổng, cấu hình nat, access-list</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Cấu hình static route cho R2: Định tuyến đến ISP Viettel và về R1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">172.16.16.1: R1 f0/0</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.43.1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R2(config)#ip route 10.123.10.0 255.255.255.0 172.16.16.1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R2(config)#ip route 10.123.20.0 255.255.255.0 172.16.16.1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R3 cấu hình địa chỉ ip cho cổng, cấu hình nat, access-list</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Cấu hình static route cho R3: Định tuyến đến ISP VNPT và về R1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">172.16.17.1: R1 f1/0</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.2</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R3(config)#ip route 10.123.10.0 255.255.255.0 172.16.17.1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R3(config)#ip route 10.123.20.0 255.255.255.0 172.16.17.1</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Cấu hình để PC2, PC4 đi internet theo ISP-VNPT</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Tạo access-list permit 2 PC:</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config)#access-list 24 permit host 10.123.10.12</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config)#access-list 24 permit host 10.123.20.14</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Tạo route-map và gán với access-list: IP next-hop là địa chỉ đầu ngoài f0/1 của R3</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config)#route-map pc24 permit 10</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config-route-map)#match ip address 24</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config-route-map)#set ip default next-hop 172.16.17.2</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config-route-map)#exit</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Gắn policy route map cho cổng: Theo vlan 10, vlan 20</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config)#int f0/1.10</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config-subif)#ip policy route-map pc24</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config-subif)#exit</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config)#int f0/1.20</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">R1(config-subif)#ip policy route-map pc24</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">PC1, PC3 sẽ đi theo default route tới ISP Viettel, PC2, PC4 sẽ đi theo route map, còn nếu bị đứt ở R1-R2 thì PC1, PC3 sẽ đi theo default route còn lại tới ISP VNPT</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Trường hợp R1 R3 bị đứt, route map sẽ không có tác dụng và PC2, PC4 đi theo định tuyến cơ bản</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Nếu set ip default next-hop, sẽ xét bảng định tuyến, nếu ko có route, mới xử lí PBR</span></p><p style="text-align:left;margin-bottom:20px;"><span style="color:rgb(0, 0, 0);">Nếu set ip next-hop, router sẽ xét PBR trước</span></p><p style="color:rgb(0, 0, 0);text-align:left;"><span style="color:inherit;"><br></span></p><p style="color:rgb(0, 0, 0);text-align:left;"><span style="color:inherit;">-----&amp;-----&amp;-----</span><br></p><p style="color:rgb(0, 0, 0);text-align:left;"><span style="font-weight:bold;">Để quay về danh sách các bài phần Network các bạn chọn link sau</span></p><p style="color:rgb(0, 0, 0);text-align:left;"><a href="https://www.quantrimangdn.com/blogs/post/tong-hop-cac-bai-phan-network" style="text-decoration-line:underline;color:rgb(74, 43, 212);">https://www.quantrimangdn.com/blogs/post/tong-hop-cac-bai-phan-network</a></p></span></h1></div>
</div></div></div></div></div></div> ]]></content:encoded><pubDate>Fri, 03 May 2019 02:16:08 +0700</pubDate></item></channel></rss>