{"id":3868,"date":"2019-07-21T23:44:25","date_gmt":"2019-07-21T15:44:25","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=3868"},"modified":"2022-06-05T17:23:53","modified_gmt":"2022-06-05T09:23:53","slug":"hostname","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/hostname","title":{"rendered":"hostname\u547d\u4ee4 – \u663e\u793a\u548c\u8bbe\u7f6e\u7cfb\u7edf\u7684\u4e3b\u673a\u540d"},"content":{"rendered":"\n

hostname\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u548c\u8bbe\u7f6e\u7cfb\u7edf\u7684\u4e3b\u673a\u540d\uff0cLinux\u7cfb\u7edf\u4e2d\u7684HOSTNAME\u73af\u5883\u53d8\u91cf\u5bf9\u5e94\u4fdd\u5b58\u4e86\u5f53\u524d\u7684\u4e3b\u673a\u540d\u79f0\uff0c\u4f7f\u7528hostname\u547d\u4ee4\u80fd\u591f\u67e5\u770b\u548c\u8bbe\u7f6e\u6b64\u73af\u5883\u53d8\u91cf\u7684\u503c\uff0c\u800c\u8981\u60f3\u6c38\u4e45\u4fee\u6539\u4e3b\u673a\u540d\u79f0\u5219\u9700\u8981\u4f7f\u7528hostnamectl\u547d\u4ee4\u6216\u76f4\u63a5\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6\/etc\/hostname\u624d\u884c\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>hostname [\u53c2\u6570]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-a<\/td>\u663e\u793a\u4e3b\u673a\u522b\u540d<\/td><\/tr>
-d<\/td>\u663e\u793aDNS\u57df\u540d<\/td><\/tr>
-f<\/td>\u663e\u793aFQDN\u540d\u79f0<\/td><\/tr>
-i<\/td>\u663e\u793a\u4e3b\u673a\u7684ip\u5730\u5740<\/td><\/tr>
-s<\/td>\u663e\u793a\u77ed\u4e3b\u673a\u540d\u79f0<\/td><\/tr>
-y<\/td>\u663e\u793aNIS\u57df\u540d<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u7684\u4e3b\u673a\u540d\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hostname<\/strong>\nlinuxcool.com<\/pre>\n\n\n\n

\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u7684IP\u5730\u5740\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hostname -i<\/strong>\nfe80::4d16:980c:e0fe:51c2%ens160 192.168.10.30 192.168.122.1<\/pre>\n\n\n\n

\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u7684NIS\u57df\u540d\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# hostname -y<\/strong>\nlinuxcool.com<\/pre>\n","protected":false},"excerpt":{"rendered":"

hostname\u547d\u4ee4\u7684\u529f\u80fd\u662f\u7528\u4e8e\u663e\u793a\u548c\u8bbe\u7f6e\u7cfb\u7edf\u7684\u4e3b\u673a\u540d\uff0cLinux\u7cfb\u7edf\u4e2d\u7684HOSTNAME\u73af\u5883\u53d8\u91cf\u5bf9\u5e94\u4fdd\u5b58\u4e86\u5f53 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3868"}],"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=3868"}],"version-history":[{"count":8,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3868\/revisions"}],"predecessor-version":[{"id":10244,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/3868\/revisions\/10244"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=3868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=3868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=3868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}