Find the answer to your Linux question:
Results 1 to 4 of 4
How should this file look like? At the moment it looks as follows: Code: 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 I've got a few questions regarding ...
  1. #1
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    100

    /etc/hosts

    How should this file look like?

    At the moment it looks as follows:
    Code:
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    I've got a few questions regarding this file.
    1. Aren't there too many 'localhosts'?
    2. Can I replace 127.0.0.1 with 192.168.1.100 (static IP of this box on my LAN)?
    3. Also, where would I add 'revora' - the host name of this computer that I specified during the installation of Fedora?
    4. What's ::1?
    5. I've bought a domain name which now points to my IP address. I haven't finished a website yet, but in a few weeks time I'll start hosting my website. At the moment it's only ftp that works with that domain.
    When would I want to replace localdomain with my domain name? In which situations would it be necessary/useful?

    Thanks in advance

  2. #2
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,114
    1. Aren't there too many 'localhosts'?
    It does look a little unusual, but there's no harm in it. Each name is
    just an alias for the loopback address. Ping any one of those
    addresses and you ping yourself. The first line is the traditional
    IPv4 style address, and the second is IPv6

    2. Can I replace 127.0.0.1 with 192.168.1.100 (static IP of this box on my LAN)?
    Best not to, there is a subtle difference between the loopback
    and the IP that is bound to an ethernet interface.
    Set the 192.168.1.100 address to the host name.

    3. Also, where would I add 'revora' - the host name of this computer that I specified during the installation of Fedora?
    192.168.1.100

    4. What's ::1?
    That's your loopback address in IPv6 notation.


    5. I've bought a domain name which now points to my IP address. I haven't finished a website yet, but in a few weeks time I'll start hosting my website. At the moment it's only ftp that works with that domain.
    When would I want to replace localdomain with my domain name? In which situations would it be necessary/useful?
    This will depend on whether you or someone else is handling DNS
    for your domain. If someone else handles it (typically whoever
    sold you the domain, or maybe your own internet provider)
    They would have a name server that directs your domain
    traffic to your IP address (assuming you have a static address)
    If you handle it yourself you would need to run a name server
    and have a static address.

    If you only have a dynamic address, there is a way to direct traffic to your address. It requires a service like dyndns

    If external users can already reach your address by domain name,
    you could go ahead and put it in to replace "localdomain"

    Anyway, your /etc/hosts file doesn't affect how others connect to you, but how your machine resolves those
    names in the hosts file. It is there for your use.

  3. #3
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    100
    Thanks for your reply.

    Set the 192.168.1.100 address to the host name.
    How would I do it?
    Code:
    192.168.1.100   revora
    in /etc/hosts?
    This will depend on whether you or someone else is handling DNS
    for your domain. If someone else handles it (typically whoever
    sold you the domain, or maybe your own internet provider)
    They would have a name server that directs your domain
    traffic to your IP address (assuming you have a static address)
    If you handle it yourself you would need to run a name server
    and have a static address.

    If you only have a dynamic address, there is a way to direct traffic to your address. It requires a service like dyndns

    If external users can already reach your address by domain name,
    you could go ahead and put it in to replace "localdomain"
    I use zoneedit.com for dns. So if someone types my domain name, they get directed to my router (I did some port forwarding on it). I don't have a REAL static IP, it changes once every 7-8 months so I kind of treat it as static and once I notice any change I update it on zoneedit.com. So as far as I understand your explanation, I can replace 'localhost' with my domain. Is that correct? Where would I do it? In /etc/hosts? Or anywhere else? Assuming that a LAN ip of this computer is 192.168.1.100, the box is called 'revora' and the domain name is eg. mydomain.com. How would an entry in /etc/hosts look like?

    Thank you
    I do appreciate your help.

  4. #4
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,114
    192.168.1.100 revora
    That's correct, or you could make it revora dot your domain
    If you want other computers on your LAN to find this one, their
    hosts files will need these entries. As you said, DNS is
    already set up so that people on the internet can find you.

Posting Permissions

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