{"id":1540,"date":"2011-09-07T19:35:32","date_gmt":"2011-09-07T11:35:32","guid":{"rendered":"http:\/\/www.jpuyy.com\/blog\/?p=1540"},"modified":"2013-11-21T20:44:53","modified_gmt":"2013-11-21T12:44:53","slug":"linux-routing","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=1540","title":{"rendered":"debian\uff5clinux \u8def\u7531"},"content":{"rendered":"<p>\u8def\u7531\u662f\u4ec0\u4e48<\/p>\n<p><strong>\u8def\u7531<\/strong>\uff08<strong>routing<\/strong>\uff09\u5c31\u662f\u901a\u8fc7\u4e92\u8054\u7684<a title=\"\u7f51\u7edc\" href=\"http:\/\/zh.wikipedia.org\/wiki\/%E7%BD%91%E7%BB%9C\">\u7f51\u7edc<\/a>\u628a<a title=\"\u4fe1\u606f\" href=\"http:\/\/zh.wikipedia.org\/wiki\/%E4%BF%A1%E6%81%AF\">\u4fe1\u606f<\/a>\u4ece\u6e90\u5730\u5740\u4f20\u8f93\u5230\u76ee\u7684\u5730\u5740\u7684\u6d3b\u52a8\u3002<\/p>\n<p><a title=\"\u8def\u7531\" href=\"http:\/\/zh.wikipedia.org\/wiki\/%E8%B7%AF%E7%94%B1\" target=\"_blank\">http:\/\/zh.wikipedia.org\/wiki\/%E8%B7%AF%E7%94%B1<\/a><\/p>\n<p>linux\u663e\u793a\u8def\u7531\u8868<\/p>\n<p>\uff03route \u6216<\/p>\n<p># netstat -r<\/p>\n<pre>\u5185\u6838 IP \u8def\u7531\u8868\r\n\u76ee\u6807            \u7f51\u5173            \u5b50\u7f51\u63a9\u7801        \u6807\u5fd7  \u8dc3\u70b9   \u5f15\u7528  \u4f7f\u7528 \u63a5\u53e3\r\ninto.dyndns.org *              255.255.255.255 UH    0      0        0 eth0\r\ninto.dyndns.org *              255.255.255.255 UH    0      0        0 eth0\r\n10.19.1.1       *              255.255.255.255 UH    0      0        0 ppp0\r\n219.230.xxx.xxx *              255.255.255.192 U     1      0        0 eth0\r\nlink-local      *              255.255.0.0     U     1000   0        0 eth0\r\ndefault         *              0.0.0.0         U     0      0        0 ppp0<\/pre>\n<p># route -n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \uff03\u6309\u7167\u8d8a\u7cbe\u786e\u8d8a\u9760\u524d\u3002\u8fd9\u4e2a\u662f\u8def\u7531\u7684\u6392\u5e8f\u89c4\u5219<\/p>\n<p>\u9ed8\u8ba4\u8def\u7531<\/p>\n<pre>ip route add default dev eth0 via 192.168.0.254\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \uff03\u6dfb\u52a0\u9ed8\u8ba4\u8def\u7531\r\nip route del default dev eth0 via 192.168.0.254\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \uff03\u5220\u9664\u9ed8\u8ba4\u8def\u7531<\/pre>\n<p>\u4e3b\u673a\u8def\u7531<\/p>\n<pre>ip route add dev eth0 10.0.0.1\/32\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \uff03\u6dfb\u52a0\u4e3b\u673a\u8def\u7531\r\nip route del dev eth0 10.0.0.1\/32\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \uff03\u5220\u9664\u4e3b\u673a\u8def\u7531<\/pre>\n<p>\u7f51\u6bb5\u8def\u7531<\/p>\n<pre>ip route add dev eth0 192.168.0.0\/16\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \uff03\u6dfb\u52a0\u7f51\u6bb5\u8def\u7531\r\nip route del dev eth0 192.168.0.0\/16\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \uff03\u5220\u9664\u7f51\u6bb5\u8def\u7531<\/pre>\n<p>route add -net \u76ee\u6807\u7f51\u6bb5 netmask \u63a9\u7801 dev eth0<\/p>\n<p>route del -net \u76ee\u6807\u7f51\u6bb5 netmask \u63a9\u7801 dev eth0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8def\u7531\u662f\u4ec0\u4e48 \u8def\u7531\uff08routing\uff09\u5c31\u662f\u901a\u8fc7\u4e92\u8054\u7684\u7f51\u7edc\u628a\u4fe1\u606f\u4ece\u6e90\u5730\u5740\u4f20\u8f93\u5230\u76ee\u7684\u5730\u5740\u7684\u6d3b\u52a8\u3002 http:\/\/zh.wikipedia.org\/wiki\/%E8%B7%AF%E7%94%B1 linux\u663e\u793a\u8def\u7531\u8868 \uff03route \u6216 # netstat -r \u5185\u6838 IP \u8def\u7531\u8868 \u76ee\u6807 \u7f51\u5173 \u5b50\u7f51\u63a9\u7801 \u6807\u5fd7 \u8dc3\u70b9 \u5f15\u7528 \u4f7f\u7528 \u63a5\u53e3 into.dyndns.org * 255.255.255.255 UH 0 0 0 eth0 into.dyndns.org * 255.255.255.255 UH 0 0 0 eth0 10.19.1.1 * 255.255.255.255 UH 0 0 0 ppp0 219.230.xxx.xxx * 255.255.255.192 U 1 0 0 eth0 link-local * 255.255.0.0 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[67],"class_list":["post-1540","post","type-post","status-publish","format-standard","hentry","category-linux","tag-network"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1540"}],"version-history":[{"count":11,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1540\/revisions"}],"predecessor-version":[{"id":5848,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1540\/revisions\/5848"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}