{"id":1192,"date":"2011-07-24T22:51:08","date_gmt":"2011-07-24T14:51:08","guid":{"rendered":"http:\/\/www.jpuyy.com\/blog\/?p=1192"},"modified":"2012-09-22T14:02:06","modified_gmt":"2012-09-22T06:02:06","slug":"linux-ip-alias","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=1192","title":{"rendered":"ip\u522b\u540d(ip alias)\u8bbe\u7f6e\u548c\u5e94\u7528"},"content":{"rendered":"<h1>A.ip\u522b\u540d(ip alias)\u7684\u8bbe\u7f6e\u548c\u53d6\u6d88<\/h1>\n<p>\u6700\u8fd1\u770b\u5230web\u865a\u62df\u4e3b\u673a\u5b9e\u73b0\u7684\u65b9\u5f0f\u6709\u4e24\u79cd\uff0c\u4e00\u662f\u8bbe\u7f6eip\u522b\u540d \u4e8c\u662f\u5728server{}\u91cc\u8bbe\u7f6e\uff08\u5e38\u7528\uff09<\/p>\n<p>\u6240\u4ee5\u7279\u5730\u6574\u7406\u5b66\u4e60\u4e00\u4e0bip \u522b\u540d\u7684\u8bbe\u7f6e<\/p>\n<p>ip\u522b\u540d(ip alias)\u662fLinux\u5185\u6838\u7684\u4e00\u4e2a\u6807\u51c6\u529f\u80fd<\/p>\n<p>\u8bbe\u7f6e\uff1a<\/p>\n<blockquote><p>#\/sbin\/ifconfig eth0:0 219.219.219.219 broadcast 219.219.219.255 netmask 255.255.255.0 up<\/p><\/blockquote>\n<p>\u68c0\u9a8c\uff1a<\/p>\n<blockquote><p>#\/sbin\/ifconfig<\/p><\/blockquote>\n<p>\u53d6\u6d88\uff1a<\/p>\n<blockquote><p>#ifconfig eth0:0 down<\/p><\/blockquote>\n<p>eth0\u540e\u7684\u53d6\u503c 0~255<\/p>\n<p>\u540e\u9762\u8ddf\u7684ip\u5982\u679c\u662f\u548ceth0\u6240\u5728\u7f51\u7684ip\u540c\u4e00\u7f51\u6bb5\uff0c\u5219\u672c\u7f51\u5185\u5168\u80fdping\u901a<\/p>\n<p>\u5982\u679c\u662f\u4e71\u8ddf\u4e00\u901a\uff0c\u5219\u53ea\u80fd\u672c\u673a\u6d4b\u8bd5\u4e4b\u7528\uff0c\u4e5f\u6ca1\u6709\u591a\u5927\u7684\u610f\u4e49<\/p>\n<h1>B.ip\u522b\u540d(ip alias)\u7684\u5e94\u7528<\/h1>\n<p>1.\u5145\u5206\u5229\u7528\u6709\u9650\u7684\u8d44\u6e90<\/p>\n<p>\u672c\u6765\u4e24\u53f0\u5dee\u52b2\u7684\u7535\u8111\u5206\u522b\u8dd1\u7740\u4e24\u4e2a\u5e94\u7528\uff0cip\u5f53\u7136\u4e0d\u540c<\/p>\n<p>\u6765\u4e86\u4e00\u53f0\u65b0\u7684\u9ad8\u7ea7\u7684\u670d\u52a1\u5668\uff0c\u60f3\u540c\u65f6\u8fc1\u79fb\u8fd9\u4e24\u4e2a\u7a0b\u5e8f\u5230\u8fd9\u53f0\u4e3b\u673a\uff0cip\u522b\u540d\u4fbf\u6d3e\u4e0a\u4e86\u7528\u573a<\/p>\n<p>2.\u670d\u52a1\u4e0d\u95f4\u6bb5<\/p>\n<p>\u4e24\u53f0\u670d\u52a1\u5668\uff0c\u4e3b\u670d\u52a1\u5668\u7684\u63d0\u4f9b\u67d0\u670d\u52a1<\/p>\n<p>\u4e3b\u670d\u52a1\u5668\u4e0d\u7528\u771f\u5b9e\u7684ip\u6765\u63d0\u4f9b\u670d\u52a1<\/p>\n<p>\u5f53\u4e3b\u670d\u52a1\u5668\u574f\u4e86\u65f6\u5019\uff0c\u526f\u670d\u52a1\u5668\u53ef\u4ee5\u76f4\u63a5ip\u522b\u540d\u8bbe\u7f6e\u597d\u9876\u4e0a\u6765<\/p>\n<p>&nbsp;<\/p>\n<p>\u5728\u6dd8\u5b9d\u4e70\u4e86\u4e00\u4e2a\u5dee\u52b2\u7684vps<\/p>\n<p>ifconfig \u4ee5\u540e\u53d1\u73b0ip\u522b\u540d\uff1a<\/p>\n<blockquote><p>venet0\u00a0\u00a0\u00a0 Link encap:UNSPEC\u00a0 HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00<br \/>\nUP BROADCAST POINTOPOINT RUNNING NOARP\u00a0 MTU:1500\u00a0 Metric:1<br \/>\nRX packets:1352 errors:0 dropped:0 overruns:0 frame:0<br \/>\nTX packets:1860 errors:0 dropped:0 overruns:0 carrier:0<br \/>\ncollisions:0 txqueuelen:0<br \/>\nRX bytes:102537 (100.1 KiB)\u00a0 TX bytes:1380885 (1.3 MiB)<\/p>\n<p>venet0:0\u00a0 Link encap:UNSPEC\u00a0 HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00<br \/>\ninet addr:178.17.162.219\u00a0 P-t-P:178.17.162.219\u00a0 Bcast:0.0.0.0\u00a0 Mask:255.255.255.255<br \/>\nUP BROADCAST POINTOPOINT RUNNING NOARP\u00a0 MTU:1500\u00a0 Metric:1<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>A.ip\u522b\u540d(ip alias)\u7684\u8bbe\u7f6e\u548c\u53d6\u6d88 \u6700\u8fd1\u770b\u5230web\u865a\u62df\u4e3b\u673a\u5b9e\u73b0\u7684\u65b9\u5f0f\u6709\u4e24\u79cd\uff0c\u4e00\u662f\u8bbe\u7f6eip\u522b\u540d \u4e8c\u662f\u5728server{}\u91cc\u8bbe\u7f6e\uff08\u5e38\u7528\uff09 \u6240\u4ee5\u7279\u5730\u6574\u7406\u5b66\u4e60\u4e00\u4e0bip \u522b\u540d\u7684\u8bbe\u7f6e ip\u522b\u540d(ip alias)\u662fLinux\u5185\u6838\u7684\u4e00\u4e2a\u6807\u51c6\u529f\u80fd \u8bbe\u7f6e\uff1a #\/sbin\/ifconfig eth0:0 219.219.219.219 broadcast 219.219.219.255 netmask 255.255.255.0 up \u68c0\u9a8c\uff1a #\/sbin\/ifconfig \u53d6\u6d88\uff1a #ifconfig eth0:0 down eth0\u540e\u7684\u53d6\u503c 0~255 \u540e\u9762\u8ddf\u7684ip\u5982\u679c\u662f\u548ceth0\u6240\u5728\u7f51\u7684ip\u540c\u4e00\u7f51\u6bb5\uff0c\u5219\u672c\u7f51\u5185\u5168\u80fdping\u901a \u5982\u679c\u662f\u4e71\u8ddf\u4e00\u901a\uff0c\u5219\u53ea\u80fd\u672c\u673a\u6d4b\u8bd5\u4e4b\u7528\uff0c\u4e5f\u6ca1\u6709\u591a\u5927\u7684\u610f\u4e49 B.ip\u522b\u540d(ip alias)\u7684\u5e94\u7528 1.\u5145\u5206\u5229\u7528\u6709\u9650\u7684\u8d44\u6e90 \u672c\u6765\u4e24\u53f0\u5dee\u52b2\u7684\u7535\u8111\u5206\u522b\u8dd1\u7740\u4e24\u4e2a\u5e94\u7528\uff0cip\u5f53\u7136\u4e0d\u540c \u6765\u4e86\u4e00\u53f0\u65b0\u7684\u9ad8\u7ea7\u7684\u670d\u52a1\u5668\uff0c\u60f3\u540c\u65f6\u8fc1\u79fb\u8fd9\u4e24\u4e2a\u7a0b\u5e8f\u5230\u8fd9\u53f0\u4e3b\u673a\uff0cip\u522b\u540d\u4fbf\u6d3e\u4e0a\u4e86\u7528\u573a 2.\u670d\u52a1\u4e0d\u95f4\u6bb5 \u4e24\u53f0\u670d\u52a1\u5668\uff0c\u4e3b\u670d\u52a1\u5668\u7684\u63d0\u4f9b\u67d0\u670d\u52a1 \u4e3b\u670d\u52a1\u5668\u4e0d\u7528\u771f\u5b9e\u7684ip\u6765\u63d0\u4f9b\u670d\u52a1 \u5f53\u4e3b\u670d\u52a1\u5668\u574f\u4e86\u65f6\u5019\uff0c\u526f\u670d\u52a1\u5668\u53ef\u4ee5\u76f4\u63a5ip\u522b\u540d\u8bbe\u7f6e\u597d\u9876\u4e0a\u6765 &nbsp; \u5728\u6dd8\u5b9d\u4e70\u4e86\u4e00\u4e2a\u5dee\u52b2\u7684vps ifconfig \u4ee5\u540e\u53d1\u73b0ip\u522b\u540d\uff1a venet0\u00a0\u00a0\u00a0 Link encap:UNSPEC\u00a0 HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 UP BROADCAST POINTOPOINT RUNNING NOARP\u00a0 MTU:1500\u00a0 Metric:1 RX packets:1352 errors: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":[23],"class_list":["post-1192","post","type-post","status-publish","format-standard","hentry","category-linux","tag-summary"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1192","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=1192"}],"version-history":[{"count":15,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1192\/revisions"}],"predecessor-version":[{"id":3594,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/1192\/revisions\/3594"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}