{"id":24459,"date":"2022-11-09T09:53:16","date_gmt":"2022-11-09T06:53:16","guid":{"rendered":"https:\/\/web-dev.iptp.net\/?p=24459"},"modified":"2025-04-18T10:10:31","modified_gmt":"2025-04-18T07:10:31","slug":"what-is-bgp","status":"publish","type":"post","link":"https:\/\/www.iptp.us\/vi\/blog\/what-is-bgp\/","title":{"rendered":"BGP l\u00e0 g\u00ec? Gi\u1ea3i th\u00edch v\u1ec1 giao th\u1ee9c Border Gateway Protocol"},"content":{"rendered":"<p>Internet l&agrave; t&#7853;p h&#7907;p c&aacute;c m&#7841;ng (ho&#7863;c h&#7879; th&#7889;ng t&#7921; tr&#7883;) k&#7871;t n&#7889;i v&agrave; giao ti&#7871;p v&#7899;i nhau. C&aacute;c m&#7841;ng c&#7847;n m&#7897;t ph&#432;&#417;ng ph&aacute;p &#273;&#7875; truy&#7873;n nh&#7853;n th&ocirc;ng tin v&#7899;i nhau.<\/p><p>M&#7897;t ph&#432;&#417;ng th&#7913;c ph&#7893; bi&#7871;n &#273;&#7875; c&aacute;c m&#7841;ng t&#432;&#417;ng t&aacute;c v&#7899;i nhau l&agrave; BGP &ndash; Giao th&#7913;c &#273;&#7883;nh tuy&#7871;n c&#7911;a Internet.<\/p><p>BGP qu&#7843;n l&yacute; c&aacute;ch c&aacute;c g&oacute;i d&#7919; li&#7879;u &#273;&#432;&#7907;c ph&acirc;n ph&#7889;i gi&#7919;a c&aacute;c m&#7841;ng v&agrave; t&igrave;m t&#7845;t c&#7843; c&aacute;c tuy&#7871;n &#273;&#432;&#7901;ng m&agrave; Internet c&oacute; tr&ecirc;n kh&#7855;p th&#7871; gi&#7899;i. T&oacute;m l&#7841;i, BGP l&agrave; giao th&#7913;c &#273;&#7883;nh tuy&#7871;n gi&uacute;p Internet ho&#7841;t &#273;&#7897;ng hi&#7879;u qu&#7843; nh&#432; ch&uacute;ng ta bi&#7871;t.<\/p><h2>BGP l&agrave; g&igrave;?<\/h2><h3>&#272;&#7883;nh ngh&#297;a Giao th&#7913;c Border Gateway Protocol <\/h3><p><b>BGP<\/b>, c&ograve;n &#273;&#432;&#7907;c g&#7885;i l&agrave; <b>Border Gateway Protocol<\/b>, l&agrave; giao th&#7913;c &#273;&#7883;nh tuy&#7871;n &#273;&#432;&#7907;c s&#7917; d&#7909;ng cho m&#7841;ng Internet to&agrave;n c&#7847;u. <b>BGP<\/b> x&aacute;c &#273;&#7883;nh c&aacute;c &#273;i&#7873;u ki&#7879;n m&#7841;ng m&#7899;i nh&#7845;t &#273;&#7875; t&igrave;m ra &#273;&#432;&#7901;ng &#273;i t&#7889;i &#432;u. C&aacute;c &#273;i&#7873;u ki&#7879;n m&#7841;ng n&agrave;y c&#7853;p nh&#7853;t kh&#7843; n&#259;ng ti&#7871;p c&#7853;n v&agrave; th&ocirc;ng tin &#273;&#7883;nh tuy&#7871;n gi&#7919;a c&aacute;c router t&#7841;i bi&ecirc;n. <b>BGP<\/b> &#273;&#7883;nh tuy&#7871;n l&#432;u l&#432;&#7907;ng v&agrave; qu&#7843;n l&yacute; c&aacute;ch c&aacute;c t&#7853;p tin &#273;&#432;&#7907;c g&#7917;i gi&#7919;a c&aacute;c h&#7879; th&#7889;ng t&#7921; tr&#7883; (AS) &ndash; c&aacute;c network qu&#7843;n l&yacute; b&#7903;i doanh nghi&#7879;p ho&#7863;c nh&agrave; m&#7841;ng.<\/p><h3>H&#7879; th&#7889;ng t&#7921; tr&#7883; (Autonomous System)<\/h3><h4>H&#7879; th&#7889;ng t&#7921; tr&#7883; l&agrave; g&igrave;?<\/h4><p>H&#7879; th&#7889;ng t&#7921; tr&#7883; (Autonomous System &ndash; AS) l&agrave; m&#7897;t m&#7841;ng IP l&#7899;n ho&#7863;c m&#7897;t nh&oacute;m m&#7841;ng &#273;&#432;&#7907;c &#273;i&#7873;u h&agrave;nh b&#7903;i c&aacute;c nh&agrave; m&#7841;ng c&oacute; ch&iacute;nh s&aacute;ch &#273;&#7883;nh tuy&#7871;n th&#7889;ng nh&#7845;t. Internet l&agrave; m&#7897;t m&#7841;ng c&#7911;a c&aacute;c m&#7841;ng &#273;&#432;&#7907;c t&#7841;o th&agrave;nh t&#7915; v&ocirc; s&#7889; Autonomous System nh&#7887; h&#417;n. M&#7885;i m&aacute;y t&iacute;nh ho&#7863;c thi&#7871;t b&#7883; k&#7871;t n&#7889;i Internet &#273;&#7873;u &#273;&#432;&#7907;c k&#7871;t n&#7889;i v&#7899;i h&#7879; th&#7889;ng t&#7921; tr&#7883;.<\/p><p>Peering l&agrave; c&aacute;ch c&aacute;c h&#7879; th&#7889;ng t&#7921; tr&#7883; giao ti&#7871;p v&agrave; trao &#273;&#7893;i l&#432;u l&#432;&#7907;ng m&#7841;ng. M&#7897;t ph&#432;&#417;ng ph&aacute;p m&agrave; c&aacute;c h&#7879; th&#7889;ng t&#7921; tr&#7883; peering v&#7899;i nhau l&agrave; th&ocirc;ng qua c&aacute;c v&#7883; tr&iacute; v&#7853;t l&yacute; g&#7885;i l&agrave; &#272;i&#7875;m trao &#273;&#7893;i Internet (IXP).<\/p><p>C&aacute;c h&#7879; th&#7889;ng m&#7899;i li&ecirc;n t&#7909;c xu&#7845;t hi&#7879;n tr&ecirc;n Internet, trong khi c&aacute;c h&#7879; th&#7889;ng c&#361; h&#417;n th&#432;&#7901;ng kh&ocirc;ng kh&#7843; d&#7909;ng. V&#7853;y n&ecirc;n, m&#7895;i Autonomous System ph&#7843;i duy tr&igrave; th&ocirc;ng tin v&#7873; m&#7885;i tuy&#7871;n &#273;&#432;&#7901;ng m&#7899;i l&#7851;n c&#361;. &#272;i&#7873;u n&agrave;y &#273;&#432;&#7907;c th&#7921;c hi&#7879;n th&ocirc;ng qua c&aacute;c phi&ecirc;n peering. Trong c&aacute;c phi&ecirc;n peering, m&#7895;i AS thi&#7871;t l&#7853;p k&#7871;t n&#7889;i TCP\/IP v&#7899;i AS g&#7847;n &#273;&oacute; &#273;&#7875; trao &#273;&#7893;i d&#7919; li&#7879;u &#273;&#7883;nh tuy&#7871;n. Autonomous System s&#7917; d&#7909;ng th&ocirc;ng tin n&agrave;y &#273;&#7875; &#273;&#7883;nh tuy&#7871;n ch&iacute;nh x&aacute;c d&#7919; li&#7879;u g&#7917;i &#273;i.<\/p><p>T&ugrave;y thu&#7897;c v&agrave;o doanh nghi&#7879;p v&agrave; th&#7887;a thu&#7853;n peering, c&aacute;c h&#7879; th&#7889;ng t&#7921; tr&#7883; &#273;&ocirc;i khi t&iacute;nh ph&iacute; l&#7851;n nhau &#273;&#7875; chuy&#7875;n l&#432;u l&#432;&#7907;ng truy c&#7853;p qua m&#7841;ng c&#7911;a h&#7885;. Chi ph&iacute; truy c&#7853;p c&oacute; th&#7875; &#7843;nh h&#432;&#7903;ng &#273;&#7871;n quy&#7871;t &#273;&#7883;nh l&#7921;a ch&#7885;n tuy&#7871;n &#273;&#432;&#7901;ng cu&#7889;i c&ugrave;ng c&#7911;a BGP.<\/p><h4>Ai v&#7853;n h&agrave;nh h&#7879; th&#7889;ng t&#7921; tr&#7883;?<\/h4><p>C&aacute;c h&#7879; th&#7889;ng t&#7921; tr&#7883; AS th&#432;&#7901;ng thu&#7897;c v&#7873; c&aacute;c nh&agrave; cung c&#7845;p d&#7883;ch v&#7909; Internet (ISP) ho&#7863;c c&aacute;c t&#7893; ch&#7913;c l&#7899;n kh&aacute;c nh&#432; c&ocirc;ng ty c&ocirc;ng ngh&#7879;, tr&#432;&#7901;ng &#273;&#7841;i h&#7885;c, c&#417; quan ch&iacute;nh ph&#7911; v&agrave; c&#417; s&#7903; nghi&ecirc;n c&#7913;u. M&#7895;i AS ph&#7843;i c&oacute; m&#7897;t s&#7889; hi&#7879;u m&#7841;ng (ASN) &#273;&atilde; &#273;&#259;ng k&yacute; &#273;&#7875; trao &#273;&#7893;i th&ocirc;ng tin &#273;&#7883;nh tuy&#7871;n.<\/p><h4>S&#7889; hi&#7879;u m&#7841;ng BGP l&agrave; g&igrave;?<\/h4><p>M&#7895;i s&#7889; hi&#7879;u m&#7841;ng ASN ph&#7843;i &#273;&#432;&#7907;c chia s&#7867; cho t&#7845;t c&#7843; c&aacute;c m&#7841;ng IP &#273;&#432;&#7907;c li&ecirc;n k&#7871;t v&#7899;i m&#7897;t ISP ho&#7863;c t&#7893; ch&#7913;c chung. T&#7893; ch&#7913;c c&#7845;p ph&aacute;t s&#7889; hi&#7879;u Internet (IANA-Internet Assigned Numbers Authority) ch&#7881; &#273;&#7883;nh m&#7897;t ASN duy nh&#7845;t cho m&#7895;i c&ocirc;ng ty. IANA cung c&#7845;p ASN cho C&#417; quan &#273;&#259;ng k&yacute; Internet khu v&#7921;c (RIR), sau &#273;&oacute; c&#417; quan n&agrave;y s&#7869; ch&#7881; &#273;&#7883;nh ASN cho ISP v&agrave; m&#7841;ng. ASN l&agrave; c&aacute;c s&#7889; n&#7857;m trong kho&#7843;ng t&#7915; 1 &#273;&#7871;n 65534 &#7903; &#273;&#7883;nh d&#7841;ng 16 bit v&agrave; t&#7915; 131072 &#273;&#7871;n 4294967294 &#7903; &#273;&#7883;nh d&#7841;ng 32 bit.<\/p><p>C&oacute; hai lo&#7841;i s&#7889; hi&#7879;u m&#7841;ng BGP: ASN ri&ecirc;ng &amp; ASN c&ocirc;ng khai.<\/p><ul>\n<li>\n<p>S&#7889; hi&#7879;u m&#7841;ng ASN BGP ri&ecirc;ng &#273;&#432;&#7907;c s&#7917; d&#7909;ng n&#7897;i b&#7897;.<\/p>\n<\/li>\n<li>\n<p>S&#7889; hi&#7879;u m&#7841;ng ASN BGP c&ocirc;ng khai d&ugrave;ng &#273;&#7875; trao &#273;&#7893;i d&#7919; li&#7879;u tr&ecirc;n m&#7841;ng Internet to&agrave;n c&#7847;u.<\/p>\n<\/li>\n<\/ul><p>Thay v&igrave; s&#7917; d&#7909;ng c&aacute;c AS c&ocirc;ng khai (&#273;&#7875; l&#432;u tr&#7919; s&#7889; hi&#7879;u m&#7841;ng AS c&ocirc;ng khai) c&aacute;c AS ri&ecirc;ng &#273;&#432;&#7907;c s&#7917; d&#7909;ng &#273;&#7875; chia AS l&#7899;n th&agrave;nh nhi&#7873;u AS nh&#7887;. <\/p><h2>BGP ho&#7841;t &#273;&#7897;ng nh&#432; th&#7871; n&agrave;o?<\/h2><p><b>Giao th&#7913;c Border Gateway Protocol<\/b> l&agrave; c&#417; ch&#7871; &#273;&#7883;nh tuy&#7871;n l&#432;u l&#432;&#7907;ng truy c&#7853;p qua Internet. H&#7847;u h&#7871;t c&aacute;c nh&agrave; m&#7841;ng kh&ocirc;ng c&oacute; tuy&#7871;n &#273;&#432;&#7901;ng m&#7863;c &#273;&#7883;nh, m&agrave; ch&#7881; c&oacute; &#273;&#432;&#7901;ng &#273;i &#273;&#7871;n t&#7845;t c&#7843; c&aacute;c ti&#7873;n t&#7889; (prefix). BGP &#273;&aacute;nh gi&aacute; c&aacute;c &#273;&#432;&#7901;ng d&#7851;n &#273;&#7871;n m&#7897;t tuy&#7871;n &#273;&#432;&#7901;ng nh&#7845;t &#273;&#7883;nh v&agrave; ch&#7885;n &#273;&#432;&#7901;ng t&#7889;t nh&#7845;t gi&#7919;a c&aacute;c router nh&#7857;m x&aacute;c &#273;&#7883;nh &#273;&#432;&#7901;ng d&#7851;n t&#7899;i t&#7845;t c&#7843; c&aacute;c &#273;i&#7875;m &#273;&#7871;n.<\/p><p>Router kh&ocirc;ng th&#7875; ch&#7885;n m&#7841;ng t&#7889;i &#432;u &#273;&#7875; g&#7917;i d&#7919; li&#7879;u khi c&oacute; nhi&#7873;u m&#7841;ng li&ecirc;n k&#7871;t v&#7899;i n&oacute;. &#272;&#7875; truy&#7873;n l&#432;u l&#432;&#7907;ng &#273;&#7871;n router g&#7847;n &#273;&iacute;ch nh&#7845;t, BGP &#273;&aacute;nh gi&aacute; t&#7845;t c&#7843; c&aacute;c &#273;&#7889;i t&aacute;c peering c&#7911;a router th&ocirc;ng qua th&ocirc;ng tin &#273;&#7883;nh tuy&#7871;n c&#7911;a c&aacute;c &#273;&#7889;i t&aacute;c peering. Th&ocirc;ng tin &#273;&#7883;nh tuy&#7871;n &#273;&#432;&#7907;c l&#432;u gi&#7919; trong B&#7843;ng &#273;&#7883;nh tuy&#7871;n (RIB &ndash; Routing Information Base).<\/p><p>M&#7895;i router ho&#7863;c host l&#432;u tr&#7919; m&#7897;t b&#7843;ng RIB ch&#7913;a th&ocirc;ng tin v&#7873; kho&#7843;ng c&aacute;ch ho&#7863;c tuy&#7871;n &#273;&#432;&#7901;ng &#273;&#7871;n m&#7841;ng &#273;&iacute;ch &#273;&#7875; h&#7895; tr&#7907; ki&#7875;m so&aacute;t h&#432;&#7899;ng &#273;i c&#7911;a c&aacute;c g&oacute;i d&#7919; li&#7879;u. RIB s&#7917; d&#7909;ng d&#7919; li&#7879;u t&#7915; c&#7843; c&aacute;c &#273;&#7889;i t&aacute;c peering n&#7897;i b&#7897; l&#7851;n &#273;&#7889;i t&aacute;c b&ecirc;n ngo&agrave;i. C&aacute;c &#273;&#7889;i t&aacute;c peering n&agrave;y &#273;&#7873;u k&#7871;t n&#7889;i tr&#7921;c ti&#7871;p v&#7899;i nhau. RIB li&ecirc;n t&#7909;c c&#7853;p nh&#7853;t khi c&oacute; c&aacute;c thay &#273;&#7893;i d&#7921;a tr&ecirc;n c&aacute;c ch&iacute;nh s&aacute;ch v&#7873; tuy&#7871;n &#273;&#432;&#7901;ng &#273;&#432;&#7907;c s&#7917; d&#7909;ng v&agrave; th&ocirc;ng tin c&ocirc;ng b&#7889;.<\/p><figure id=\"attachment_24457\" aria-describedby=\"caption-attachment-24457\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"lazy size-full wp-image-24457\" src=\"data:image\/gif;base64,R0lGODlhAQABAAD\/ACwAAAAAAQABAAACADs=\" data-src=\"\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing.jpg\" alt=\"BGP chooses the most efficient path when routing\" width=\"800\" height=\"432\" srcset=\"https:\/\/www.iptp.us\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing.jpg 800w, https:\/\/www.iptp.us\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing-300x162.jpg 300w, https:\/\/www.iptp.us\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing-768x415.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-24457 lazy\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/ywAAAAAAQABAAACAUwAOw==\" alt=\"BGP chooses the most efficient path when routing\" width=\"800\" height=\"432\" srcset=\"https:\/\/www.iptp.us\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing.jpg 800w, https:\/\/www.iptp.us\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing-300x162.jpg 300w, https:\/\/www.iptp.us\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing-768x415.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" data-src=\"\/wp-content\/uploads\/bgp-chooses-the-most-efficient-path-when-routing.jpg\"><\/noscript><figcaption id=\"caption-attachment-24457\" class=\"wp-caption-text\">BGP ch&#7885;n &#273;&#432;&#7901;ng d&#7851;n t&#7889;i &#432;u nh&#7845;t trong v&ocirc; s&#7889; &#273;&#432;&#7901;ng d&#7851;n c&oacute; s&#7861;n.<\/figcaption><\/figure><p>H&igrave;nh minh h&#7885;a &#7903; tr&ecirc;n m&ocirc; t&#7843; c&aacute;ch BGP c&oacute; th&#7875; quy&#7871;t &#273;&#7883;nh tuy&#7871;n &#273;&#432;&#7901;ng t&#7889;t nh&#7845;t &#273;&#7875; ph&acirc;n b&#7889; l&#432;u l&#432;&#7907;ng. AS1 c&oacute; th&#7875; g&#7917;i g&oacute;i d&#7919; li&#7879;u &#273;&#7871;n AS6 qua 3 &#273;&#432;&#7901;ng d&#7851;n:<\/p><ul>\n<li>&#272;&#7883;nh tuy&#7871;n qua AS2 &#273;&#7875; &#273;&#7871;n AS6<\/li>\n<li>&#272;&#7883;nh tuy&#7871;n qua AS3 &#273;&#7875; &#273;&#7871;n AS6<\/li>\n<li>&#272;&#7883;nh tuy&#7871;n qua AS4, AS5 &#273;&#7875; &#273;&#7871;n AS6<\/li>\n<\/ul><p>S&#7921; l&#7921;a ch&#7885;n kh&aacute; r&otilde; r&agrave;ng trong v&iacute; d&#7909; n&agrave;y &ndash; &#273;&#7883;nh tuy&#7871;n qua AS3 l&agrave; tuy&#7871;n hi&#7879;u qu&#7843; nh&#7845;t, ch&#7881; c&#7847;n 2 hop thay v&igrave; 3 hop qua AS4. Tuy&#7871;n &#273;&#432;&#7901;ng n&agrave;y c&#361;ng kh&ocirc;ng ph&#7843;i th&ocirc;ng qua AS2 hi&#7879;n &#273;ang b&#7883; t&#7855;c ngh&#7869;n.<\/p><h2>BGP s&#7917; d&#7909;ng giao th&#7913;c &#273;&#7883;nh tuy&#7871;n n&agrave;o?<\/h2><p>M&#7909;c ti&ecirc;u c&#7911;a c&aacute;c giao th&#7913;c &#273;&#7883;nh tuy&#7871;n l&agrave; thi&#7871;t l&#7853;p c&aacute;c b&#7843;ng &#273;&#7883;nh tuy&#7871;n, t&igrave;m hi&#7875;u c&aacute;c tuy&#7871;n kh&#7843; d&#7909;ng v&agrave; &#273;&#432;a ra c&aacute;c quy&#7871;t &#273;&#7883;nh &#273;&#7883;nh tuy&#7871;n. So v&#7899;i c&aacute;c h&#7879; th&#7889;ng &#273;&#7883;nh tuy&#7871;n &#273;&#7897;ng (dynamic routing) kh&aacute;c, BGP s&#7917; d&#7909;ng TCP\/IP (hay c&ograve;n bi&#7871;t t&#7899;i l&agrave; TCP) &#273;&#7875; v&#7853;n chuy&#7875;n g&oacute;i d&#7919; li&#7879;u. BGP l&agrave; lo&#7841;i c&#7845;u tr&uacute;c li&ecirc;n k&#7871;t l&#432;&#7899;i (mesh topology) s&#7917; d&#7909;ng TCP &#273;&#7875; x&aacute;c &#273;&#7883;nh &#273;&#432;&#7901;ng d&#7851;n t&#7889;i &#432;u &#273;&#7875; giao ti&#7871;p gi&#7919;a c&aacute;c router.<\/p><p>OSPF v&agrave; BGP l&agrave; hai trong s&#7889; c&aacute;c giao th&#7913;c &#273;&#7883;nh tuy&#7871;n ph&#7893; bi&#7871;n nh&#7845;t. S&#7921; kh&aacute;c bi&#7879;t ch&iacute;nh gi&#7919;a OSPF v&agrave; BGP l&agrave; OSPF l&agrave; giao th&#7913;c &#273;&#7883;nh tuy&#7871;n n&#7897;i mi&#7873;n (intra-domain) trong khi BGP l&agrave; giao th&#7913;c &#273;&#7883;nh tuy&#7871;n li&ecirc;n mi&#7873;n (inter-domain). BGP &#273;&#7873; xu&#7845;t c&aacute;c &#273;&#432;&#7901;ng d&#7851;n t&#7915; b&ecirc;n trong m&#7897;t AS, v&#7899;i internal BGP, ho&#7863;c t&#7915; b&ecirc;n ngo&agrave;i AS, v&#7899;i external BGP.<\/p><h2>External BGP v&agrave; internal BGP l&agrave; g&igrave;?<\/h2><h3>&#272;&#7883;nh ngh&#297;a external BGP v&agrave; internal BGP<\/h3><p>C&oacute; hai lo&#7841;i BGP l&agrave; external BGP (eBGP) v&agrave; internal BGP (iBGP).<\/p><p>C&aacute;c thi&#7871;t b&#7883; ho&#7863;c m&#7841;ng l&acirc;n c&#7853;n trong c&ugrave;ng m&#7897;t AS c&oacute; th&#7875; s&#7917; d&#7909;ng <b>Internal BGP<\/b>  &#273;&#7875; &#273;&#7883;nh tuy&#7871;n qua c&aacute;c m&#7841;ng n&#7897;i b&#7897;. iBGP kh&ocirc;ng giao ti&#7871;p v&#7899;i c&aacute;c AS kh&aacute;c v&igrave; quy tr&igrave;nh ch&#7881; x&#7843;y ra gi&#7919;a hai &#273;&#7889;i t&aacute;c peering n&#7897;i b&#7897;. &#272;&#7875; li&ecirc;n k&#7871;t c&aacute;c router tr&ecirc;n m&#7841;ng n&#7897;i b&#7897;, c&aacute;c AS c&oacute; th&#7875; ch&#7885;n t&#7915; c&aacute;c giao th&#7913;c n&#7897;i b&#7897; kh&aacute;c.<\/p><p><b>External BGP<\/b> l&agrave; ph&#7847;n m&#7903; r&#7897;ng c&#7911;a BGP. eBGP &#273;&#432;&#7907;c s&#7917; d&#7909;ng &#273;&#7875; truy&#7873;n th&ocirc;ng tin trao &#273;&#7893;i gi&#7919;a c&aacute;c h&#7879; th&#7889;ng t&#7921; tr&#7883; ri&ecirc;ng bi&#7879;t. &#272;i&#7873;u n&agrave;y c&oacute; ngh&#297;a l&agrave; BGP y&ecirc;u c&#7847;u s&#7917; d&#7909;ng c&aacute;c router bi&ecirc;n (edge) &#273;&#7875; hai AS giao ti&#7871;p. S&#7917; d&#7909;ng eBGP KH&Ocirc;NG y&ecirc;u c&#7847;u c&#7847;n s&#7917; d&#7909;ng iBGP.<\/p><figure id=\"attachment_24460\" aria-describedby=\"caption-attachment-24460\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"lazy size-full wp-image-24460\" src=\"data:image\/gif;base64,R0lGODlhAQABAAD\/ACwAAAAAAQABAAACADs=\" data-src=\"\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp.jpg\" alt=\"eBGP and iBGP are terms used with the routing protocol BGP\" width=\"800\" height=\"635\" srcset=\"https:\/\/www.iptp.us\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp.jpg 800w, https:\/\/www.iptp.us\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp-300x238.jpg 300w, https:\/\/www.iptp.us\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp-768x610.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-24460 lazy\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/ywAAAAAAQABAAACAUwAOw==\" alt=\"eBGP and iBGP are terms used with the routing protocol BGP\" width=\"800\" height=\"635\" srcset=\"https:\/\/www.iptp.us\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp.jpg 800w, https:\/\/www.iptp.us\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp-300x238.jpg 300w, https:\/\/www.iptp.us\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp-768x610.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" data-src=\"\/wp-content\/uploads\/ebgp-ibgp-are-terms-used-with-routing-protocol-bgp.jpg\"><\/noscript><figcaption id=\"caption-attachment-24460\" class=\"wp-caption-text\">iBGP ch&#7841;y gi&#7919;a c&aacute;c b&#7897; &#273;&#7883;nh tuy&#7871;n trong c&ugrave;ng m&#7897;t AS &amp; eBGP ho&#7841;t &#273;&#7897;ng gi&#7919;a c&aacute;c b&#7897; &#273;&#7883;nh tuy&#7871;n trong c&aacute;c AS kh&aacute;c nhau.<\/figcaption><\/figure><h3>Gi&#7843;i th&iacute;ch v&#7873; eBGP v&agrave; iBGP<\/h3><p>&#272;i&#7875;m kh&aacute;c nhau gi&#7919;a iBGP v&agrave; eBGP c&oacute; th&#7875; so s&aacute;nh nh&#432; s&#7921; kh&aacute;c bi&#7879;t gi&#7919;a g&#7917;i th&#432; trong n&#432;&#7899;c v&agrave; g&#7917;i th&#432; qu&#7889;c t&#7871;. External BGP t&#432;&#417;ng t&#7921; nh&#432; g&#7917;i th&#432; qu&#7889;c t&#7871;. Khi g&#7917;i th&#432; ra n&#432;&#7899;c ngo&agrave;i, c&oacute; m&#7897;t s&#7889; quy &#273;&#7883;nh ph&#7843;i tu&acirc;n theo.<\/p><p>Th&#432; trong n&#432;&#7899;c ch&#7881; di chuy&#7875;n m&#7897;t kho&#7843;ng c&aacute;ch ng&#7855;n &#273;&#7871;n m&#7897;t &#273;&#7883;a ch&#7881; trong c&ugrave;ng qu&#7889;c gia v&agrave; kh&ocirc;ng b&#7883; chuy&#7875;n t&#7899;i b&#432;u &#273;i&#7879;n ph&acirc;n lo&#7841;i khu v&#7921;c hay qu&#7889;c gia kh&aacute;c. <\/p><p>M&#7885;i lo&#7841;i th&#432; n&agrave;o mu&#7889;n &#273;&#7871;n &#273;&iacute;ch cu&#7889;i, &#273;&#7873;u ph&#7843;i tr&#432;&#7899;c ti&ecirc;n &#273;&#432;&#7907;c g&#7917;i t&#7899;i qu&#7889;c gia c&#7847;n &#273;&#7871;n. Sau &#273;&oacute;, th&#432; m&#7899;i ti&#7871;p tuc &#273;&#432;&#7907;c d&#7883;ch v&#7909; chuy&#7875;n ph&aacute;t th&#432; &#273;&#7883;a ph&#432;&#417;ng &#273;&#432;a &#273;&#7871;n &#273;&#7883;a ch&#7881; cu&#7889;i. T&#432;&#417;ng t&#7921; nh&#432; c&aacute;ch m&#7885;i qu&#7889;c gia c&oacute; h&#7879; th&#7889;ng b&#432;u ch&iacute;nh n&#7897;i b&#7897; c&#7911;a ri&ecirc;ng m&igrave;nh, c&aacute;c h&#7879; th&#7889;ng t&#7921; tr&#7883; c&#361;ng c&oacute; c&aacute;c giao th&#7913;c &#273;&#7883;nh tuy&#7871;n n&#7897;i b&#7897; ri&ecirc;ng.<\/p><p>&#272;&#7875; &#273;&#7883;nh tuy&#7871;n hi&#7879;u qu&#7843;, internal BGP lu&ocirc;n &#273;&#432;&#7907;c &#432;u ti&ecirc;n s&#7917; d&#7909;ng v&igrave; iBGP &iacute;t x&#7843;y ra routing loop h&#417;n external BGP.<\/p><h2>&#272;i&#7875;m y&#7871;u c&#7911;a BGP &amp; C&aacute;ch gi&#7843;i quy&#7871;t<\/h2><p>M&#7897;t v&#7845;n &#273;&#7873; ph&#7893; bi&#7871;n v&#7899;i BGP l&agrave; l&#7895;i trao &#273;&#7893;i th&ocirc;ng tin. BGP l&agrave; c&#417; ch&#7871; chia s&#7867; tuy&#7871;n &#273;&#432;&#7901;ng ph&#7909; thu&#7897;c v&agrave;o &#273;&#7897; tin c&#7853;y. C&aacute;c s&#7921; c&#7889; v&#7851;n c&oacute; th&#7875; x&#7843;y ra do c&aacute;c AS ho&agrave;n to&agrave;n tin t&#432;&#7903;ng v&agrave;o c&aacute;c tuy&#7871;n &#273;&#432;&#7901;ng &#273;&#432;&#7907;c chia s&#7867;. C&aacute;c &#273;&#7889;i t&aacute;c peering c&oacute; th&#7875; v&ocirc; t&igrave;nh ho&#7863;c c&#7889; &yacute; khai b&aacute;o th&ocirc;ng tin tuy&#7871;n &#273;&#432;&#7901;ng kh&ocirc;ng ch&iacute;nh x&aacute;c, d&#7851;n t&#7899;i l&#432;u l&#432;&#7907;ng truy c&#7853;p b&#7883; chuy&#7875;n h&#432;&#7899;ng v&agrave; c&oacute; k&#7871;t qu&#7843; kh&ocirc;ng mong mu&#7889;n.<\/p><p>Trao &#273;&#7893;i d&#7919; li&#7879;u kh&ocirc;ng ph&#7843;i l&uacute;c n&agrave;o c&#361;ng th&agrave;nh c&ocirc;ng v&igrave; d&#7919; li&#7879;u c&oacute; th&#7875; b&#7883; &#273;&#7883;nh d&#7841;ng kh&ocirc;ng &#273;&uacute;ng ho&#7863;c ch&#7913;a th&ocirc;ng tin sai. Router c&#361;ng c&oacute; th&#7875; g&#7863;p s&#7921; c&#7889; v&#7873; b&#7897; nh&#7899;, l&#432;u tr&#7919;, ho&#7863;c ph&#7843;n h&#7891;i ch&#7853;m v&#7899;i c&aacute;c th&ocirc;ng tin c&#7853;p nh&#7853;t m&#7899;i. B&#7845;t c&#7913; khi n&agrave;o x&#7843;y ra c&aacute;c l&#7895;i nh&#432; timeout, request sai &#273;&#7883;nh d&#7841;ng, hay s&#7921; c&#7889; khi x&#7917; l&yacute;, router c&#7847;n g&#7917;i m&atilde; l&#7895;i (error code) v&agrave; m&atilde; ph&#7909; (subcode) &#273;&#7875; truy&#7873;n &#273;&#7841;t c&aacute;c v&#7845;n &#273;&#7873; n&agrave;y.<\/p><h3>S&#7921; c&#7889; BGP<\/h3><p>C&aacute;c s&#7921; c&#7889; BGP ph&#7893; bi&#7871;n nh&#7845;t l&agrave; &#273;&#7883;nh d&#7841;ng sai, BGP hijack, v&agrave; prefix leak.<\/p><figure id=\"attachment_24461\" aria-describedby=\"caption-attachment-24461\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" loading=\"lazy\" class=\"lazy size-full wp-image-24461\" src=\"data:image\/gif;base64,R0lGODlhAQABAAD\/ACwAAAAAAQABAAACADs=\" data-src=\"\/wp-content\/uploads\/what-is-a-bgp-route-hijack.jpg\" alt=\"What is a BGP route hijack?\" width=\"800\" height=\"432\" srcset=\"https:\/\/www.iptp.us\/wp-content\/uploads\/what-is-a-bgp-route-hijack.jpg 800w, https:\/\/www.iptp.us\/wp-content\/uploads\/what-is-a-bgp-route-hijack-300x162.jpg 300w, https:\/\/www.iptp.us\/wp-content\/uploads\/what-is-a-bgp-route-hijack-768x415.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\"><noscript><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-24461 lazy\" src=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/ywAAAAAAQABAAACAUwAOw==\" alt=\"What is a BGP route hijack?\" width=\"800\" height=\"432\" srcset=\"https:\/\/www.iptp.us\/wp-content\/uploads\/what-is-a-bgp-route-hijack.jpg 800w, https:\/\/www.iptp.us\/wp-content\/uploads\/what-is-a-bgp-route-hijack-300x162.jpg 300w, https:\/\/www.iptp.us\/wp-content\/uploads\/what-is-a-bgp-route-hijack-768x415.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" data-src=\"\/wp-content\/uploads\/what-is-a-bgp-route-hijack.jpg\"><\/noscript><figcaption id=\"caption-attachment-24461\" class=\"wp-caption-text\">BGP hijack l&agrave; khi m&#7897;t AS &ldquo;th&ugrave; &#273;&#7883;ch&rdquo; qu&#7843;ng b&aacute; prefix c&#7911;a ng&#432;&#7901;i kh&aacute;c.<\/figcaption><\/figure><p>M&#7897;t s&#7889; s&#7921; c&#7889; BGP di&#7877;n ra g&#7847;n &#273;&acirc;y l&agrave;:<\/p><ul>\n<li>\n<p>AS12389 (Rostelecom) &#273;&atilde; hijack prefix c&#7911;a c&aacute;c m&#7841;ng Cloud l&#7899;n, bao g&#7891;m c&#7843; Akamai, Amazon AWS, Cloudflare, Digital Ocean v&agrave; Hetzner, v&agrave;o th&aacute;ng 4\/2020.<\/p>\n<\/li>\n<li>\n<p>H&#417;n 13046 prefix &#273;&atilde; b&#7883; l&#7897; b&#7903;i AS264462 trong m&#7897;t s&#7921; c&#7889; m&#7841;ng k&eacute;o d&agrave;i h&#417;n m&#7897;t gi&#7901; &#273;&#7891;ng h&#7891; v&agrave;o th&aacute;ng 7\/2020.<\/p>\n<\/li>\n<li>\n<p>AS1221 (Telstra) &#273;&atilde; c&ocirc;ng b&#7889; g&#7847;n 500 prefix trong m&#7897;t s&#7921; ki&#7879;n hijack BGP v&agrave;o th&aacute;ng 9\/2020. S&#7921; ki&#7879;n n&agrave;y &#273;&atilde; &#7843;nh h&#432;&#7903;ng &#273;&#7871;n h&#417;n 266 ASN &#7903; 50 qu&#7889;c gia kh&aacute;c nhau.<\/p>\n<\/li>\n<li>\n<p>H&#417;n 30.000 prefix &#273;&atilde; b&#7883; t&#7845;n c&ocirc;ng th&ocirc;ng qua AS55410 (Vodafone) v&agrave;o th&aacute;ng 4\/2021, khi&#7871;n l&#432;u l&#432;&#7907;ng truy c&#7853;p v&agrave;o t&#259;ng g&#7845;p 13 l&#7847;n. Ph&#7847;n l&#7899;n c&aacute;c prefix, bao g&#7891;m Google, Microsoft, Akamai v&agrave; Cloudflare, &#273;&#7871;n t&#7915; Hoa K&#7923;.<\/p>\n<\/li>\n<li>\n<p>BGP prefix c&#7911;a m&#7897;t n&#7873;n t&#7843;ng ti&#7873;n &#273;i&#7879;n t&#7917; c&#7911;a H&agrave;n Qu&#7889;c &#273;&atilde; b&#7883; chi&#7871;m &#273;o&#7841;t v&agrave; &#273;&aacute;nh c&#7855;p s&#7889; ti&#7873;n &#273;i&#7879;n t&#7917; tr&#7883; gi&aacute; 1,9 tri&#7879;u &#273;&ocirc; v&agrave;o th&aacute;ng 2\/2022.<\/p>\n<\/li>\n<\/ul><h3>Gi&#7843;i ph&aacute;p cho c&aacute;c m&#7889;i &#273;e d&#7885;a t&#7899;i BGP<\/h3><p>M&#7897;t s&#7889; gi&#7843;i ph&aacute;p nh&#432; K&yacute; s&#7889; t&agrave;i nguy&ecirc;n Internet (RPKI &ndash; Resource Public Key Infrastructure) &#273;&atilde; &#273;&#432;&#7907;c t&#7841;o d&#7921;ng nh&#7857;m thi&#7871;t l&#7853;p n&ecirc;n giao th&#7913;c BGP an to&agrave;n h&#417;n. Song, vi&#7879;c tri&#7875;n khai ho&agrave;n to&agrave;n RPKI kh&ocirc;ng &#273;&#417;n gi&#7843;n v&igrave; vi&#7879;c n&agrave;y y&ecirc;u c&#7847;u m&#7885;i AS tr&ecirc;n to&agrave;n c&#7847;u ph&#7843;i &#273;&#7891;ng th&#7901;i &aacute;p d&#7909;ng giao th&#7913;c m&#7899;i. B&#7843;o v&#7879; v&agrave; gi&#7919; g&igrave;n &#273;&#432;&#7901;ng truy&#7873;n Internet an to&agrave;n l&agrave; c&ocirc;ng vi&#7879;c kh&oacute; kh&#259;n v&agrave; c&#7847;n c&oacute; cam k&#7871;t m&#7841;nh m&#7869; t&#7915; t&#7845;t c&#7843; c&aacute;c nh&agrave; m&#7841;ng tr&ecirc;n to&agrave;n th&#7871; gi&#7899;i. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8230;<\/p>\n","protected":false},"author":25,"featured_media":29297,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[45],"tags":[],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/posts\/24459"}],"collection":[{"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/comments?post=24459"}],"version-history":[{"count":20,"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/posts\/24459\/revisions"}],"predecessor-version":[{"id":35157,"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/posts\/24459\/revisions\/35157"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/media\/29297"}],"wp:attachment":[{"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/media?parent=24459"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/categories?post=24459"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iptp.us\/vi\/wp-json\/wp\/v2\/tags?post=24459"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}