Momo n Curry - Authentic Nepalese Cuisine
Your Banner Here

   [Show all top banners]

Ghiraunla
Replies to this thread:

More by Ghiraunla
What people are reading
Subscribers
[Total Subscribers 1]

fi_nepali
:: Subscribe
Back to: Kurakani General Discussion Refresh page to view new replies
 To linux and devops gurus
[VIEWED 2025 TIMES]
SAVE! for ease of future access.
Posted on 10-08-17 2:45 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

Linux gurus,
Hope you are enjoying your long weekends. Here is what I have:
How can I make sure I can ping the centos vms by hostname?
I have installed 2 Centos 6.7 in VMWareWork Statation. I can ping the IP addresses from one virtual machine to another virtual machine. I also can ping to the IP addresses of each vms from my local pc. In addition, I can ping to the same vm i.e. itself from its termina' either by ip address or by  hostname. However, I am not able to ping from one vm to another vm by the hostname. Also I cannot ping it from my local machine which runs wiindows.

Where should I be looking at to trouble shoot this issue?

Dhanyabad in advance.
Last edited: 08-Oct-17 07:37 PM

 
Posted on 10-09-17 3:40 AM     [Snapshot: 158]     Reply [Subscribe]
Login in to Rate this Post:     1       ?         Liked by
 

Not a devops here but since there are no replies , let me try.

You need to make sure you have proper DNS infrastructure. DNS is used for ip to name translation. If you are trying for quick fix, google about host file, you can add entries there and make it work
 
Posted on 10-09-17 8:37 AM     [Snapshot: 235]     Reply [Subscribe]
Login in to Rate this Post:     1       ?         Liked by
 

Solution 1: Edit your hosts file on you local PC as admin

start --> CMD --> right click and run as admin --> cd drivers/etc --> notepad hosts --> add a line at the bottom describing your IP and hostname(alias). It should look like this:

192.168.78.xx (your Ip for VM) testVM(hostname)

save this file --> try pinging using hostname

Solution 2: modify your hosts file on VMs

from linux terminal --> vi /etc/hosts --> add IP of your another VM and hostname there

192.168.78.xx testVM1(hostname)

Hope this helps.
 
Posted on 10-09-17 10:19 AM     [Snapshot: 281]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

Hi Meraj and pkr_kancha,

Kudos to you ! I am able to ping the vms from each other by inputting the each others ip and host name in each other's host file. However, I am still not able to ping the vms by hostname yet from my local pc. I edited the host file of local pc by inputting the ip address and hostname.
while pinging by hostname, I get the error like 'Ping request could not find host vm(hostname). Please check the name and try again.'

ps. the network adapter setting for the vm in vmwareworkstation is set as NAT, not sure if this has anything to do with the ping from the local pc.  The other options are bridged, host only and custom in place of NAT

Where should I be looking further?
Last edited: 09-Oct-17 10:19 AM
Last edited: 09-Oct-17 10:21 AM
Last edited: 09-Oct-17 10:55 AM

 
Posted on 10-09-17 10:25 AM     [Snapshot: 299]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

can you paste the content of your local hosts file here?
 
Posted on 10-09-17 10:46 AM     [Snapshot: 322]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

Hello pkr_kancha,
Plz see below the contents of host file from local pc:
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

192.168.xxx:xxx Server1
 
Posted on 10-09-17 11:02 AM     [Snapshot: 327]     Reply [Subscribe]
Login in to Rate this Post:     3       ?         Liked by
 

Not sure if it's a typo but after third octet you've written colon instead of dot (192.168.xxx:xxx). Try replacing that colon with a dot. Also make sure there is at least one space between IP and the hostname. restart the machine(it helps)



 
Posted on 10-09-17 11:27 AM     [Snapshot: 367]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

pkr_kancha jyu,.
dherai dhanyabad, dherai. you found the issue :), the column. Meraj lai and tito_satya lai also dherai dhanyabad for your helping hands.

I wish you wonderful day/s ahead. I got moments to breath here..........
 
Posted on 10-10-17 6:12 AM     [Snapshot: 581]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

google bro , google is full of resources!! glad folks here are able to help!!
 
Posted on 10-10-17 8:21 PM     [Snapshot: 708]     Reply [Subscribe]
Login in to Rate this Post:     2       ?         Liked by
 

