{"id":97579,"date":"2024-06-13T06:46:12","date_gmt":"2024-06-12T22:46:12","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=97579"},"modified":"2024-06-13T06:46:12","modified_gmt":"2024-06-12T22:46:12","slug":"centos6-route","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos6-route.html","title":{"rendered":"CentOS6\u5982\u4f55\u5b9e\u73b0\u8def\u7531\u5668\u529f\u80fd"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u7f51\u7edc\u4e4b\u95f4\u7684\u901a\u4fe1\u4e3b\u8981\u662f\u4f9d\u9760\u8def\u7531\u5668\uff0c\u5f53\u7136\u751f\u6210\u73af\u5883\u4e2d\u662f\u62e5\u6709\u8def\u7531\u5668\u7684\uff0c\u4f46\u662f\u7cfb\u7edf\u4e2d\u7684\u8def\u7531\u914d\u7f6e\u4e5f\u662f\u9700\u8981\u4e86\u89e3\u4e00\u4e0b\u5730\uff0c\u4eca\u5929\u8bb2\u89e3\u4e00\u4e0b\u5728CentOS6\u73af\u5883\u4e0b\u642d\u5efa\u8def\u7531\u5668\uff0c\u6b64\u4e43\u5165\u95e8\u7ea7\u7684\u7b80\u5355\u5b9e\u9a8c\u3002\u62d3\u6251\u5982\u4e0a\u56fe\u5df2\u7ecf\u89c4\u5212\u597d\uff0c\u6682\u4e14\u4f7f\u7528\u9759\u6001\u8def\u7531\u6f14\u793a\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u914d\u7f6e<\/strong><\/div>\n
\u5982\u56fe\u6240\u793a\u5148\u914d\u7f6e\u6240\u6709\u7684IP\u5730\u5740<\/strong><\/span><\/div>\n
\u9488\u5bf9\u4e0d\u540c\u7684\u673a\u5668\u914d\u7f6e\u8def\u7531<\/strong><\/span><\/div>\n

Aubin-CentOS1<\/p>\n

\r\n    route add default gw 10.0.1.1\r\n<\/pre>\n

CentOS-R1<\/p>\n

\r\n    route add -net 10.0.3.0\/24 gw 10.0.2.2\r\n    route add -net 10.0.4.0\/24 gw 10.0.2.2\r\n    echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward                #\u542f\u7528\u8f6c\u53d1\u529f\u80fd(\u53ef\u4ee5\u7406\u89e3\u4e3a\u542f\u7528\u8def\u7531\u529f\u80fd)\r\n    iptables -F                                           #\u5173\u95ed\u9632\u706b\u5899\r\n<\/pre>\n

CentOS-R2<\/p>\n

\r\n    route add -net 10.0.1.0\/24 gw 10.0.2.1\r\n    route add -net 10.0.4.0\/21 gw 10.0.3.1\r\n    echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward\r\n    iptables -F\r\n<\/pre>\n

CentOS-R3<\/p>\n

\r\n    route add -net 10.0.2.0\/24 gw 10.0.3.2\r\n    route add -net 10.0.1.0\/24 gw 10.0.3.2\r\n    echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward\r\n    iptables -F\r\n<\/pre>\n

Aubin-CentOS1<\/p>\n

\r\n    route add default gw 10.0.4.1\r\n<\/pre>\n

\u4ee5\u4e0a\u5c31\u662f\u5168\u90e8\u914d\u7f6e\uff0c\u7136\u540e\u7528CentOS1\u533a\u6d4b\u8bd5\uff0cping CentOS2\u7684ip\u5730\u574010.0.4.100\u3002\u5982\u679cping\u901a\u5219\u6240\u6709\u914d\u7f6e\u5747\u6ca1\u95ee\u9898\u3002\u5982\u679c\u6ca1\u6709\u901a\u8bf7\u53c2\u5c55\u4ee5\u4e0b\u51e0\u70b9\u505a\u68c0\u67e5<\/p>\n

0.\u867d\u7136\u914d\u7f6e\u7b80\u5355\uff0c\u4f46\u662f\u8db3\u591f\u7e41\u7410\uff0c\u5982\u679c\u9047\u5230\u95ee\u9898\u8bf7\u8010\u5fc3\u68c0\u67e5\u4ee5\u4e0b\u51e0\u6761\u3002<\/p>\n

1.\u4f7f\u7528route -n\u67e5\u770b\u8def\u7531\u662f\u5426\u751f\u6548\u3002<\/p>\n

2.cat \/proc\/sys\/net\/ipv4\/ip_forward\u67e5\u770b\u8f93\u51fa\u662f\u5426\u4e3a1\uff0c\u5982\u679c\u4e3a0\u8bf4\u660e\u6ca1\u6709\u5f00\u542f\u8f6c\u53d1\u529f\u80fd\u3002<\/p>\n

\u68c0\u67e5echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward\u662f\u5426\u6267\u884c\u6210\u529f\u3002<\/p>\n

3.\u68c0\u67e5IP \u4e0e \u63a9\u7801\u662f\u5426\u914d\u7f6e\u6b63\u786e\uff0c\u56e0\u4e3a\u6709\u591a\u4e2aIP\u5730\u5740\u5bb9\u6613\u641e\u6df7\uff0c\u6240\u4ee5\u597d\u597d\u68c0\u67e5\u3002<\/p>\n

4.\u68c0\u67e5\u662f\u662f\u5426\u5173\u95ed\u9632\u706b\u5899\uff0c\u6267\u884ciptables -F\u3002<\/p>\n

5.\u5982\u679c\u5728\u865a\u62df\u673a\u73af\u5883\u4e0b\u505a\u5b9e\u9a8c\uff0c\u68c0\u67e5MAC\u5730\u5740\u662f\u5426\u51b2\u7a81<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.cnblogs.com\/aubin\/p\/7397273.html<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/centos6-route.html<\/a>\u7f16\u8f91\uff1a\u4f55\u4e91\u8273\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb \u7f51\u7edc\u4e4b\u95f4\u7684\u901a\u4fe1\u4e3b\u8981\u662f\u4f9d\u9760\u8def\u7531\u5668\uff0c\u5f53\u7136\u751f\u6210\u73af\u5883\u4e2d\u662f\u62e5\u6709\u8def\u7531\u5668\u7684\uff0c\u4f46\u662f\u7cfb\u7edf\u4e2d\u7684\u8def\u7531\u914d\u7f6e\u4e5f\u662f\u9700\u8981\u4e86\u89e3\u4e00\u4e0b\u5730\uff0c\u4eca […]<\/p>\n","protected":false},"author":1479,"featured_media":97761,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-97579","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\/97579","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\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=97579"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/97579\/revisions"}],"predecessor-version":[{"id":291971,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/97579\/revisions\/291971"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/97761"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=97579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=97579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=97579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}