Unable to ping gateway & other Linux boxes on same network

134,981

on each host, they should have at least their hostname and a corresponding entry in /etc/hosts with their IP in the relevant network, no? ^^ You only show 127.0.0.1 in there, and the "localhost" hostname... So how can it know it is also part of the 192.whatever network and should therefore be able to ping all the other hosts on there? In other words: just edit the hosts file and add a line with:

10.45.89.xxx  st852.demolotus.com

xxx being the last IP digit of st852.demolotus.com in the 10.45.89.X/24 subnetwork

Share:
134,981
vikas
Author by

vikas

Updated on September 18, 2022

Comments

  • vikas
    vikas almost 2 years

    I'm somewhat new to Linux, but I'm trying to network a few Linux machines. I can't seem to be able ping the gateway or the other Linux machines.

    My scenario: I have a few Linux boxes set up on a 10.45.89.x subnet with the gateway being 10.45.89.1. On all of these, I'm unable to ping anything except 127.0.0.1. I'm wondering if I need to modify any of the routing tables or hosts file. Below is a few commands and their output. Perhaps I need to check something else?

    netstat -r output:

    10.45.89.0   *   255.255.255.0    U
    10.112.0.0    *    255.255.0.0    U
    169.254.0.0    *    255.255.0.0    U
    default    10.45.89.1    0.0.0.0    UG
    

    /etc/hosts

    127.0.0.1 localhost.localdomain  localhost
    127.0.0.1 localhost.localdomain  localhost
    9.37.253.154 rpt.rhn.linux.ul.com
    

    /etc/resolv.conf

    domain demolotus.com
    namserver 127.0.0.1
    

    /etc/sysconfig/network

    NETWORKING=yes
    NETWORKING_IPV6=no
    HOSTNAME=st852.demolotus.com
    

    ip route show dev eth0

    10.45.89.0/24  proto  kernel  scope  link  src  10.45.89.138
    default via 10.45.89.1
    

    ifconfig

    eth0    Link encap:Ethernet  HWaddr 00:0C:29:01:28:CD
    inet addr:10.45.89.138  Bcast:10.45.89.255 Mask:255.255.255.0
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    
    eth0:0 Link encap:Ethernet HWaddr 00:0C:29:01:28:CD
    inet addr:10.45.89.139  Bcast:10.45.89.255 Mask:255.255.255.0
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    

    ip addr show dev eth0

    2: etho0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:0c:29:01:28:cd brd ff:ff:ff:ff:ff:ff
    inet 10.45.89.138/24 brd 10.45.89.255 scope global eth0
    inet 10.45.89.139/24 brd 10.45.89.255 scope global secondary eth0:0
    

    Any suggestions are greatly appreciated. Thanks!

    • vikas
      vikas over 11 years
      Thanks, I started playing around with it and got it working. One of the problems was it seemed that I had eth0 disabled, which ifup eth0 corrected. Thanks again.
  • Olivier Dulac
    Olivier Dulac over 11 years
    and restart (stop ; start) networking, or reboot, to have it re-read its hostname and ip and create its routing information.
  • Olivier Dulac
    Olivier Dulac over 11 years
    I assume the hostname command does indeed reply "st852.demolotus.com", otherwise you need to edit the relevant filse for it to know it is its hostname (it's unix/linux/distribution dependant)
  • Olivier Dulac
    Olivier Dulac over 11 years
    otherwise, even if ping does go out, the remote machine sees it coming from "127.0.0.1" : when replying, it goes to themselves (as 127.0.0.1 will also be that machine's localhost ip) so you never see the packet go back to the machine who originated the ping.