[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

to ping

Posted on 2012-09-12
11
Medium Priority
?
429 Views
Last Modified: 2012-10-06
I have two machines wtu and mac

/etc/hosts file of first machine is  ie wtu is


 Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               wtu.localdomain wtu localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
~                                                                              
~                                              

the second machine mac is

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localdomain
192.168.1.12 mac.localdomain mac







=========
how can I make the machine ping each other...
0
Comment
Question by:tomvv
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38389938
The 'hosts' file doesn't normally have anything to do with ping.  On Linux, you should be able to open 'Network Tools' and ping the other machine.  You have to know the IP address or the hostname of the other machine.  These are not normally stored in the 'hosts' file.  I don't remember if one of the 'Network Tools' will tell you what your IP address is.  I have programs on all my different machines that tell what my IP addresses are.
0
 
LVL 71

Accepted Solution

by:
Qlemo earned 2000 total points
ID: 38389963
You can't, unless wtu has an IP of 192.168.1.x (and you know it), or you know the IPv6 address of both machines. IPv6 addresses will be derived from the MAC address, together with some fixed network prefix. If your machines register with a (D)DNS server, using the name with ping should be possible.
127.0.0.1 is always the local machine, as is ::1, so this entries are useless for communicating.
0
 

Author Comment

by:tomvv
ID: 38391839
I know in linux the /etc/hosts entries to be added like this in the /etc/hosts file in order to ping..

# that require network functionality will fail.
127.0.0.1 localdomain
192.168.1.16 wtu.localdomain wtu
192.168.1.12 mac.localdomain mac


but like this we want to add a  windows machine to be pinged like this
how will be the entries to be put like this only or in a different way in the same file..
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38392000
With 'ping' either on the command line or in Network Tools, you can ping by IP address, you do not Need the entries in /etc/hosts.  You can add the IP and Windows host name so you can also ping by name just like you show above.  On my workgroup LAN, all I had to add was the single word that is shown as the 'full computer name' in the System properties in the Control Panel.  I don't know if you need more in an AD domain.
0
 
LVL 71

Expert Comment

by:Qlemo
ID: 38392912
As said above, the hosts file is optional and for convenience only - if no internal DNS service is configured, or the domain suffixes for DNS are not compatible / set / whatever.
AD requires a DNS server, so the only issue with that is you need to configure your own DNS domain suffix and DNS server setting correctly on all AD non-members.
   ping 192.168.1.16
   ping 192.168.1.12
should work without any further setup, the same applies to the new IP you want to ping. Only if you want to use the names, there is more to do as mentioned above.
0
 
LVL 9

Expert Comment

by:crazedsanity
ID: 38394904
In other words, each machine has to have their hosts file with the hostname & IP of the other in order to do host-based pings.  You can instead use IP's without any DNS or "hosts" file editing.
0
 

Author Comment

by:tomvv
ID: 38419144
In simple my question is this..

how can we ping one linux machine and one windows each other..

in linux there is /etc/hosts I know ..

in windows side what we do ,,
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38419202
Your question has been answered several ways.  What do you not understand?

You can 'ping' by IP address without making any changes to any files.  The 'hosts' files can be changed if you want to ping by 'hostname' instead of IP address.
0
 
LVL 9

Expert Comment

by:crazedsanity
ID: 38419274
DaveBaldwin is basically right: if you just want to use IP addresses (which is the way that is most likely to work first), you can do that without doing anything more than connecting them to networks that can talk to each other.

If you want to ping based on a name, that's a bit different.  

Using hostnames generally involves DNS or "winbind"/netbios: that involves making sure that your Linux machine has Samba setup properly, with the correct configuration so it will announce itself (and resolve other netbios names on the network).  This is how hostname pinging (e.g. "ping windowslaptop") seems to "just work"... usually.

Without DNS and winbind/Samba, you can use the hosts file.  In Linux, it's located in "/etc/hosts".  In windows, it's in "%SystemRoot%\System32\drivers\etc\hosts"... a full list is available at Wikipedia (http://en.wikipedia.org/wiki/Hosts_%28file%29).  The problem with this is that you'll have to enter each hostname on every machine that you want to ping with... and if the IP's are dynamic, you may find at some point that you're not pinging anything, or the wrong machine altogether.

You can setup a DNS server that handles resolution of a local domain (e.g. "company.local", so the full hostname for a host called "mybox" would be "mylinux.company.local").  You'll have to make sure that the DHCP server that hands out IP addresses also tells clients to use that server for DNS.

Another (seemingly rarer optiion): If your router supports dynamic local DNS (probably not the right term, but it's all I can come up with right now), then the machines themselves can potentially get local DNS names and automatically be able to ping each other.
0
 

Author Closing Comment

by:tomvv
ID: 38469582
problem solved.,
0

Featured Post

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following recovery method will work on All Cisco Switchs that run ISO software. You will need a good copy of the IOS version you want you use saved on your PC and a Com's Cable. The software for these switches comes as a .tar file. Tar is …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question