{"id":13972,"date":"2024-12-24T15:14:26","date_gmt":"2024-12-24T07:14:26","guid":{"rendered":"https:\/\/blog.pfchina.org\/?p=13972"},"modified":"2024-12-24T15:51:22","modified_gmt":"2024-12-24T07:51:22","slug":"pfsense-%e9%85%8d%e7%bd%aeospf","status":"publish","type":"post","link":"https:\/\/blog.pfchina.org\/?p=13972","title":{"rendered":"pfSense\u914d\u7f6eOSPF\u8def\u7531\u534f\u8bae"},"content":{"rendered":"<h2 style=\"text-align: justify;\">\u6982\u8ff0<\/h2>\n<div style=\"text-align: justify;\" data-tag=\"paragraph\" data-uuid=\"gnx8bolyhb\" data-idx=\"0-1\">OSPF\uff08Open Shortest Path First\uff09\u662f\u5e7f\u6cdb\u4f7f\u7528\u7684\u4e00\u79cd\u52a8\u6001\u8def\u7531\u534f\u8bae\uff0c\u5b83\u5c5e\u4e8e\u94fe\u8def\u72b6\u6001\u8def\u7531\u534f\u8bae\uff0c\u5177\u6709\u8def\u7531\u53d8\u5316\u6536\u655b\u901f\u5ea6\u5feb\u3001\u65e0\u8def\u7531\u73af\u8def\u3001\u652f\u6301\u53d8\u957f\u5b50\u7f51\u63a9\u7801\uff08VLSM\uff09\u548c\u6c47\u603b\u3001\u5c42\u6b21\u533a\u57df\u5212\u5206\u7b49\u4f18\u70b9\u3002\u5728\u7f51\u7edc\u4e2d\u4f7f\u7528OSPF\u534f\u8bae\u540e\uff0c\u5927\u90e8\u5206\u8def\u7531\u5c06\u7531OSPF\u534f\u8bae\u81ea\u884c\u8ba1\u7b97\u548c\u751f\u6210\uff0c\u65e0\u987b\u7f51\u7edc\u7ba1\u7406\u5458\u4eba\u5de5\u914d\u7f6e\uff0c\u5f53\u7f51\u7edc\u62d3\u6251\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u534f\u8bae\u53ef\u4ee5\u81ea\u52a8\u8ba1\u7b97\u3001\u66f4\u6b63\u8def\u7531\uff0c\u6781\u5927\u5730\u65b9\u4fbf\u4e86\u7f51\u7edc\u7ba1\u7406\u3002OSPF\u534f\u8bae\u662f\u4e00\u79cd\u94fe\u8def\u72b6\u6001\u534f\u8bae\u3002\u6bcf\u4e2a\u8def\u7531\u5668\u8d1f\u8d23\u53d1\u73b0\u3001\u7ef4\u62a4\u4e0e\u90bb\u5c45\u7684\u5173\u7cfb\uff0c\u5e76\u5c06\u5df2\u77e5\u7684\u90bb\u5c45\u5217\u8868\u548c\u94fe\u8def\u8d39\u7528LSU(Link State Update)\u62a5\u6587\u63cf\u8ff0\uff0c\u901a\u8fc7\u53ef\u9760\u7684\u6cdb\u6d2a\u4e0e\u81ea\u6cbb\u7cfb\u7edfAS(Autonomous System)\u5185\u7684\u5176\u4ed6\u8def\u7531\u5668\u5468\u671f\u6027\u4ea4\u4e92\uff0c\u5b66\u4e60\u5230\u6574\u4e2a\u81ea\u6cbb\u7cfb\u7edf\u7684\u7f51\u7edc\u62d3\u6251\u7ed3\u6784\uff1b\u5e76\u901a\u8fc7\u81ea\u6cbb\u7cfb\u7edf\u8fb9\u754c\u7684\u8def\u7531\u5668\u6ce8\u5165\u5176\u4ed6AS\u7684\u8def\u7531\u4fe1\u606f\uff0c\u4ece\u800c\u5f97\u5230\u6574\u4e2aInternet\u7684\u8def\u7531\u4fe1\u606f\u3002\u6bcf\u9694\u4e00\u4e2a\u7279\u5b9a\u65f6\u95f4\u6216\u5f53\u94fe\u8def\u72b6\u6001\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u91cd\u65b0\u751f\u6210LSA\uff0c\u8def\u7531\u5668\u901a\u8fc7\u6cdb\u6d2a\u673a\u5236\u5c06\u65b0LSA\u901a\u544a\u51fa\u53bb\uff0c\u4ee5\u4fbf\u5b9e\u73b0\u8def\u7531\u7684\u5b9e\u65f6\u66f4\u65b0\u3002<\/div>\n<div data-tag=\"paragraph\" data-uuid=\"gnx8bolyhb\" data-idx=\"0-1\"><\/div>\n<div data-tag=\"paragraph\" data-uuid=\"gnx8bolyhb\" data-idx=\"0-1\">\n<h3 class=\"para_jzmEb content_BNj1q MARK_MODULE\" data-tag=\"paragraph\" data-uuid=\"gnx8c8vad0\" data-idx=\"1-4\"><span style=\"text-align: justify;\">\u6838\u5fc3\u539f\u7406<\/span><\/h3>\n<\/div>\n<ol style=\"text-align: justify;\">\n<li><strong>\u94fe\u8def\u72b6\u6001\u6570\u636e\u5e93\uff08LSDB\uff09<\/strong>\uff1a\n<ul>\n<li>\u6bcf\u4e2a\u8def\u7531\u5668\u901a\u8fc7\u53d1\u9001LSA\uff08Link State Advertisement\uff09\u6784\u5efa\u672c\u5730\u7684LSDB\u3002<\/li>\n<li>LSDB\u53cd\u6620\u4e86\u7f51\u7edc\u7684\u62d3\u6251\u7ed3\u6784\uff0c\u662f\u6240\u6709\u8def\u7531\u5668\u5171\u4eab\u7684\u5168\u5c40\u89c6\u56fe\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u533a\u57df\uff08Area\uff09<\/strong>\uff1a\n<ul>\n<li>\u533a\u57df\u662f\u903b\u8f91\u5212\u5206\u7684\u5b50\u7f51\u7edc\uff0c\u53ef\u4ee5\u51cf\u5c11LSDB\u7684\u89c4\u6a21\u3002<\/li>\n<li>\u4e3b\u533a\u57df\u4e3aArea 0\uff08\u9aa8\u5e72\u533a\u57df\uff09\uff0c\u5176\u4ed6\u533a\u57df\u9700\u8981\u901a\u8fc7\u9aa8\u5e72\u533a\u57df\u8fdb\u884c\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u8def\u7531\u5668\u7c7b\u578b<\/strong>\uff1a\n<ul>\n<li><strong>\u5185\u90e8\u8def\u7531\u5668\uff08IR\uff09\uff1a<\/strong> \u5b8c\u5168\u4f4d\u4e8e\u4e00\u4e2a\u533a\u57df\u5185\u7684\u8def\u7531\u5668\u3002<\/li>\n<li><strong>\u9aa8\u5e72\u8def\u7531\u5668\uff08BR\uff09\uff1a<\/strong> \u4f4d\u4e8eArea 0\u5185\u7684\u8def\u7531\u5668\u3002<\/li>\n<li><strong>\u533a\u57df\u8fb9\u754c\u8def\u7531\u5668\uff08ABR\uff09\uff1a<\/strong> \u8fde\u63a5\u4e24\u4e2a\u6216\u591a\u4e2a\u533a\u57df\u7684\u8def\u7531\u5668\u3002<\/li>\n<li><strong>\u81ea\u6cbb\u7cfb\u7edf\u8fb9\u754c\u8def\u7531\u5668\uff08ASBR\uff09\uff1a<\/strong> \u8fde\u63a5\u5916\u90e8\u81ea\u6cbb\u7cfb\u7edf\u7684\u8def\u7531\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5de5\u4f5c\u6d41\u7a0b<\/strong>\uff1a\n<ul>\n<li><strong>\u90bb\u5c45\u5efa\u7acb\uff1a<\/strong> \u8def\u7531\u5668\u901a\u8fc7Hello\u62a5\u6587\u53d1\u73b0\u90bb\u5c45\uff0c\u5efa\u7acb\u90bb\u5c45\u5173\u7cfb\u3002<\/li>\n<li><strong>\u94fe\u8def\u72b6\u6001\u4f20\u64ad\uff1a<\/strong> \u8def\u7531\u5668\u901a\u8fc7LSA\u5411\u90bb\u5c45\u901a\u544a\u94fe\u8def\u72b6\u6001\u3002<\/li>\n<li><strong>SPF\u8ba1\u7b97\uff1a<\/strong> \u6bcf\u4e2a\u8def\u7531\u5668\u4f7f\u7528Dijkstra\u7b97\u6cd5\u8ba1\u7b97\u6700\u77ed\u8def\u5f84\u6811\uff0c\u751f\u6210\u8def\u7531\u8868\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u6536\u655b\u6027<\/strong>\uff1a\n<ul>\n<li>OSPF\u5177\u6709\u5feb\u901f\u6536\u655b\u7684\u7279\u6027\uff0c\u5f53\u7f51\u7edc\u62d3\u6251\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u8def\u7531\u5668\u53ea\u9700\u8981\u66f4\u65b0\u53d8\u5316\u7684\u90e8\u5206\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2 style=\"text-align: justify;\">\u914d\u7f6eOSPF<\/h2>\n<p style=\"text-align: justify;\">pfSense\u652f\u6301OSPF\u529f\u80fd\uff0c\u901a\u8fc7\u5b89\u88c5\u5e76\u914d\u7f6eFRR\uff08Free Range Routing\uff09\u670d\u52a1\u6765\u5b9e\u73b0\u3002<\/p>\n<h4 style=\"text-align: justify;\">\u914d\u7f6e\u6b65\u9aa4<\/h4>\n<ol style=\"text-align: justify;\">\n<li><strong>\u5b89\u88c5FRR\u670d\u52a1<\/strong>\uff1a\n<ul>\n<li>\u767b\u5f55pfSense Web\u3002<\/li>\n<li>\u4f9d\u6b21\u8fdb\u5165\uff1a<code>\u7cfb\u7edf&gt;\u63d2\u4ef6\u7ba1\u7406&gt;\u53ef\u7528\u63d2\u4ef6<\/code>\u3002<\/li>\n<li>\u641c\u7d22\u5e76\u5b89\u88c5<code>FRR<\/code>\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u542f\u7528OSPF\u670d\u52a1<\/strong>\uff1a\n<ul>\n<li>\u8fdb\u5165<code>\u670d\u52a1&gt; FRR OSPF<\/code>\u3002<\/li>\n<li>\u52fe\u9009<code>Enable OSPF<\/code>\uff0c\u5e76\u586b\u5199\u5168\u5c40\u914d\u7f6e\uff1a\n<ul>\n<li><strong>Router ID<\/strong>\uff1a\u4f8b\u5982\uff0c<code>192.168.1.1<\/code>\uff08\u5efa\u8bae\u4f7f\u7528\u552f\u4e00\u7684\u5730\u5740\uff09\u3002<\/li>\n<li><strong>Redistribute<\/strong>\uff1a\u6839\u636e\u9700\u6c42\u9009\u62e9\u8981\u5206\u53d1\u7684\u8def\u7531\u7c7b\u578b\uff08\u4f8b\u5982\uff1aConnected\u3001Static\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u914d\u7f6e\u63a5\u53e3<\/strong>\uff1a\n<ul>\n<li>\u5728<code>Interface<\/code>\u6807\u7b7e\u9875\u4e2d\uff0c\u6dfb\u52a0\u9700\u8981\u8fd0\u884cOSPF\u7684\u7f51\u7edc\u63a5\u53e3\u3002<\/li>\n<li>\u4e3a\u63a5\u53e3\u8bbe\u7f6e\u533a\u57df\uff08\u5982Area 0\uff09\u548c\u7f51\u7edc\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u914d\u7f6e\u533a\u57df\u548c\u7f51\u7edc<\/strong>\uff1a\n<ul>\n<li>\u5728<code>Areas<\/code>\u6807\u7b7e\u9875\u4e2d\uff0c\u5b9a\u4e49\u533a\u57df\u7684ID\u548c\u7c7b\u578b\uff08\u5982\u6807\u51c6\u6216NSSA\u533a\u57df\uff09\u3002<\/li>\n<li>\u5728<code>Networks<\/code>\u6807\u7b7e\u9875\u4e2d\uff0c\u6307\u5b9a\u5c5e\u4e8e\u8be5\u533a\u57df\u7684\u5b50\u7f51\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u9ad8\u7ea7\u914d\u7f6e<\/strong>\uff08\u53ef\u9009\uff09\uff1a\n<ul>\n<li>\u914d\u7f6e\u90bb\u5c45\u5173\u7cfb\uff1a\u5982\u679c\u4f7f\u7528\u975e\u5e7f\u64ad\u7f51\u7edc\uff08\u5982NBMA\uff09\uff0c\u9700\u8981\u624b\u52a8\u5b9a\u4e49\u90bb\u5c45\u3002<\/li>\n<li>\u914d\u7f6eLSDB\u9650\u5236\uff1a\u8bbe\u7f6e\u6700\u5927\u94fe\u8def\u72b6\u6001\u6761\u76ee\u6570\u91cf\uff0c\u9632\u6b62\u6570\u636e\u5e93\u8fc7\u8f7d\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u9a8c\u8bc1\u914d\u7f6e<\/strong>\uff1a\n<ul>\n<li>\u5728CLI\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9a8c\u8bc1OSPF\u8fd0\u884c\u72b6\u6001\uff1a\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none\">\n<pre class=\"code\">bash\r\nvtysh\r\nshow ip ospf neighbor\r\nshow ip ospf database<\/pre>\n<\/div>\n<\/div>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u6d4b\u8bd5\u7f51\u7edc\u8fde\u901a\u6027<\/strong>\uff1a\n<ul>\n<li>\u786e\u4fddOSPF\u90bb\u5c45\u72b6\u6001\u4e3a<code>Full<\/code>\uff0c\u5e76\u68c0\u67e5\u8def\u7531\u8868\u662f\u5426\u6b63\u786e\u5b66\u4e60\u5230\u4e86OSPF\u8def\u7531\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2 style=\"text-align: justify;\">\u6ce8\u610f\u4e8b\u9879<\/h2>\n<ol style=\"text-align: justify;\">\n<li><strong>Router ID\u552f\u4e00\u6027<\/strong>\uff1a\n<ul>\n<li>\u6bcf\u53f0\u8fd0\u884cOSPF\u7684\u8bbe\u5907\u5fc5\u987b\u6709\u552f\u4e00\u7684Router ID\uff0c\u901a\u5e38\u9009\u62e9\u672a\u88ab\u5360\u7528\u7684IP\u5730\u5740\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u533a\u57df\u89c4\u5212<\/strong>\uff1a\n<ul>\n<li>\u5c0f\u578b\u7f51\u7edc\u53ef\u4f7f\u7528\u5355\u4e00Area 0\uff1b\u5927\u578b\u7f51\u7edc\u5e94\u5408\u7406\u5212\u5206\u533a\u57df\u4ee5\u51cf\u5c11LSDB\u89c4\u6a21\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u7f51\u7edc\u7c7b\u578b<\/strong>\uff1a\n<ul>\n<li>\u786e\u4fdd\u63a5\u53e3\u7684\u7f51\u7edc\u7c7b\u578b\uff08\u5982Broadcast\u6216Point-to-Point\uff09\u4e0e\u5b9e\u9645\u7f51\u7edc\u4e00\u81f4\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u8c03\u8bd5\u5de5\u5177<\/strong>\uff1a\n<ul>\n<li>\u4f7f\u7528<code>show<\/code>\u547d\u4ee4\u6392\u67e5\u90bb\u5c45\u5efa\u7acb\u3001LSA\u4f20\u64ad\u548cSPF\u8ba1\u7b97\u4e2d\u7684\u95ee\u9898\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u5c31\u53ef\u4ee5\u5728pfSense\u4e0a\u9ad8\u6548\u90e8\u7f72\u548c\u7ba1\u7406OSPF\uff0c\u5b9e\u73b0\u52a8\u6001\u8def\u7531\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8ff0 OSPF\uff08Open Shortest Path First\uff09\u662f\u5e7f\u6cdb\u4f7f\u7528\u7684\u4e00 &hellip; <a href=\"https:\/\/blog.pfchina.org\/?p=13972\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[463],"class_list":["post-13972","post","type-post","status-publish","format-standard","hentry","category-pfsense","tag-ospf"],"_links":{"self":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/13972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13972"}],"version-history":[{"count":9,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/13972\/revisions"}],"predecessor-version":[{"id":13981,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=\/wp\/v2\/posts\/13972\/revisions\/13981"}],"wp:attachment":[{"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.pfchina.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}