红联Linux门户
Linux帮助

hostname和host有什么用?

发布时间:2010-10-07 21:32:24来源:红联作者:buxiangshui
大家好,

linux新手,

请问hostname有什么用啊,

比如
[root@test root]#ping 127.0.0.1
[root@test root]#ping localhost
都可以ping通

那为什么
[root@test root]#ping test
显示:
ping:unknown host test呢,

也就是用hostname有什么用呢?
在线等。。。。。
文章评论

共有 7 条评论

  1. wywrw0512 于 2010-11-01 16:26:02发表:

    非常的好用

  2. buxiangshui 于 2010-10-09 09:49:41发表:

    不错,感谢:0)1

    那有这种说法么:halt需要人工关闭电源。

  3. 相思爱文 于 2010-10-08 21:33:34发表:

    [i=s] 本帖最后由 相思爱文 于 2010-10-8 21:35 编辑 [/i]

    引用:
    .halt和poweroff有区别么?
    buxiangshui 发表于 2010-10-7 23:47


    运行
    ls -l /sbin/halt /sbin/poweroff
    可知poweroff是halt的软链接

    shutdown关机,会通知所有登录者,还可廷时
    最后init 0


    具体可用
    man 命令
    查看

  4. buxiangshui 于 2010-10-07 23:47:46发表:

    我用的是RH9呢

  5. buxiangshui 于 2010-10-07 23:47:19发表:

    呵呵,

    用hostname更改了不行,

    后来更改了文件/etc/hosts,增加一行后可以了:

    192..168.0.103 test.localdomain test

    这样可以ping通了。

    非常感谢回帖。

    顺便再问个问题:halt和poweroff有区别么?一个关机怎么有这么多命令啊。PS:shutdown -h now

  6. 相思爱文 于 2010-10-07 23:21:25发表:

    echo $HOSTNAME
    显示什么

  7. 相思爱文 于 2010-10-07 23:20:14发表:

    我可以啊
    hcc@debian:~$ ping 127.0.0.1
    PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
    64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.063 ms
    64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.051 ms
    64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.053 ms
    64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.051 ms
    64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.052 ms
    ^C
    --- 127.0.0.1 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 3999ms
    rtt min/avg/max/mdev = 0.051/0.054/0.063/0.004 ms
    hcc@debian:~$ ping debian
    PING debian (192.168.1.110) 56(84) bytes of data.
    64 bytes from debian (192.168.1.110): icmp_seq=1 ttl=64 time=0.051 ms
    64 bytes from debian (192.168.1.110): icmp_seq=2 ttl=64 time=0.046 ms
    64 bytes from debian (192.168.1.110): icmp_seq=3 ttl=64 time=0.052 ms
    64 bytes from debian (192.168.1.110): icmp_seq=4 ttl=64 time=0.053 ms
    64 bytes from debian (192.168.1.110): icmp_seq=5 ttl=64 time=0.051 ms
    64 bytes from debian (192.168.1.110): icmp_seq=6 ttl=64 time=0.052 ms
    ^C
    --- debian ping statistics ---
    6 packets transmitted, 6 received, 0% packet loss, time 4998ms
    rtt min/avg/max/mdev = 0.046/0.050/0.053/0.009 ms
    hcc@debian:~$