Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: localhost and hostname

  1. #1
    Join Date
    Jun 2014
    Beans
    23

    Question localhost and hostname

    Hello guys ..well i'm having a problem with localhost and hostname i don't need my hostname to be the localhost .. how do i make sure of that?
    Last edited by sandyd; August 27th, 2014 at 06:52 PM. Reason: font

  2. #2
    Join Date
    Feb 2007
    Location
    /home/paris
    Beans
    690
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: localhost and hostname

    Hi,

    We have a nice question but without any idea of how to help.

    What exactly are you trying to do ?? ... however, in an attempt to help...

    If you are running a local web server (apache / nginx etc)

    then in your web browser you should be able to put either
    http://localhost
    http://127.0.0.1

    If you have a server somewhere, that has a specific hostname, and this tallies up with the hostname of the computer, then you should also be the name of this computer in your browser to get the basic web page.

    If you are on a pc at home, you may not be able to use the name of your computer to connect to it unless you have it in a local DNS.


    ____________
    give us some more info, and we may be able to be more specific.

    David
    Eee pc via Wubi install.
    evertying works straight out of the box

    My Launchpad page

  3. #3
    Join Date
    Apr 2011
    Location
    3rd Rock from the Sun
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: localhost and hostname

    You will have to add it yourself, read the link for more: http://askubuntu.com/questions/87665...hout-a-restart
    "Evolution is Nature's way of issuing upgrades."


  4. #4
    Join Date
    Sep 2007
    Location
    Oklahoma, USA
    Beans
    2,309
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: localhost and hostname

    Quote Originally Posted by engineer2 View Post
    Hello guys ..well i'm having a problem with localhost and hostname i don't need my hostname to be the localhost .. how do i make sure of that?
    They are not the same, although in anyone's case they certainly appear to be. Think of the difference between your "legal name" by which the world knows you, and the simple word "me." Everyone refers to themselves as "me" but for the world, your name is not "me."

    Similarly, the hostname of a machine is the name by which it's known to the world at large (at least, if it lets the world know its hostname). However, "localhost" is the machine's equivalent of "me" and always refers to the machine on which it's used. When I use "localhost" here it means the machine on which I'm typing. When you use it, it's the machine on which you are typing. My hostname on this machine is "mehitabel" and if you were to refer to "mehitabel" (and if I had made the hostname globally known) it would refer to my machine, not yours.

    Thus the two names are already always different to the outside world, although they do refer to the same machine on the inside.
    --
    Jim Kyle in Oklahoma, USA
    Linux Counter #259718
    Howto mark thread: https://wiki.ubuntu.com/UnansweredPo.../SolvedThreads

  5. #5
    Join Date
    Jun 2014
    Beans
    23

    Re: localhost and hostname

    i'm trying to install a software (grid engine) and of the points i need to be aware to successfull installation is that "change the hostname so that it wouldn't be the local host" so i didn't understand what is this exactly or how to do it ...
    here is /etc/hosts :

    Code:
    root@gridmaster:/home/gmaster# cat /etc/hosts
    172.0.0.1    localhost
    192.168.88.235    gridmaster
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters

    and the other thing is that whenever i try to ping <hostname> i've got this :
    Code:
    root@gridmaster:/home/gmaster# ping gridmaster
    PING gridmaster (192.168.88.235) 56(84) bytes of data.
    From 10.10.10.1 icmp_seq=1 Packet filtered
    From 10.10.10.1 icmp_seq=2 Packet filtered
    From 10.10.10.1 icmp_seq=3 Packet filtered
    From 10.10.10.1 icmp_seq=4 Packet filtered
    ^CFrom 10.10.10.1 icmp_seq=5 Packet filtered
    
    --- gridmaster ping statistics ---
    5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 20052ms
    i have to write hostname.local :
    Code:
    root@gridmaster:/home/gmaster# ping gridmaster.local
    PING gridmaster.local (192.168.2.4) 56(84) bytes of data.
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=1 ttl=64 time=0.047 ms
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=2 ttl=64 time=0.047 ms
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=3 ttl=64 time=0.038 ms
    ^C
    --- gridmaster.local ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2001ms
    rtt min/avg/max/mdev = 0.038/0.044/0.047/0.004 ms
    but i need to remove that .local
    Last edited by engineer2; August 27th, 2014 at 05:34 PM.

  6. #6
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,228
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: localhost and hostname

    What is the output of "ifconfig"? It seems this is not a hostname issue but a network issue.
    "I learned a lot from repeatedly breaking my system and then reinstalling. Oh, and a lot of GOOGLE searches too!"
    The best Ubuntu derivative: Linux Mint
    Relax. Head to the Community Cafe
    The Philippine Team

  7. #7
    Join Date
    Nov 2008
    Location
    S.H.I.E.L.D. 6-1-6
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: localhost and hostname

    Quote Originally Posted by engineer2 View Post
    i'm trying to install a software (grid engine) and of the points i need to be aware to successfull installation is that "change the hostname so that it wouldn't be the local host" so i didn't understand what is this exactly or how to do it ...
    here is /etc/hosts :

    Code:
    root@gridmaster:/home/gmaster# cat /etc/hosts
    172.0.0.1    localhost
    192.168.88.235    gridmaster
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters

    and the other thing is that whenever i try to ping <hostname> i've got this :
    Code:
    root@gridmaster:/home/gmaster# ping gridmaster
    PING gridmaster (192.168.88.235) 56(84) bytes of data.
    From 10.10.10.1 icmp_seq=1 Packet filtered
    From 10.10.10.1 icmp_seq=2 Packet filtered
    From 10.10.10.1 icmp_seq=3 Packet filtered
    From 10.10.10.1 icmp_seq=4 Packet filtered
    ^CFrom 10.10.10.1 icmp_seq=5 Packet filtered
    
    --- gridmaster ping statistics ---
    5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 20052ms
    i have to write hostname.local :
    Code:
    root@gridmaster:/home/gmaster# ping gridmaster.local
    PING gridmaster.local (192.168.2.4) 56(84) bytes of data.
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=1 ttl=64 time=0.047 ms
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=2 ttl=64 time=0.047 ms
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=3 ttl=64 time=0.038 ms
    ^C
    --- gridmaster.local ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2001ms
    rtt min/avg/max/mdev = 0.038/0.044/0.047/0.004 ms
    but i need to remove that .local
    What is the IP Address of the computer on the network? You can find that by running ifconfig(Note, I dont know what this is, so in the below info, it will be shown as <ipaddress>)

    Is it static? (It should be).

    In /etc/hosts, remove
    Code:
    192.168.88.235    gridmaster
    add
    Code:
    <ipaddress> gridmaster
    Last edited by sandyd; August 27th, 2014 at 06:58 PM.
    Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.

  8. #8
    Join Date
    Sep 2007
    Location
    Oklahoma, USA
    Beans
    2,309
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: localhost and hostname

    Quote Originally Posted by engineer2 View Post
    i'm trying to install a software (grid engine) and of the points i need to be aware to successfull installation is that "change the hostname so that it wouldn't be the local host" so i didn't understand what is this exactly or how to do it ...
    here is /etc/hosts :

    Code:
    root@gridmaster:/home/gmaster# cat /etc/hosts
    172.0.0.1    localhost
    192.168.88.235    gridmaster
    
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters

    and the other thing is that whenever i try to ping <hostname> i've got this :
    Code:
    root@gridmaster:/home/gmaster# ping gridmaster
    PING gridmaster (192.168.88.235) 56(84) bytes of data.
    From 10.10.10.1 icmp_seq=1 Packet filtered
    From 10.10.10.1 icmp_seq=2 Packet filtered
    From 10.10.10.1 icmp_seq=3 Packet filtered
    From 10.10.10.1 icmp_seq=4 Packet filtered
    ^CFrom 10.10.10.1 icmp_seq=5 Packet filtered
    
    --- gridmaster ping statistics ---
    5 packets transmitted, 0 received, +5 errors, 100% packet loss, time 20052ms
    i have to write hostname.local :
    Code:
    root@gridmaster:/home/gmaster# ping gridmaster.local
    PING gridmaster.local (192.168.2.4) 56(84) bytes of data.
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=1 ttl=64 time=0.047 ms
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=2 ttl=64 time=0.047 ms
    64 bytes from gridmaster.local (192.168.2.4): icmp_req=3 ttl=64 time=0.038 ms
    ^C
    --- gridmaster.local ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2001ms
    rtt min/avg/max/mdev = 0.038/0.044/0.047/0.004 ms
    but i need to remove that .local
    If you change the line in /etc/hosts that I emphasized above so that the address of 88.235 becomes 2.4 as in the final ping example, that should do the trick for you.

    The ".local" is added by the search algorithm and really has no connection to the "localhost" name. It comes from "avahi" which is invoked by the name-lookup process if the higher-priority searches fail. Once you correct the entry in the /etc/hosts file, it should take precedence and everything should work as you expect.

    I'm assuming, from your examples, that the second ping example actually does show the correct address. The request by nerdtron for the result of "sudo ifconfig -a" will show the actual address...

    EDIT: Incidentally, the first line of the hosts file should begin with "127" rather than "172" or many other programs will go crazy. This could be a typo if you manually re-typed the output, but if it's a screen capture you need to be sure and correct it!
    Last edited by JKyleOKC; August 27th, 2014 at 07:04 PM. Reason: Added caution.
    --
    Jim Kyle in Oklahoma, USA
    Linux Counter #259718
    Howto mark thread: https://wiki.ubuntu.com/UnansweredPo.../SolvedThreads

  9. #9
    Join Date
    Jun 2014
    Beans
    23

    Re: localhost and hostname

    the ip address is static
    and this is the ifconfig output :
    Code:
    eth0      Link encap:Ethernet  HWaddr 20:1a:06:5e:b9:e8  
              inet addr:192.168.88.235  Bcast:192.168.88.255  Mask:255.255.255.0
              inet6 addr: fe80::221a:6ff:fe5e:b9e8/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:13859 errors:0 dropped:0 overruns:0 frame:0
              TX packets:16486 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:2841117 (2.8 MB)  TX bytes:8712291 (8.7 MB)
    
    eth1      Link encap:Ethernet  HWaddr 80:56:f2:fa:08:c9  
              inet addr:192.168.2.4  Bcast:192.168.2.255  Mask:255.255.255.0
              inet6 addr: fe80::8256:f2ff:fefa:8c9/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:12832 errors:7 dropped:0 overruns:0 frame:21575
              TX packets:15900 errors:101 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:6436256 (6.4 MB)  TX bytes:6288493 (6.2 MB)
              Interrupt:17 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:5344 errors:0 dropped:0 overruns:0 frame:0
              TX packets:5344 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:528302 (528.3 KB)  TX bytes:528302 (528.3 KB)

    where did 192.168.2.4 came from???
    can i get rid of it and keep 192.168.88.235 only??

  10. #10
    Join Date
    Sep 2007
    Location
    Oklahoma, USA
    Beans
    2,309
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: localhost and hostname

    Well, you definitely have a network problem here. Most systems have only one network adapter but you have two. My own has four, although two are unused -- one of the two active ones is connected to the router furnished by my ISP, while the other connects to the switch for my little LAN. I suspect from your report that your setup might be somewhat similar, but we can't give much help until you tell us a bit more about the setup.

    The 192.168.2.4 address may have been assigned automatically by some program at the other end of the cable plugged into the RJ-45 jack of eth1, if you did not assign it manually. That's a different subnet from the one that includes 192.168.88.235; the first two numbers in these addresses indicate a local network (including all addresses from 192.168.0.0 to 192.168.255.255) and the third number (2 or 88) indicates a subnet of that network. The network software normally prevents subnets from communicating with each other, so it's necessary to know what's at the other end of the wire when trying to troubleshoot the situation.

    My best guess at this point is that your 88.235 address is connected to a router or modem and is getting that address from your ISP, while the 2.4 address is the address of your specific machine on the LAN. However that's only a guess in the absence of more detailed information...

    I'm not familiar with the term "grid engine" but it could be something like my setup, which I call a "software router" in which all traffic from the WAN comes into this machine, and software in this one then forwards it through the other adapter to the rest of my LAN. This lets me implement all security needs in just one machine, where things connect to the outside world, and keeps it all under my control rather than being handled by somebody else's design and rules in a hardware router...
    Last edited by JKyleOKC; August 27th, 2014 at 11:08 PM.
    --
    Jim Kyle in Oklahoma, USA
    Linux Counter #259718
    Howto mark thread: https://wiki.ubuntu.com/UnansweredPo.../SolvedThreads

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •