Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Two linux (Redhat) computers are connected to an ordinary DSL router which runs DHCP service. A router dynamically assigns 192.168.1.64 IP address to the first computer (hostname DENVER). And another ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8

    Ping by Hostname


    Two linux (Redhat) computers are connected to an ordinary DSL router which runs DHCP service.
    A router dynamically assigns 192.168.1.64 IP address to the first computer (hostname DENVER). And another machine (hostname DALLAS) is assigned 192.168.1.65.
    The router's settings (site accessed via 192.168.1.1) shows both of those computers listed with their corresponding hostnames and IP addresses:

    Connection Type: Ethernet
    PC Name: DALLAS
    IP Address: 192.168.1.64
    MAC Address: 00:19:d1:9f:8d:52


    Connection Type: Ethernet
    PC Name: DENVER
    IP Address: 192.168.1.65
    MAC Address: 00:1b:63:ac:45:df




    I can ping both machines using their corresponding IP addresses: "ping 192.168.1.64" and "ping 192.168.1.65". That works great.
    The problem occurs when I try to ping them using their hostnames instead of their ip addresses. They even don't respond to PING command if I ping the machine with its own name!
    I went ahead and "hard coded" (typed) the combination of host names and their ip addresses into the each computer's /etc/hosts configuration files:

    192.168.1.64 DENVER.mynetwork DALLAS
    192.168.1.65 DALLAS.mynetwork DENVER

    To my surprise that fixed one computer. But only one computer.... another is still not reachable by hostname.
    I forgot to mention that both computers running a very basic fresh all-by- default Redhat Linux install... meaning no dns servers or dhcp servers or other additional servers or services were installed yet.... Should I stop using DSL Router's DHCP server? Should I instead install Linux's DHCP server on one of the computers and run DHCP server on a computer?
    Thanks in advance for any suggestions!

  2. #2
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8
    Spent several hours searching the forum on this subject.
    Looks like it is quite common problem.
    Many people suggest to tweak /etc/resolv.conf file... but how?

  3. #3
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Post the output from the following from both machine:

    hosts
    resolv.conf
    host.conf

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  4. #4
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8
    /etc/hosts

    computer with a hostname DALLAS:
    =======================================
    127.0.0.1 localhost.localdomain localhost
    192.168.1.64 DALLAS.twosdomain DALLAS
    192.168.1.65 DENVER.twosdomain DENVER


    computer with a hostname DENVER:
    =======================================
    127.0.0.1 localhost.localdomain localhost
    192.168.1.64 DALLAS.twosdomain DALLAS
    192.168.1.65 DENVER.twosdomain DENVER

  5. #5
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8
    etc/resolv.conf

    DALLAS:
    =============================
    ; generated by /sbin/dhclient-script
    search twosdomain
    nameserver 192.168.1.1
    nameserver 68.238.64.12


    DENVER:
    =============================
    ; generated by /sbin/dhclient-script
    search twosdomain
    nameserver 192.168.1.1
    nameserver 68.238.64.12

  6. #6
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8
    /etc/sysconfig/network

    DALLAS
    ==========================
    HOSTNAME=DALLAS
    NETWORKING=yes
    NISDOMAIN=twosdomain


    DENVER
    ==========================
    NETWORKING=yes
    NETWORKING_IPV6=no
    HOSTNAME=DENVER
    NISDOMAIN=twosdomain

  7. #7
    Linux Engineer rcgreen's Avatar
    Join Date
    May 2006
    Location
    the hills
    Posts
    1,134
    Run the /sbin/ifconfig command on each one and verify that
    they still have the same addresses. It is possible to change on reboot.
    To make sure they are always the same, you can, with most routers,
    enter the router and reserve those addresses so the same computer
    always gets the same address. Also make sure there isn't a typo
    in /etc/hosts on one of them.

  8. #8
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8

    OUTPUT of /sbin/ifconfig command

    # ifconfig

    DALLAS:
    =============================

    eth0 Link encap:Ethernet HWaddr 00:191:9F:8D:52
    inet addr:192.168.1.64 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::219:d1ff:fe9f:8d52/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:3613 errors:0 dropped:0 overruns:0 frame:0
    TX packets:4104 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:100
    RX bytes:2753468 (2.6 MiB) TX bytes:670510 (654.7 KiB)
    Memory:93100000-93120000

    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:16436 Metric:1
    RX packets:1392 errors:0 dropped:0 overruns:0 frame:0
    TX packets:1392 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:3675712 (3.5 MiB) TX bytes:3675712 (3.5 MiB)

  9. #9
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8

    OUTPUT of /sbin/ifconfig command

    # ifconfig

    DENVER:
    =============================

    eth0 Link encap:Ethernet HWaddr 00:C0:9F:37:12:9F
    inet addr:192.168.1.65 Bcast:192.168.1.255 Mask:255.255.255.0
    inet6 addr: fe80::2c0:9fff:fe37:129f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:154 errors:0 dropped:0 overruns:0 frame:0
    TX packets:106 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:16495 (16.1 KiB) TX bytes:11144 (10.8 KiB)
    Interrupt:22 Base address:0x800

    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:16436 Metric:1
    RX packets:6857 errors:0 dropped:0 overruns:0 frame:0
    TX packets:6857 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:6111868 (5.8 MiB) TX bytes:6111868 (5.8 MiB)

  10. #10
    Just Joined!
    Join Date
    Nov 2009
    Posts
    8

    OUTPUT of ROUTE command

    #route

    I have no idea why ROUTE command's output is slightly different on these machines (mismatched output lines are highlighted with red colors)


    DALLAS:
    =============================


    #route

    Kernel IP routing table

    Destination Gateway Genmask Flags Metric Ref Use face
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
    169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
    default dslmodem.domain 0.0.0.0 UG 0 0 0 eth0


    DENVER:
    =============================

    #route

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
    link-local * 255.255.0.0 U 0 0 0 eth0
    default dslmodem.domain 0.0.0.0 UG 0 0 0 eth0

Page 1 of 2 1 2 LastLast

Posting Permissions

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