{"id":174917,"date":"2020-04-01T08:48:37","date_gmt":"2020-04-01T00:48:37","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=174917"},"modified":"2020-03-24T11:39:03","modified_gmt":"2020-03-24T03:39:03","slug":"dynamic-routing-configuration","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/dynamic-routing-configuration.html","title":{"rendered":"\u8def\u7531\u5668 OSPF \u52a8\u6001\u8def\u7531\u914d\u7f6e"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u672c\u6587\u6863\u8be6\u7ec6\u4ecb\u7ecd\u8def\u7531\u5668 OSPF \u52a8\u6001\u8def\u7531\u914d\u7f6e\u7684\u65b9\u6cd5<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5b9e\u9a8c\u76ee\u7684<\/strong><\/div>\n

\u638c\u63e1 OSPF \u534f\u8bae\u7684\u914d\u7f6e\u65b9\u6cd5
\n\u638c\u63e1\u67e5\u770b\u901a\u8fc7\u52a8\u6001\u8def\u7531\u534f\u8bae OSPF \u5b66\u4e60\u4ea7\u751f\u7684\u8def\u7531
\n\u719f\u6089\u5e7f\u57df\u7f51\u7ebf\u7f06\u7684\u94fe\u63a5\u65b9\u5f0f<\/p>\n

\u5b9e\u9a8c\u80cc\u666f<\/strong><\/div>\n

\u5047\u8bbe\u6821\u56ed\u7f51\u901a\u8fc7\u4e00\u53f0\u4e09\u5c42\u4ea4\u6362\u673a\u8fde\u5230\u6821\u56ed\u7f51\u51fa\u53e3\u8def\u7531\u5668\u4e0a\uff0c\u8def\u7531\u5668\u518d\u548c\u6821\u56ed\u5916\u7684\u53e6\u4e00\u53f0\u8def\u7531\u5668\u8fde\u63a5\u3002\u73b0\u8981\u505a\u9002\u5f53\u914d\u7f6e\uff0c\u5b9e\u73b0\u6821\u56ed\u7f51\u5185\u90e8\u4e3b\u673a\u4e0e\u6821\u56ed\u7f51\u5916\u90e8\u4e3b\u673a\u4e4b\u95f4\u7684\u76f8\u4e92\u901a\u4fe1\u3002\u4e3a\u4e86\u7b80\u5316\u7f51\u7ba1\u7684\u7ba1\u7406\u7ef4\u62a4\u5de5\u4f5c\uff0c\u5b66\u6821\u51b3\u5b9a\u91c7\u7528 OSPF \u534f\u8bae\u5b9e\u73b0\u4e92\u901a\u3002<\/p>\n

\u6280\u672f\u539f\u7406<\/strong><\/div>\n

OSPF(Open Shortest Path First) \u5f00\u653e\u5f0f\u6700\u77ed\u8def\u5f84\u4f18\u5148\u534f\u8bae\uff0c\u662f\u76ee\u524d\u7f51\u8def\u4e2d\u5e94\u7528\u6700\u5e7f\u6cdb\u7684\u8def\u7531\u534f\u8bae\u4e4b\u4e00\u3002\u5c5e\u4e8e\u5185\u90e8\u7f51\u5173\u8def\u7531\u534f\u8bae\uff0c\u80fd\u591f\u9002\u5e94\u5404\u79cd\u89c4\u6a21\u7684\u7f51\u7edc\u73af\u5883\uff0c\u662f\u5178\u578b\u7684\u94fe\u8def\u72b6\u6001\u534f\u8bae\u3002OSPF\u8def\u7531\u534f\u8bae\u901a\u8fc7\u5411\u5168\u7f51\u6269\u6563\u672c\u8bbe\u5907\u7684\u94fe\u8def\u72b6\u6001\u4fe1\u606f\uff0c\u4f7f\u7f51\u7edc\u4e2d\u6bcf\u53f0\u8bbe\u5907\u6700\u7ec8\u540c\u6b65\u4e00\u4e2a\u5177\u6709\u5168\u7f51\u94fe\u8def\u72b6\u6001\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u8def\u7531\u5668\u91c7\u7528 SPF \u7b97\u6cd5\uff0c\u4ee5\u81ea\u5df1\u4e3a\u6839\uff0c\u8ba1\u7b97\u5230\u8fbe\u5176\u4ed6\u7f51\u7edc\u7684\u6700\u77ed\u8def\u5f84\uff0c\u6700\u7ec8\u5f62\u6210\u5168\u7f51\u8def\u7531\u4fe1\u606f\u3002<\/p>\n

OSPF(Open Shortest Path First)\u662f\u4e00\u4e2a\u5185\u90e8\u7f51\u5173\u534f\u8bae(Interior Gateway Protocol,\u7b80\u79f0IGP)\u3002\u4e0eRIP\u76f8\u5bf9\uff0cOSPF\u662f\u94fe\u8def\u72b6\u6001\u8def\u7531\u534f\u8bae\uff0c\u800cRIP\u662f\u8ddd\u79bb\u5411\u91cf\u8def\u7531\u534f\u8bae\u3002 \u94fe\u8def\u662f\u8def\u7531\u5668\u63a5\u53e3\u7684\u53e6\u4e00\u79cd\u8bf4\u6cd5\uff0c\u56e0\u6b64OSPF\u4e5f\u79f0\u4e3a\u63a5\u53e3\u72b6\u6001\u8def\u7531\u534f\u8bae\u3002OSPF\u901a\u8fc7\u8def\u7531\u5668\u4e4b\u95f4\u901a\u544a\u7f51\u7edc\u63a5\u53e3\u7684\u72b6\u6001\u6765\u5efa\u7acb\u94fe\u8def\u72b6\u6001\u6570\u636e\u5e93\uff0c\u751f\u6210\u6700\u77ed\u8def\u5f84\u6811\uff0c\u6bcf\u4e2aOSPF\u8def\u7531\u5668\u4f7f\u7528\u8fd9\u4e9b\u6700\u77ed\u8def\u5f84\u6784\u9020\u8def\u7531\u8868\u3002<\/p>\n

\u57fa\u672c\u6982\u5ff5\u548c\u672f\u8bed<\/strong><\/div>\n
\u94fe\u8def\u72b6\u6001<\/strong><\/span><\/div>\n

OSPF\u8def\u7531\u5668\u6536\u96c6\u5176\u6240\u5728\u7f51\u7edc\u533a\u57df\u4e0a\u5404\u8def\u7531\u5668\u7684\u8fde\u63a5\u72b6\u6001\u4fe1\u606f\uff0c\u5373\u94fe\u8def\u72b6\u6001\u4fe1\u606f\uff08Link-State\uff09\uff0c\u751f\u6210\u94fe\u8def\u72b6\u6001\u6570\u636e\u5e93(Link-State Database)\u3002\u8def\u7531\u5668\u638c\u63e1\u4e86\u8be5\u533a\u57df\u4e0a\u6240\u6709\u8def\u7531\u5668\u7684\u94fe\u8def\u72b6\u6001\u4fe1\u606f\uff0c\u4e5f\u5c31\u7b49\u4e8e\u4e86\u89e3\u4e86\u6574\u4e2a\u7f51\u7edc\u7684\u62d3\u6251\u72b6\u51b5\u3002OSPF\u8def\u7531\u5668\u5229\u7528\u201c\u6700\u77ed\u8def\u5f84\u4f18\u5148\u7b97\u6cd5(Shortest Path First, SPF)\u201d\uff0c\u72ec\u7acb\u5730\u8ba1\u7b97\u51fa\u5230\u8fbe\u4efb\u610f\u76ee\u7684\u5730\u7684\u8def\u7531\u3002<\/p>\n

\u533a\u57df<\/strong><\/span><\/div>\n

OSPF\u534f\u8bae\u5f15\u5165\u201c\u5206\u5c42\u8def\u7531\u201d\u7684\u6982\u5ff5\uff0c\u5c06\u7f51\u7edc\u5206\u5272\u6210\u4e00\u4e2a\u201c\u4e3b\u5e72\u201d\u8fde\u63a5\u7684\u4e00\u7ec4\u76f8\u4e92\u72ec\u7acb\u7684\u90e8\u5206\uff0c\u8fd9\u4e9b\u76f8\u4e92\u72ec\u7acb\u7684\u90e8\u5206\u88ab\u79f0\u4e3a\u201c\u533a\u57df\u201d(Area)\uff0c\u201c\u4e3b\u5e72\u201d\u7684\u90e8\u5206\u79f0\u4e3a\u201c\u4e3b\u5e72\u533a\u57df\u201d\u3002\u6bcf\u4e2a\u533a\u57df\u5c31\u5982\u540c\u4e00\u4e2a\u72ec\u7acb\u7684\u7f51\u7edc\uff0c\u8be5\u533a\u57df\u7684OSPF\u8def\u7531\u5668\u53ea\u4fdd\u5b58\u8be5\u533a\u57df\u7684\u94fe\u8def\u72b6\u6001\u3002\u6bcf\u4e2a\u8def\u7531\u5668\u7684\u94fe\u8def\u72b6\u6001\u6570\u636e\u5e93\u90fd\u53ef\u4ee5\u4fdd\u6301\u5408\u7406\u7684\u5927\u5c0f\uff0c\u8def\u7531\u8ba1\u7b97\u7684\u65f6\u95f4\u3001\u62a5\u6587\u6570\u91cf\u90fd\u4e0d\u4f1a\u8fc7\u5927\u3002<\/p>\n

\u5171\u6709\u4e94\u79cd\u533a\u57df\u7684\u4e3b\u8981\u533a\u522b\u5728\u4e8e\u5b83\u4eec\u548c\u5916\u90e8\u8def\u7531\u5668\u95f4\u7684\u5173\u7cfb\uff1a<\/p>\n

\u6807\u51c6\u533a\u57df: \u4e00\u4e2a\u6807\u51c6\u533a\u57df\u53ef\u4ee5\u63a5\u6536\u94fe\u8def\u66f4\u65b0\u4fe1\u606f\u548c\u8def\u7531\u603b\u7ed3\u3002<\/p>\n

\u4e3b\u5e72\u533a\u57df(\u4f20\u9012\u533a\u57df):\u4e3b\u5e72\u533a\u57df\u662f\u8fde\u63a5\u5404\u4e2a\u533a\u57df\u7684\u4e2d\u5fc3\u5b9e\u4f53\u3002\u4e3b\u5e72\u533a\u57df\u59cb\u7ec8\u662f\u201c\u533a\u57df0\u201d\uff0c\u6240\u6709\u5176\u4ed6\u7684\u533a\u57df\u90fd\u8981\u8fde\u63a5\u5230\u8fd9\u4e2a\u533a\u57df\u4e0a\u4ea4\u6362\u8def\u7531\u4fe1\u606f\u3002\u4e3b\u5e72\u533a\u57df\u62e5\u6709\u6807\u51c6\u533a\u57df\u7684\u6240\u6709\u6027\u8d28\u3002<\/p>\n

\u5b58\u6839\u533a\u57df\uff08stub Area\uff09\uff1a\u5b58\u6839\u533a\u57df\u662f\u4e0d\u63a5\u53d7\u81ea\u6cbb\u7cfb\u7edf\u4ee5\u5916\u7684\u8def\u7531\u4fe1\u606f\u7684\u533a\u57df\u3002\u5982\u679c\u9700\u8981\u81ea\u6cbb\u7cfb\u7edf\u4ee5\u5916\u7684\u8def\u7531\uff0c\u5b83\u4f7f\u7528\u9ed8\u8ba4\u8def\u75310.0.0.0\u3002<\/p>\n

\u5b8c\u5168\u5b58\u6839\u533a\u57df\uff1a\u5b83\u4e0d\u63a5\u53d7\u5916\u90e8\u81ea\u6cbb\u7cfb\u7edf\u7684\u8def\u7531\u4ee5\u53ca\u81ea\u6cbb\u7cfb\u7edf\u5185\u5176\u4ed6\u533a\u57df\u7684\u8def\u7531\u603b\u7ed3\u3002\u9700\u8981\u53d1\u9001\u5230\u533a\u57df\u5916\u7684\u62a5\u6587\u5219\u4f7f\u7528\u9ed8\u8ba4\u8def\u7531\uff1a0.0.0.0\u3002\u5b8c\u5168\u5b58\u6839\u533a\u57df\u662fCisco\u81ea\u5df1\u5b9a\u4e49\u7684\u3002<\/p>\n

\u4e0d\u5b8c\u5168\u5b58\u6839\u533a\u57df(NSAA): \u5b83\u7c7b\u4f3c\u4e8e\u5b58\u6839\u533a\u57df\uff0c\u4f46\u662f\u5141\u8bb8\u63a5\u6536\u4ee5LSA Type 7\u53d1\u9001\u7684\u5916\u90e8\u8def\u7531\u4fe1\u606f\uff0c\u5e76\u4e14\u8981\u628aLSA Type 7\u8f6c\u6362\u6210LSA Type 5\u3002<\/p>\n

\u5ea6\u91cf\u503ccost\uff08\u94fe\u8def\u5f00\u9500\uff09<\/strong><\/span><\/div>\n

OSPF\u7684\u5ea6\u91cf\u503ccost\uff08\u94fe\u8def\u5f00\u9500\uff09\u5b83\u662f\u6839\u636e\u94fe\u8def\u5e26\u5bbd\u7b97\u51fa\u6765\u7684\u3002\u57fa\u672c\u4e0a\u662f\u548c\u94fe\u8def\u5e26\u5bbd\u6210\u53cd\u6bd4\u3002\u4e5f\u5c31\u662f\u8bf4\u5e26\u5bbd\u8d8a\u5927\uff0c\u5f00\u9500\u503c\u8d8a\u5c0f\uff0c\u94fe\u8def\u8d8a\u4f18\u3002\u8ba1\u7b97\u516c\u5f0f\u4e3a\uff1a
\n\u63a5\u53e3\u5f00\u9500=\u53c2\u8003\u5e26\u5bbd\/\u903b\u8f91\u5e26\u5bbd \uff08\u903b\u8f91\u5e26\u5bbd\u901a\u5e38\u914d\u7f6e\u548c\u7269\u7406\u63a5\u53e3\u5e26\u5bbd\u76f8\u540c\uff09
\nOSPF\u5148\u5c06\u94fe\u8def\u6bcf\u6bb5\u7684\u5f00\u9500\u5206\u522b\u8ba1\u7b97\uff0c\u7136\u540e\u8ba1\u7b97\u4ece\u5f53\u524d\u8282\u70b9\u5230\u8fbe\u4efb\u610f\u76ee\u6807\u5730\u5740\u7684\u7f51\u7edc\u5f00\u9500\uff0c\u5373\u591a\u6bb5\u94fe\u8def\u7d2f\u52a0\u3002\u9009\u51fa\u5230\u8fbe\u76ee\u6807\u7f51\u7edc\u5f00\u9500\u6700\u5c0f\u7684\u8def\u5f84\uff0c\u4e3a\u6700\u4f73\u8def\u5f84\u3002
\nospf\u63a5\u53e3\u5f00\u9500\u6709\u9ed8\u8ba4\u7684\u53c2\u8003\u503c\uff0c\u5373\u63a5\u53e3\u5e26\u5bbd\u9ed8\u8ba4\u4e3a100Mbps\uff0c\u5982\u679c\u5b9e\u9645\u5e26\u5bbd\u503c\u4e3a10M\uff0c\u90a3\u4e48\u8be5\u63a5\u53e3\u7684cost=100\/10=10,\u5982\u679c\u8be5\u63a5\u53e3\u5b9e\u9645\u5e26\u5bbd\u4e3a100Mpbs\u90a3\u4e48\u63a5\u53e3\u5f00\u9500\u4e3acost=100\/100=1 \u3002\u4f46\u73b0\u5728\u7684\u7f51\u7edc\u5df2\u7ecf\u8fdb\u51651000M\u65f6\u4ee3\uff0c\u5c31\u4f1a\u51fa\u73b0100M\u548c1000M\u7684\u5e26\u5bbd\u5728ospf\u4e2d\u5f97\u5230\u7684\u5f00\u9500\u76f8\u540c\u90fd\u662f1\u3002\u6240\u4ee5\u5982\u679c\u5b9e\u9645\u5e94\u7528\u4e2d\u5982\u679c\u63a5\u53e3\u5e26\u5bbd\u503c\u8f83\u9ad8\u65f6\u5e94\u8be5\u91cd\u65b0\u914d\u7f6e\u7aef\u53e3\u7684\u53c2\u8003\u5e26\u5bbd\u503c\u3002<\/p>\n

O 192.168.4.0\/24 [110\/65] via 192.168.3.2, 00:01:00, Vlan20
\nO \u8def\u7531\u534f\u8bae\u4ee3\u7801\uff1aO\u8868\u793aOSPF\uff0cR\u4ee3\u8868RIP\uff0cS\u4ee3\u8868\u9759\u6001\uff0c\u4f7f\u7528show\u547d\u4ee4\u7684\u65f6\u5019\uff0c\u5728\u6700\u4e0a\u65b9\u6709\u8bf4\u660e\u3002
\n192.168.4.0\/24 \u5206\u522b\u662f\u76ee\u6807\u7f51\u7edc\u548c\u76ee\u6807\u7f51\u7edc\u7684\u63a9\u7801
\n[110\/65] \u5206\u522b\u8868\u793a\u7ba1\u7406\u8ddd\u79bb\u548c\u5ea6\u91cf\u503c\u3002<\/p>\n

\u7ba1\u7406\u8ddd\u79bb<\/strong><\/span><\/div>\n

\u7ba1\u7406\u8ddd\u79bb\u662f\u7528\u6765\u6bd4\u8f83\u4e0d\u540c\u8def\u7531\u534f\u8bae\u7684\u4f18\u52a3\u7684\uff0c\u5982\u8fd9\u53f0\u8def\u7531\u5668\u540c\u65f6\u542f\u7528\u4e86RIP\u548cOSPF\u4e24\u79cd\u52a8\u6001\u8def\u7531\u534f\u8bae\uff0c\u90fd\u4f1a\u5f97\u51fa\u5230\u8fbe192.168.4.0\/24\u7684\u7f51\u7edc\u8def\u5f84\uff0c\u4f46\u662f\u90a3\u79cd\u8def\u7531\u534f\u8bae\u7684\u7ed3\u679c\u4f1a\u88ab\u8bb0\u5f55\u5230\u8def\u7531\u8868\u4e2d\u5462\uff1f\u5c31\u662f\u901a\u8fc7\u7ba1\u7406\u8ddd\u79bb\u6bd4\u8f83\u7b97\u6cd5\u7684\u4f18\u52a3\u3002\u7ba1\u7406\u8ddd\u79bb\u7684\u503c\u8d8a\u5c0f\uff0c\u8def\u7531\u5668\u8ba4\u4e3a\u8be5\u534f\u8bae\u7684\u7b97\u6cd5\u8d8a\u597d\uff0c\u8ba1\u7b97\u7ed3\u679c\u8d8a\u51c6\u786e\uff0c\u4f18\u5148\u91c7\u7528\u8be5\u534f\u8bae\u7684\u7ed3\u679c\u3002<\/p>\n

\u5e38\u89c1\u8def\u7531\u534f\u8bae\u7684\u7ba1\u7406\u8ddd\u79bb\u6709\uff1a
\n\u76f4\u8fde\u8def\u7531 0
\n\u9759\u6001\u8def\u7531 1
\nEIGRP\u6c47\u603b\u8def\u7531 5
\nEBGP 20
\nEIGRP 90
\nIGRP 100
\nOSPF 110
\nIS-IS 115
\nRIP(v1&v2) 120
\nEGP 140
\nODR 160
\nExEIGRP (\u5916\u90e8EIGRP) 170
\nIBGP 200
\n\u672a\u77e5 255<\/p>\n

\u5ea6\u91cf\u503c\u662f\u7528\u6765\u8861\u91cf\u540c\u4e00\u79cd\u8def\u7531\u534f\u8bae\u8ba1\u7b97\u5230\u8fbe\u76f8\u540c\u76ee\u6807\u5730\u5740\u7684\u591a\u6761\u8def\u5f84\u7684\u4f18\u52a3\u7684\u53c2\u6570\u3002\u5ea6\u91cf\u503c\u6700\u5c0f\u7684\u4f1a\u88ab\u8bb0\u5f55\u5230\u8def\u7531\u8868\u3002\u6bd4\u5982\uff1aOSPF\u8ba1\u7b97\u5230\u8fbe192.168.4.0\/24\u7f51\u7edc\u6709\u4e09\u6761\u8def\u5f84\u5f00\u9500\u503c\u5206\u522b\u662f\uff1a145 ,230 \u548c99\uff0c\u6bd4\u8f83\u540e\u53d1\u73b099\u7684\u8fd9\u6761\u8def\u5f84\u5ea6\u91cf\u503c\u6700\u5c0f\uff0c\u4f1a\u88ab\u8ba4\u4e3a\u662f\u6700\u4f73\u8def\u5f84\uff0c\u52a0\u5165\u5230\u8def\u7531\u8868\u3002\u5e38\u7528\u6765\u4f5c\u4e3a\u5ea6\u91cf\u503c\u7684\u53c2\u8003\u56e0\u7d20\u6709\uff1a
\n\u8df3\u6570\u3001\u5e26\u5bbd\u3001\u5ef6\u8fdf\u3001\u53ef\u9760\u6027\u3001\u8d1f\u8f7d\u3001MTU\u7b49\u3002
\n\u4e0d\u540c\u7684\u8def\u7531\u534f\u8bae\u7528\u6765\u4f5c\u4e3a\u5ea6\u91cf\u503c\u7684\u53c2\u6570\u662f\u4e0d\u540c\u7684\uff0c\u6709\u7684\u662f\u4e00\u79cd\uff0c\u6709\u7684\u662f\u591a\u79cd\u3002\u5982RIP\u4f7f\u7528\u8df3\u6570\u505a\u5ea6\u91cf\u503c\uff0cEIGRP\u9ed8\u8ba4\u4f7f\u7528\u5e26\u5bbd\u548c\u5ef6\u8fdf\u4e24\u79cd\uff0c\u6700\u591a\u53ef\u4ee5\u4f7f\u7528\u4e94\u79cd\u3002OSPF\u4f7f\u7528cost\uff08\u5f00\u9500\uff09\u4f5c\u4e3a\u5ea6\u91cf\u503c\uff0ccost\u548c\u7aef\u53e3\u7684\u5e26\u5bbd\u76f8\u5173\uff0c\u57fa\u672c\u4e0a\u662f\u548c\u7aef\u53e3\u5e26\u5bbd\u6210\u53cd\u6bd4\uff0c\u5373\u7aef\u53e3\u5e26\u5bbd\u8d8a\u5927\uff0c\u5f00\u9500\u8d8a\u5c0f\uff0c\u94fe\u8def\u8d8a\u4f18\u3002
\nvia 192.168.3.2 \u8868\u793a\u4e0b\u4e00\u8df3\u5730\u5740\u3002\u5373\u5230\u8fbe192.168.4.0\u7f51\u7edc\u9996\u5148\u8981\u5230\u8fbe192.168.3.2\u624d\u53ef\u4ee5\u3002\u53e6\u5916via\u4e5f\u53ef\u4ee5\u7406\u89e3\u4e3a\uff1a\u66f4\u65b0\u6e90\uff0c\u5373\u8be5\u8def\u7531\u6d88\u606f\u662f\u6765\u81ea\u4e8e\u8c01\u3002
\n00:01:00 \u8be5\u6d88\u606f\u7684\u66f4\u65b0\u65f6\u95f4\u3002
\nVlan20 \u51fa\u63a5\u53e3\uff0c\u8868\u793a\u5230\u8fbe\u76ee\u6807\u7f51\u7edc\u5e94\u8be5\u4ece\u81ea\u5df1\u7684\u90a3\u4e2a\u63a5\u53e3\u5c06\u6570\u636e\u53d1\u51fa\u3002<\/p>\n

\u8def\u7531\u8868\u7684\u4e94\u8981\u7d20\uff1a
\n\u76ee\u6807\u5730\u5740 \u76ee\u6807\u7f51\u7edc\u63a9\u7801 \u4f18\u5148\u7ea7\uff08\u5ea6\u91cf\u503c\u548c\u7ba1\u7406\u8ddd\u79bb\uff09 \u4e0b\u4e00\u8df3\u5730\u5740 \u51fa\u63a5\u53e3<\/strong><\/p>\n

\u5b9e\u9a8c\u6b65\u9aa4<\/strong><\/div>\n

\u65b0\u5efa packet tracer \u62d3\u6251\u56fe<\/p>\n

\"\"<\/p>\n

\uff081\uff09\u5728\u672c\u5b9e\u9a8c\u4e2d\u7684\u4e09\u5c42\u4ea4\u6362\u673a\u4e0a\u5212\u5206 VLAN10 \u548c VLAN20\uff0c\u5176\u4e2d VLAN10 \u7528\u4e8e
\n\u8fde\u63a5\u6821\u56ed\u7f51\u4e3b\u673a\uff0cVLAN20 \u7528\u4e8e\u8fde\u63a5 R1
\n\uff082\uff09\u8def\u7531\u5668\u4e4b\u95f4\u901a\u8fc7 V35 \u7535\u7f06\u901a\u8fc7\u4e32\u53e3\u8fde\u63a5\uff0cDCE \u7aef\u8fde\u63a5\u5728 R1 \u4e0a\uff0c\u914d\u7f6e\u5176\u65f6\u949f
\n\u9891\u7387 64000
\n\uff083\uff09\u4e3b\u673a\u548c\u4ea4\u6362\u673a\u901a\u8fc7\u76f4\u8fde\u7ebf\uff0c\u4e3b\u673a\u4e0e\u8def\u7531\u5668\u901a\u8fc7\u4ea4\u53c9\u7ebf\u8fde\u63a5
\n\uff084\uff09\u5728 S3560 \u4e0a\u914d\u7f6e OSPF \u8def\u7531\u534f\u8bae
\n\uff085\uff09\u5728\u8def\u7531\u5668 R1\u3001R2 \u4e0a\u914d\u7f6e OSPF \u8def\u7531\u534f\u8bae
\n\uff086\uff09\u5c06 PC1\u3001PC2 \u4e3b\u673a\u9ed8\u8ba4\u7f51\u5173\u8bbe\u7f6e\u4e3a\u4e0e\u76f4\u8fde\u7f51\u8def\u8bbe\u5907\u63a5\u53e3 IP \u5730\u5740
\n\uff087\uff09\u9a8c\u8bc1 PC1\u3001PC2 \u4e3b\u673a\u4e4b\u95f4\u53ef\u4ee5\u4e92\u76f8\u540c\u4fe1<\/p>\n

\u5b9e\u9a8c\u8bbe\u5907<\/strong><\/div>\n

PC 2 \u53f0\uff1bSwitch_3560 1 \u53f0\uff1bRouter-PT 2 \u53f0\uff1b\u76f4\u8fde\u7ebf\uff1b\u4ea4\u53c9\u7ebf\uff1bDCE \u4e32\u53e3\u7ebf<\/p>\n

PC1\r\nIP: 192.168.1.2\r\nSubmask: 255.255.255.0\r\nGateway: 192.168.1.1\r\n\r\nPC2\r\nIP: 192.168.2.2\r\nSubmask: 255.255.255.0\r\nGateway: 192.168.2.1\r\n\r\nS3560\r\n\r\nen\r\nconf t\r\nhostname S3560\r\nvlan 10\r\nexit\r\nvlan 20\r\nexit\r\ninterface fa 0\/10\r\nswitchport access vlan 10\r\nexit\r\nint fa 0\/20\r\nswitchport access valn 20\r\nexit\r\ninterface vlan 10\r\nip address 192.168.1.1 255.255.255.0\r\n\r\nno shutdown\r\nexit\r\ninterface vlan 20\r\nip address 192.168.3.1 255.255.255.0\r\nno shutdown\r\nend\r\nshow ip route\r\nconf t\r\nrouter ospf 1 #\u6307\u5b9aospf\u7684\u8fdb\u7a0b\u53f7\u4e3a1\r\nnetwork 192.168.1.0 0.0.0.255 area 0 #\u5ba3\u544a192.168.1.0\u7f51\u6bb5\u53cd\u63a9\u7801\u4e3a0.0.0.255  \u533a\u57df\u4e3a\u9aa8\u5e72\u533a\u57dfarea 0\r\nnetwork 192.168.3.0 0.0.0.255 area 0\r\nend\r\nshow ip route\r\n\r\nR1\r\nen\r\nconf t\r\nhostname R1\r\ninterface fa 0\/0\r\nno shutdown\r\nip address 192.168.3.2 255.255.255.0\r\nexit\r\ninterface serial 2\/0\r\nno shutdown\r\nclock rate 64000\r\nip address 192.168.4.1 255.255.255.0\r\nend\r\nshow ip route\r\nconf t\r\nrouter ospf 1\r\nnetwork 192.168.3.0 0.0.0.255 area 0\r\nnetwork 192.168.4.0 0.0.0.255 area 0\r\nend\r\nshow ip route\r\n\r\nR2\r\nen\r\nconf t\r\nhostname R2\r\ninterface fa 0\/0\r\nno shutdown\r\nip address 192.168.2.1 255.255.255.0\r\n\r\nexit\r\ninterface serial 2\/0\r\nno shutdown\r\nip address 192.168.4.2 255.255.255.0\r\nend\r\nshow ip route\r\nconf t\r\nrouter ospf 1\r\nnetwork 192.168.2.0 0.0.0.255 area 0\r\nnetwork 192.168.4.0 0.0.0.255 area 0\r\nend\r\nshow ip route\r\n<\/pre>\n
\u5b9e\u6218\u6f14\u7ec3<\/strong><\/div>\n
S3560\r\n\r\nSwitch>en\r\nSwitch#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nSwitch(config)#hostname\r\n% Incomplete command.\r\nSwitch(config)#hostname S3560\r\nS3560(config)#vlan 10\r\nS3560(config-vlan)#exit\r\nS3560(config)#vlan 20\r\nS3560(config-vlan)#int fa 0\/10\r\nS3560(config-if)#sw acc vlan 10\r\nS3560(config-if)#exit\r\nS3560(config)#int fa 0\/20\r\nS3560(config-if)#sw acc vlan 20\r\nS3560(config-if)#exit\r\nS3560(config)#int vlan 10\r\n\r\n%LINK-5-CHANGED: Interface Vlan10, changed state to up\r\n\r\n%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up\r\nS3560(config-if)#ip address 192.168.1.1 255.255.255.0\r\nS3560(config-if)#no shut\r\nS3560(config-if)#exit\r\nS3560(config)#int vlan 20\r\nS3560(config-if)#\r\n%LINK-5-CHANGED: Interface Vlan20, changed state to up\r\n\r\nS3560(config-if)#ip address 192.168.3.1 255.255.255.0\r\nS3560(config-if)#no shut\r\nS3560(config-if)#end\r\nS3560#\r\n%SYS-5-CONFIG_I: Configured from console by console\r\n\r\nS3560#show ip route\r\nCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP\r\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\r\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\r\n       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP\r\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\r\n       * - candidate default, U - per-user static route, o - ODR\r\n       P - periodic downloaded static route\r\n\r\nGateway of last resort is not set\r\n\r\nC    192.168.1.0\/24 is directly connected, Vlan10\r\nS3560#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nS3560(config)#router ospf 1\r\nS3560(config-router)#network 192.168.1.0 0.0.0.255 area 0\r\nS3560(config-router)#network 192.168.3.0 0.0.0.255 area 0\r\nS3560(config-router)#\r\nS3560(config-router)#end\r\nS3560#\r\n%SYS-5-CONFIG_I: Configured from console by console\r\n\r\nS3560#show ip route\r\nCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP\r\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\r\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\r\n       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP\r\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\r\n       * - candidate default, U - per-user static route, o - ODR\r\n       P - periodic downloaded static route\r\n\r\nGateway of last resort is not set\r\n\r\nC    192.168.1.0\/24 is directly connected, Vlan10\r\nS3560#\r\n%LINK-5-CHANGED: Interface FastEthernet0\/20, changed state to up\r\n\r\n%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0\/20, changed state to up\r\n\r\n%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up\r\n\r\n00:12:29: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.4.1 on Vlan20 from LOADING to FULL, Loading Done\r\n\r\nR1\r\n\r\nContinue with configuration dialog? [yes\/no]: n\r\n\r\n\r\nPress RETURN to get started!\r\n\r\n\r\n\r\nRouter>en\r\nRouter#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nRouter(config)#hostname R1\r\nR1(config)#int fa 0\/0\r\nR1(config-if)#no shut\r\n\r\n%LINK-5-CHANGED: Interface FastEthernet0\/0, changed state to up\r\n\r\n%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0\/0, changed state to up\r\n\r\nR1(config-if)#ip address 192.168.3.2 255.255.255.0\r\nR1(config-if)#exit\r\nR1(config)#\r\nR1(config)#int serial 2\/0\r\nR1(config-if)#no shut\r\n\r\n%LINK-5-CHANGED: Interface Serial2\/0, changed state to down\r\nR1(config-if)#clock rate 64000\r\nR1(config-if)#ip address 192.168.4.1 255.255.255.0\r\nR1(config-if)#end\r\nR1#\r\n%SYS-5-CONFIG_I: Configured from console by console\r\n\r\nR1#show ip route\r\nCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP\r\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\r\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\r\n       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP\r\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\r\n       * - candidate default, U - per-user static route, o - ODR\r\n       P - periodic downloaded static route\r\n\r\nGateway of last resort is not set\r\n\r\nC    192.168.3.0\/24 is directly connected, FastEthernet0\/0\r\nR1#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nR1(config)#router ospf 1\r\nR1(config-router)#network 192.168.3.0 0.0.0.255 area 0\r\nR1(config-router)#network 192.168.4.0 0.0.0.255 area 0\r\nR1(config-router)#end\r\nR1#\r\n%SYS-5-CONFIG_I: Configured from console by console\r\n\r\nR1#show ip route\r\nCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP\r\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\r\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\r\n       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP\r\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\r\n       * - candidate default, U - per-user static route, o - ODR\r\n       P - periodic downloaded static route\r\n\r\nGateway of last resort is not set\r\n\r\nO    192.168.1.0\/24 [110\/2] via 192.168.3.1, 00:00:23, FastEthernet0\/0\r\nC    192.168.3.0\/24 is directly connected, FastEthernet0\/0\r\nR1#\r\n\r\nR2\r\n\r\nRouter>en\r\nRouter#\r\nRouter#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nRouter(config)#hostname R2\r\nR2(config)#int fa 0\/0\r\nR2(config-if)#no shut\r\n\r\n%LINK-5-CHANGED: Interface FastEthernet0\/0, changed state to up\r\n\r\n%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0\/0, changed state to up\r\n\r\nR2(config-if)#ip address 192.168.2.1 255.255.255.0\r\nR2(config-if)#exit\r\nR2(config)#\r\nR2(config)#int serial 2\/0\r\nR2(config-if)#no shut\r\n\r\n%LINK-5-CHANGED: Interface Serial2\/0, changed state to up\r\n\r\nR2(config-if)#ip add \r\n%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2\/0, changed state to up\r\n\r\n% Incomplete command.\r\nR2(config-if)#ip add 192.168.4.2 255.255.255.0\r\nR2(config-if)#end\r\nR2#\r\n%SYS-5-CONFIG_I: Configured from console by console\r\n\r\nR2#show ip route\r\nCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP\r\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\r\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\r\n       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP\r\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\r\n       * - candidate default, U - per-user static route, o - ODR\r\n       P - periodic downloaded static route\r\n\r\nGateway of last resort is not set\r\n\r\nC    192.168.2.0\/24 is directly connected, FastEthernet0\/0\r\nC    192.168.4.0\/24 is directly connected, Serial2\/0\r\nR2#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nR2(config)#router ospf 1\r\nR2(config-router)#\r\nR2(config-router)#network 192.168.2.0 0.0.0.255 area 0\r\nR2(config-router)#network 192.168.4.0 0.0.0.255 area 0\r\nR2(config-router)#end\r\nR2#\r\n%SYS-5-CONFIG_I: Configured from console by console\r\n\r\nR2#\r\n00:14:52: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.4.1 on Serial2\/0 from LOADING to FULL, Loading Done\r\n\r\nR2#show ip route\r\nCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP\r\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\r\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\r\n       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP\r\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\r\n       * - candidate default, U - per-user static route, o - ODR\r\n       P - periodic downloaded static route\r\n\r\nGateway of last resort is not set\r\n\r\nO    192.168.1.0\/24 [110\/66] via 192.168.4.1, 00:00:03, Serial2\/0\r\nC    192.168.2.0\/24 is directly connected, FastEthernet0\/0\r\nO    192.168.3.0\/24 [110\/65] via 192.168.4.1, 00:00:03, Serial2\/0\r\nC    192.168.4.0\/24 is directly connected, Serial2\/0\r\nR2#\r\n<\/pre>\n
\u6d4b\u8bd5<\/strong><\/div>\n
PC>ipconfig\r\n\r\nIP Address......................: 192.168.1.2\r\nSubnet Mask.....................: 255.255.255.0\r\nDefault Gateway.................: 192.168.1.1\r\n\r\nPC>ping 192.168.2.2\r\n\r\nPinging 192.168.2.2 with 32 bytes of data:\r\n\r\nRequest timed out.\r\nRequest timed out.\r\nRequest timed out.\r\nRequest timed out.\r\n\r\nPing statistics for 192.168.2.2:\r\n    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),\r\n\r\nPC>\r\n\r\n\r\nping \u4e0d\u901a\uff0c\u67e5\u770b\u4e09\u5c42\u4ea4\u6362\u673a\u7684\u8def\u7531\u8868\u4fe1\u606f\u5e76\u5f00\u542f\u8def\u7531\u8f6c\u53d1\u529f\u80fd\r\n\r\nS3560#show ip route\r\nCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP\r\n       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area\r\n       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2\r\n       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP\r\n       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area\r\n       * - candidate default, U - per-user static route, o - ODR\r\n       P - periodic downloaded static route\r\n\r\nGateway of last resort is not set\r\n\r\nC    192.168.1.0\/24 is directly connected, Vlan10\r\nO    192.168.2.0\/24 [110\/66] via 192.168.3.2, 00:04:27, Vlan20\r\nC    192.168.3.0\/24 is directly connected, Vlan20\r\nO    192.168.4.0\/24 [110\/65] via 192.168.3.2, 00:05:43, Vlan20\r\nS3560#conf t\r\nEnter configuration commands, one per line.  End with CNTL\/Z.\r\nS3560(config)#\r\nS3560(config)#ip routing\r\nS3560(config)#\r\n\r\n\u518d\u6b21\u89c2\u5bdf\u6d4b\u8bd5\u60c5\u51b5\r\nPC>ping -t 192.168.2.2\r\n\r\nPinging 192.168.2.2 with 32 bytes of data:\r\n\r\nRequest timed out.\r\nRequest timed out.\r\nRequest timed out.\r\nReply from 192.168.2.2: bytes=32 time=18ms TTL=125\r\nReply from 192.168.2.2: bytes=32 time=23ms TTL=125\r\nReply from 192.168.2.2: bytes=32 time=19ms TTL=125\r\nReply from 192.168.2.2: bytes=32 time=22ms TTL=125\r\nReply from 192.168.2.2: bytes=32 time=20ms TTL=125\r\nReply from 192.168.2.2: bytes=32 time=21ms TTL=125\r\nReply from 192.168.2.2: bytes=32 time=18ms TTL=125\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u638c\u63e1 OSPF \u534f\u8bae\u7684\u914d\u7f6e\u65b9\u6cd5 \u638c\u63e1\u67e5\u770b\u901a\u8fc7\u52a8\u6001\u8def\u7531\u534f\u8bae OSPF \u5b66\u4e60\u4ea7\u751f\u7684\u8def\u7531 \u719f\u6089\u5e7f\u57df\u7f51\u7ebf\u7f06\u7684\u94fe\u63a5\u65b9\u5f0f […]<\/p>\n","protected":false},"author":63,"featured_media":174918,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-174917","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=174917"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174917\/revisions"}],"predecessor-version":[{"id":175345,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/174917\/revisions\/175345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/174918"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=174917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=174917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=174917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}