Configuring hostname, domainname, and IP address

Discussion in 'Linux Networking' started by linuxquestion, Jan 2, 2004.

  1. linuxquestion

    P.T. Breuer Guest

    The canonical name for 127.0.0.1 should be "localhost"
    (or possibly localhost.localdomain, but the difference is obscured by
    redhats mess-up on that theme).
    What's wrong is that if he defines his hostname as "localhost" (via
    "hostname localhost"), then the domainname that will be deduced for it
    is "testrac.com", because the canonical name on the hosts line is
    "red.testrac.com". So the FQDN derived for his machine is
    "localhost.testrac.com", which does not appear in any of his
    name/address translation databses.

    This may kill anything which attempts to do a reverse lookup of the
    name on his machine to an IP address, such as sendmail.

    He can solve that problem by making sure he does a "hostname red"
    instead!
    It's asking for trouble. Indeed, I wouldn't put anything but

    127.0.0.1 localhost (plus aliases)

    as localhost is in the root domain! Check your local dns zone files for
    127.in.addr-arpa!
    This will cause all things to become sweet and docile on a RH-based
    distro's bootup.
    Yo, mama.
    Well, it doesn't - it requires dns running on each machine at a very
    early stage in order that the machine be able to canonicalize its own
    name via the net! And try disconnecting the cable and see what happens
    at boot!

    But it is usual to run dns - you just find out that you should have
    been editing /etc/hosts too when the network fails and you try booting
    and X or sendmail hangs ..
    The normal order in host.conf these days is "files bind nis" (approx).

    Peter
     
    P.T. Breuer, Jan 3, 2004
    #21
    1. Advertisements

  2. May I ask why you are giving your machine's loopback address a name other
    than localhost.localdomain?

    And may I ask all respondents who suggested doing so the same question?

    AFAIK, the operating system itself requires a loopback network, the address
    of which is traditionally 127.0.0.1. It serves no other purpose than to
    allow software to interact with the os via ports on that network. Or do I
    not understand this matter? Please advise!

    Thanks,

    Bill Tallman
     
    William D. Tallman, Jan 4, 2004
    #22
    1. Advertisements

  3. linuxquestion

    Baho Utot Guest

    But he isn't defining the hostname as localhost, He pick red remember?
    That makes the domain name testrac.com and the canonical name then
    red.testrac.com. "Remember YOU said IF".
    Yes that is what he wanted. Hostname red
    Why I don't have one.
    Well he is using RH
    Ok, dhcp times out and then the machine continues and every thing is just
    fine. Except that is you can't access anything on the network, but the
    machine still functions.
    I haven't had X hang on me but sendmail sure.
    Yes, so it looks at hosts first.
     
    Baho Utot, Jan 4, 2004
    #23
  4. When you did the install did it ask you about the network setup?

    In the meantime run the redhat-config-network application and try to
    configure a new ethernet device using "Intel EtherExpress Pro 100B" as
    the adapter type.

    It that fails then try the following commands and let me know the output:
    ethtool -i eth0
    lsmod
     
    Charles LaCour, Jan 4, 2004
    #24
  5. mine is called /etc/sysconfig/network-scripts/ifcfg-eth0

    [ok, so it's an old versn of RH] What does:

    $ ls /etc/sysconfig/network-scripts

    give?
     
    Robert Newson, Jan 4, 2004
    #25
  6. Oops, your correct I forgot the "ifcfg-" on the file name.
     
    Charles LaCour, Jan 4, 2004
    #26
  7. linuxquestion

    Eric Guest

    Thats why your name (Baho Utot) eh? Not many people will get that one.
     
    Eric, Jan 6, 2004
    #27
  8. linuxquestion

    Baho Utot Guest

    Oh come on now, But YOU do know why don't you.;)
     
    Baho Utot, Jan 7, 2004
    #28
  9. Ok, I've got it working. This is what I did.

    The fundamental problem was not going to be
    solved by tweaking the hosts file. It was that
    the ethernet drivers were not installed. Hmm.
    Why the installation missed them, I don't know.

    I downloaded the ethernet drivers specific for my
    motherboard from intel: e100-2.3.33.tar.gz,
    and installed it, using:
    make install

    I could then run a few commands to configure the
    network on the fly.

    insmod e100

    ifconfig eth0 10.0.0.1

    route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    10.0.0.0 * 255.0.0.0 U 0 0 0 eth0
    127.0.0.0 * 255.0.0.0 U 0 0 0 lo

    -----------

    When I rebooted (shutup), /usr/sbin/kudzu came up.
    It is a character based configuration tool for
    new hardware. It prompted me for a few parameters
    and then filled in the rest.

    Everything seems fine now. The file ifcfg-eth0,
    now exists in three places.

    /etc/sysconfig/network-scripts/ifcfg-eth0: ASCII text
    /etc/sysconfig/networking/devices/ifcfg-eth0: ASCII text
    /etc/sysconfig/networking/profiles/default/ifcfg-eth0: ASCII text

    and all have the same content:

    cat /etc/sysconfig/network-scripts/ifcfg-eth0

    DEVICE=eth0
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR=10.0.0.1
    NETMASK=255.0.0.0
    GATEWAY=10.255.255.254


    cat /etc/resolv.conf
    nameserver 10.0.0.1


    route

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    10.0.0.0 * 255.0.0.0 U 0 0 0 eth0
    127.0.0.0 * 255.0.0.0 U 0 0 0 lo
    default 10.255.255.254 0.0.0.0 UG 0 0 0 eth0


    And, the machine can find itself as the IP address
    that I assigned.

    ping -c 1 10.0.0.1
    PING 10.0.0.1 (10.0.0.1) from 10.0.0.1 : 56(84) bytes of data.
    64 bytes from 10.0.0.1: icmp_seq=0 ttl=255 time=18 usec

    --- 10.0.0.1 ping statistics ---
    1 packets transmitted, 1 packets received, 0% packet loss
    round-trip min/avg/max/mdev = 0.018/0.018/0.018/0.000 ms


    I'm sure that this one node network can be tweaked
    better yet, but I'm glad to get the fundamentals working.

    The now minor subject, how to config the /etc/hosts file,
    seems to be a matter of preference. Depending on where
    the hostname is listed first, a ping will return that IP address.
    However, editing the host file did not solve the original
    question of how to assign the local IP address.

    I hope that others will post their solutions once
    they are discovered, with specific commands and syntax
    as I have done here.

    Thanks for all your help.
     
    linuxquestion, Jan 7, 2004
    #29
  10. linuxquestion

    Garry Knight Guest

    I use netconf to do this in Mandrake 9.1. I believe it's also part of the
    Red Hat distribution.
     
    Garry Knight, Jan 8, 2004
    #30
  11. linuxquestion

    Bill Unruh Guest

    ] wrote:

    ]> However, editing the host file did not solve the original
    ]> question of how to assign the local IP address.

    The IP address is associated with a particular interface, not with the
    machine. Ie, if you have five ethernet cards, each can have a different
    IP address.

    /etc/sysconfig/network-script/ifcfg-eth0
    is where the info for the first ethernet card goes.
     
    Bill Unruh, Jan 8, 2004
    #31

  12. your ip addresses will be set with ifconfig not /etc/hosts

    --
    Respectfully,


    CL Gilbert

    "Verily, verily, I say unto you, He that entereth not by the door() into
    the sheepfold{}, but climbeth up some other *way, the same is a thief
    and a robber." John 10:1

    GnuPG Key Fingerprint:
    82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

    For a free Java interface to Freechess.org see
    http://www.rigidsoftware.com/Chess/chess.html
     
    CL (dnoyeB) Gilbert, Jan 8, 2004
    #32
  13. linuxquestion

    Brad Olin Guest

    This example is the traditional /etc/hosts config. The hosts file only
    helps to documents what IPs have been assigned, it doesn't actually
    assign them.


    127.0.0.1 localhost.localdomain localhost
    10.0.0.1 red.testrac.com red
    10.0.0.2 white.testrac.com white


    Brad
    --
    "From childhood's hour I have not been as others were...
    I have not seen as others saw." Edgar Allen Poe

    Bradley W. Olin
    http://www.bwo1.com
     
    Brad Olin, Jan 8, 2004
    #33
  14. linuxquestion

    Garry Knight Guest

    But it's not *just* for documentation. If your /etc/host.conf has this:
    order hosts,bind
    then name lookups will consult /etc/hosts before passing a request onto a
    DNS server.
     
    Garry Knight, Jan 8, 2004
    #34
  15. linuxquestion

    Carl Guest

    yet if the hosts file only contains the default entry, your computer
    will function as normal. Just like windows has its own hosts file that
    serves the same purpose but nobody every modifies it.

    this just speeds up the dns process, plus it helps when you are in a
    NATted setup or have no DNS names for your computers. it allows you to say

    ping erasmus

    but thats really no big deal, and in fact I'd rather do without
    duplicating the same information on each computer, its bad practice to me.



    cl
     
    Carl, Jan 8, 2004
    #35
  16. linuxquestion

    Brad Olin Guest

    Wrong. The hosts file is just documentation, which may or may not be
    accurate. The hosts file is NOT authoritative and is only used by the
    local box.

    What you are saying is that if you put yahoo.com (for example) in your
    hosts file that you are doing something more than documenting that entry
    to yourself.

    I grant you that you can make your system think differently than the
    authoritative DNS servers, but it is only your foot you are shooting,
    not anybody else's.


    Brad
    --
    "From childhood's hour I have not been as others were...
    I have not seen as others saw." Edgar Allen Poe

    Bradley W. Olin
    http://www.bwo1.com
     
    Brad Olin, Jan 9, 2004
    #36
  17. linuxquestion

    Brad Olin Guest

    Wrong. The hosts file is just documentation, which may or may not be
    accurate. The hosts file is NOT authoritative and is only used by the
    local box.

    What you are saying is that if you put yahoo.com (for example) in your
    hosts file that you are doing something more than documenting that entry
    to yourself.

    I grant you that you can make your system think differently than the
    authoritative DNS servers, but it is only your foot you are shooting,
    not anybody else's.


    Brad
    --
    "From childhood's hour I have not been as others were...
    I have not seen as others saw." Edgar Allen Poe

    Bradley W. Olin
    http://www.bwo1.com
     
    Brad Olin, Jan 9, 2004
    #37
  18. linuxquestion

    Bit Twister Guest

    Can you hear what you are typing. You just proved the point, that the
    hosts file is used for lookup and not "just documentation".

    The argument is not about authoritative. it's about
    your comment that /etc/hosts is *just* for documentation.
     
    Bit Twister, Jan 9, 2004
    #38
  19. linuxquestion

    Garry Knight Guest

    Yes, that's what I meant.
    Never claimed it was. Perhaps I should have worded it better: "...name
    lookups on your PC...".
     
    Garry Knight, Jan 10, 2004
    #39
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.