{"id":1998,"date":"2019-05-15T00:57:31","date_gmt":"2019-05-14T16:57:31","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=1998"},"modified":"2022-05-26T20:05:22","modified_gmt":"2022-05-26T12:05:22","slug":"route","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/route","title":{"rendered":"route\u547d\u4ee4 – \u663e\u793a\u4e0e\u8bbe\u7f6e\u8def\u7531\u4fe1\u606f"},"content":{"rendered":"\n
route\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u4e0e\u8bbe\u7f6e\u8def\u7531\u4fe1\u606f\uff0c\u662fLinux\u7cfb\u7edf\u4e2d\u5e38\u7528\u7684\u9759\u6001\u8def\u7531\u914d\u7f6e\u5de5\u5177\u3002\u8981\u60f3\u8ba9\u4e24\u53f0\u5904\u5728\u4e0d\u540c\u5b50\u7f51\u4e4b\u95f4\u7684\u670d\u52a1\u5668\u80fd\u591f\u901a\u4fe1\uff0c\u9700\u8981\u6709\u4e00\u4e2a\u8de8\u7f51\u6bb5\u7684\u8def\u7531\u5668\u6765\u8fde\u63a5\u5b83\u4eec\uff0c\u5e76\u7528route\u547d\u4ee4\u4e3a\u5176\u8bbe\u7f6e\u8def\u7531\u4fe1\u606f\uff0c\u63d0\u4f9b\u8f6f\u786c\u4ef6\u7684\u652f\u6491\u3002<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>route [\u53c2\u6570] <\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u663e\u793a\u5f53\u524d\u8def\u7531\u8868\u4fe1\u606f\uff1a<\/p>\n\n\n\n \u6dfb\u52a0\u4e00\u6761\u6307\u5b9a\u7684\u8def\u7531\u4fe1\u606f\uff1a<\/p>\n\n\n\n \u5220\u9664\u4e00\u6761\u6307\u5b9a\u7684\u8def\u7531\u4fe1\u606f\uff1a<\/p>\n\n\n\n \u6dfb\u52a0\u548c\u5220\u9664\u9ed8\u8ba4\u7f51\u5173\uff1a<\/p>\n\n\n\n route\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u4e0e\u8bbe\u7f6e\u8def\u7531\u4fe1\u606f\uff0c\u662fLinux\u7cfb\u7edf\u4e2d\u5e38\u7528\u7684\u9759\u6001\u8def\u7531\u914d\u7f6e\u5de5\u5177\u3002\u8981\u60f3\u8ba9\u4e24\u53f0\u5904\u5728\u4e0d\u540c\u5b50\u7f51 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1998"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=1998"}],"version-history":[{"count":12,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1998\/revisions"}],"predecessor-version":[{"id":10097,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1998\/revisions\/10097"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=1998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=1998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=1998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}-A<\/td> \u8bbe\u7f6e\u5730\u5740\u7c7b\u578b\uff08 \u9ed8\u8ba4IPv4\uff09<\/td><\/tr> -C<\/td> \u6253\u5370\u6838\u5fc3\u7684\u8def\u7531\u7f13\u5b58<\/td><\/tr> -v<\/td> \u8be6\u7ec6\u4fe1\u606f\u6a21\u5f0f<\/td><\/tr> -n<\/td> \u76f4\u63a5\u663e\u793a\u6570\u5b57\u5f62\u5f0f\u7684ip\u5730\u5740<\/td><\/tr> -e<\/td> netstat\u683c\u5f0f\u663e\u793a\u8def\u7531\u8868<\/td><\/tr> -net<\/td> \u5230\u4e00\u4e2a\u7f51\u7edc\u7684\u8def\u7531\u8868<\/td><\/tr> -host<\/td> \u5230\u4e00\u4e2a\u4e3b\u673a\u7684\u8def\u7531\u8868<\/td><\/tr> Add<\/td> \u589e\u52a0\u6307\u5b9a\u7684\u8def\u7531\u8bb0\u5f55<\/td><\/tr> Del<\/td> \u5220\u9664\u6307\u5b9a\u7684\u8def\u7531\u8bb0\u5f55<\/td><\/tr> Target<\/td> \u76ee\u7684\u7f51\u7edc\u6216\u76ee\u7684\u4e3b\u673a<\/td><\/tr> gw<\/td> \u8bbe\u7f6e\u9ed8\u8ba4\u7f51\u5173<\/td><\/tr> mss<\/td> \u8bbe\u7f6eTCP\u7684\u6700\u5927\u533a\u5757\u957f\u5ea6\uff08\u5355\u4f4dMB\uff09<\/td><\/tr> window<\/td> \u6307\u5b9a\u901a\u8fc7\u8def\u7531\u8868\u7684TCP\u8fde\u63a5\u7684\u7a97\u53e3\u5927\u5c0f<\/td><\/tr> dev<\/td> \u8def\u7531\u8bb0\u5f55\u6240\u8868\u793a\u7684\u7f51\u7edc\u63a5\u53e3<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n [root@linuxcool ~]# route<\/strong>\r\nKernel IP routing table\r\nDestination Gateway Genmask Flags Metric Ref Use Iface\r\n192.168.10.0 0.0.0.0 255.255.255.0 U 100 0 0 ens160\r\n192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0<\/pre>\n\n\n\n
[root@linuxcool ~]# route add -net 192.168.10.0 netmask 255.255.255.0 dev ens160<\/strong><\/pre>\n\n\n\n
[root@linuxcool ~]# route del -net 192.168.10.0 netmask 255.255.255.0 dev ens160<\/strong><\/pre>\n\n\n\n
[root@linuxcool ~]# route add default gw 192.168.10.1<\/strong>\n[root@linuxcool ~]# route del default gw 192.168.10.1<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"