vm hostnames can not be ping?

Joseph Chrzempiec

Well-Known Member
Jun 9, 2016
Hello I'm setting up a bunch of small vm with 2 core 2GB of memory about 5 of them and they are ubuntu linux servers 18.04 is what i have at the moment for my friend who is doing a school project. The problem i have is that if I'm on one VM guest and i try to ping a second VM guest with the hostname i put i get this error failed in terminal. I have never saw this before they are all addresses of 192.168. I can ping the ip addresses of al 5 VM guest with no problem, Just not the hostnames. I looked all over and i can not figure out what to do. Can someone pleae hlep me?


Do you have an DNS that can resolve these names?
If not you must add the IP and name in the hostnames file.
Hello wolfgang no i have never setup anything for dns. also never did anything for hotnames. Not even sure what to do.

Maybe you have a router/Gateway in your Network that has a DNS server.
If so you can add there the names and IP of the VMs.
I'm so confused on what i need or don't need for this. I have a tenda router it does have DNS on it. But i don't see anything in the router for the dns server. I'm unsure what i would need to make all the VM guest can ping each other with the hostname instead of the ip address.

Essentially, the hostnames are just strings of letters and numbers and could be anything at all. For machine A to be able to ping hostname, it needs to know the IP. To know the IP, it needs somewhere to look them up. Proxmox itself does not have any facility for this. If your router doesn't either, then you have a couple of options.

If you are using FQDNs for the host names (host1.real-domain.tld) then you can create A records in the DNS for real-domain.tld at the registrar or wherever real-domain.tld's DNS is handled.

OR, the very simplest option is to edit /etc/hosts file for each of the VMs and add the IP and hostnames of each of the other VMs.

e.g. host.name.one.tld host.name.two.tld

If Windows, the hosts file lives somewhere else and needs to be edited with Admin privs and not as a normal user in order to save changes).

Clearly, this manual method is a bit tedious, an anytime you change IPs you have to change it in all the VMs. But it works.
so my address would be then the hostname i say johndoe.tld, so it be johndoe.tld?

Hello i have tired the simple way and i was able to ping the hostname without no problem. I will do this for each VM guest thank you so much.
Yes, exactly tight.

/etc/hosts might look like this: localhost.localdomain localhost localhost4 localhost4.localdomain4
::1 localhost.localdomain localhost localhost6 localhost6.localdomain6 hostname-of-vm-you-are-logged-into

Basically you just need to add to that file: johndoe.tld another.tld

This file is used before DNS lookups are done. It is like a static lookup table.

With regards to DHCP, basically when the VM was created, someone will have decided either to allow them to get their IP address via DHCP or to set a static IP. Typically you would select a static IP because you don't really want the IP ever to change (which could happen if you allowed the VM to get its IP via DHCP). Of course you then also have to make a list of those IPs and make sure you don't accidentally set a second VM to use an IP used by another VM. In the meantime, any other device/workstation/pc/mac/phone/whatever will continue to get an available IP via DHCP.

To be honest you have to be quite careful when setting static IPs alongside dynamic ones given out by DHCP. Many routers allow you to specify a set range of IPs that will be allocated by DHCP, allowing you to safely use other addresses for static assignments. e.g. you the router might assign to via DHCP, with the others therefore being salfe to use with static IPs.

Some routers also allow you to bind a particular MAC address to a particular IP. In that situation, the VMs would be set to use DHCP but the IP they are allocated would always be the same (and configurable through the router).

But I digress.....

An important points to keep in mind is:
a) The name of the VM as shown in Proxmox may be johndoe.tld but that's just a name for the VM. A string. A symbolic identifier. It looks like a domain name but it is just a string.
b) Any hostname set within the VM is also just a string of characters in terms of the word outside the VM. A mechanism has to be set up to allow something outside the VM know the IP address associated with that string of characters. You can do this in the public DNS records of johndoe.tld, or you can manually add the hostname >> IP translation in the hosts file of every device that needs to be able to address the VM by its name instead of its IP.

Even Windows has a hosts file. I edit it all the time if I need to override an address. E.g. I can create a hosting account for johndoe.tld and build a new website for it on server A, which has IP But the public DNS records have johndoe.tld on Server B at By adding johndoe.tld www.johndoe.tld

in my Windows hosts file, my computer thinks the site is at and therefore I can create the new site without having to stage it on a temporary domain or whatever.


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!