nepal12345678 bro,
Thanks for going over the issue. These superb people, and I am sure one of them is you are
as well because you provided an invaluable suggestion 'google bro'. Yes, I second to that. If anything I can say to our bros and sis working on IT or not, if you are looking for something goolge it, youtube it, chances are very high you will get what you are looking for. In some cases, though one may not be able to get from google for whatever reasons.
We should first google it.
In my case I did google, but was not able to resolve it. None responded, I kept working on my own. The best part of Meraj is that he gave lifeline to the thread with the invaluable advice, and pkr_kancha came with the detailed solution. I applied what was recommended and it worked like a magic whereever, I followed advice, but there I got one issue, that I tried to resolved it on my own but I was not able to see my own mistake there, pkr_kancha further offerred his help to look into the code itself, his expert eyes identified the a tiny column as the issue in place of a dot. And tito_satya was also proving me his supporting hands in the same time though he did not post here. I know all of these people were attending as if that was the high priority ticket on them,

Again, Kudo to you superbs! I got moments to breath.

 
Posted on 10-11-17 9:37 AM     [Snapshot: 779]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

yup. never give up. google, read, try, fail, again try and when u get success, you then become master. next time when u have any other issue,u do the same thing and you again become master. And then it becomes your troubleshooting habit and will give you confidence. Glad folks here investigated your issue like in an IT thread.


 
Posted on 10-13-17 9:52 AM     [Snapshot: 1045]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

this was informative, thanks
 
Posted on 10-16-17 3:27 PM     [Snapshot: 1336]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

Little late here but I suggest you to look into what DNS is and how it works. After you know what DNS is and how it works, you will find it easy to google because you will know what you are looking for. DNS is the backbone of internet so it is very very important concept if you are trying to get into IT.

Basically, in layman's term, DNS is just an infrastructure that is able to convert hostnames to IP address and vice versa. The infrastructure part is actually very interesting and complex and I wouldn't to justice trying to explain it to you here but. Google (TLD , and explore DNS RFC )

What i can explain you is how DNS is used. Internet address is numbers(IP address) and subnets(network segments). DNS give it a meaningful name so that you can write google.com vs an ip address.

In your case, you are running on VM. The VM software assigns a virtual network interface and all the guest hosts are assigned an IP address under that network interface by default. Since your host machine cannot talk to the guest machine because they are in different NETWORK by default. However most of the VM software also adds a bridge so that those two networks can talk to each other.
Now the DNS part, when you ping a hostname such as myguesthostname , Microsoft looks into its TCP / IP stack order which goes like this
-- check if it's querying for itself.
-- check on the local hostfile
-- send a query to its configured DNS server
-- And finally netbois as a backup.

Since the first logical place is to checks is hostfile , you edit the host file to map the hostname to the IP address as the simplest soution. all the host file says is hey if my computer asks for this hostname it actually this IP address.

You can also add an A record for that VM in your DNS server as a workaround but who has a local DNS server at home right ? (actually I do lol). Obviously, you can't add the A record in the public DNS(unless you own the domain) so the easiest solution for you is to add it to the local host file.

----



Last edited: 16-Oct-17 03:36 PM

 
Posted on 10-17-17 4:46 AM     [Snapshot: 1437]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

fdpower,
your information very useful, and helpful because you have tailored it to the needs of people like me.
like i said the gurus before gave me a lifeline, and your write ups provides additional inputs for further growth and strength. yes, people like you make a huge difference. While i will continue my research further, would you or someone please tell me what these commented lines mean in the host file?

what is '127.0.0.1' which does not look like an ip address to me? and ' ::1'? why are both pointing to localhost? what is the implications if we uncomment them?

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
 
Posted on 10-17-17 9:50 AM     [Snapshot: 1503]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

127.0.0.1 is indeed an IP address. Actually the first address in a class A network. Google network classes. There are three CLass A , B and C.

The first line 127.0.0.1 is a IPv4 network and ::1 is a IPV6 network.
Google why there is IPV4 and IPV6 and what are the differences. There is a cool math and logic to it.

 
Posted on 10-17-17 9:51 AM     [Snapshot: 1505]     Reply [Subscribe]
Login in to Rate this Post:     0       ?        
 

and I forgot to mention both of these address are called Loopback address mainly used for testing traffic.

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 7 days
Recommended Popular Threads Controvertial Threads
पिन्कुको नया काले हस्पि नाक चुचेय भाते भतुवा
To linux and devops gurus
Why Nepalese society can never progress
अमेरिकामा एक नेपालीले स्वास्नीलाई खुकुरी जस्तो धारिलो हतियारबाट हत्या र सासुलाई सिकिस्त आक्रमण
Old nepali folk songs archieve.
The price and weight of Deepika Padukone's lehenga will surprise you
यस्तो राम्राे बन्दैछ काठमाडौं - नाैबिसे सुरूङमार्ग | Kathmandu - Naubise tunnel road
The Newar Community Network
Out of Status: Travelling to Nepal on TPS
Good QA/BA consultancy
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to [email protected] using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters