Can't ping via hostname using static connection profile

This sure is nonsense:

When my connection profile is dynamic I can reach my virtual server via hostname but when my connection profile is static I can’t reach it using hostname only using the ip address.

I know that I surely need to configure something else…

I’m guessing that you’re getting your DNS through DHCP, so you’ll need to set your DNS servers as well with your static IP. It’s likely the IP of your router (most likely on a home network), but if the host is public, you can use or

How are you bro? Thanks for your assistance.

I just tried and same problem. I’m pinging from my laptop that have a dynamic connection I dont know if It has nothing to do with that.

An yes my gateway is

ping fedoraserver1
ping: fedoraserver1: Name or service not known

ipv4.method:                            manual
ipv4.dns-search:                        --
ipv4.dns-options:                       --
ipv4.dns-priority:                      0

I noticed that the search is missing. You might need to add the domain for your home network either as the search parameter or appending it to the hostname of the box you are trying to ping. The local domain should be configured by your router.

Also, the /32 cidr means it’s only talking to its own IP. Try changing this up to /16 (or /24 if you’re sure everything is at 192.168.1.*).

All this time Im have been looking and internet and I don’t have a clear idea of what I have to do, I looked for how to create a domain for my home network and in the router configuration I can’t find any field to put a domain name, I’ve seen other videos but I don’t know, I’m all confused.

My current hostname is fedoraserver1 I change to but it doesn’t work either
On the other hand, I already modified

Are you using your Router as DNS host and DHCP server as well?

When clients are using DHCP to get IP address, current OpenWrt will also register the client’s IP / Hostname details into the DNS dynamically.

That’s why when both client1 & client2 are using DHCP, at client1, I can do
(mydomain is configurable at the Router’s DNS/DHCP console usually)

ping client2
ping client2.mydomain

But when client2 is switched to Static - then the Router’s DNS will not have client2 IP/Hostname entry. In this case, you can:

  1. Modify Router’s DNS, to statically add the client2/IP entry
  2. Modify client1’s (or every clients on your network) local DNS resolver, to add an static entry for client2

What I am doing with my OpenWrt router is:

  • add a static DHCP assignment based on Mac address - so that client2 will always got the same IP address via DHCP.

Are you using your Router as DNS: I guess so… I have been reading that the routers come with a DNS server that works locally (LAN) and when he dont have answer he route the request to the WAN.

and DHCP server: Only for my host that get his ip dynamically. For my VM’s I assign them IP manually (static). It was there when I began to see this detail.

On the other hand, your explanation has been very simple, very clean. Im very happy for that Im so glad I processed it.

@sampsonf can you clarify me a little more some details to further strengthen my understanding?
Here we go:

This register or entries already happen at the router level, right?

I am very grateful for your time and the great contribution you have made for me. @vwbusguy @sampsonf

1 Like

When using physical devices, normally they get IP address from the Router’s DHCP server.

But for a VM platforms, guests can be:

  • hide behind the VM hosts, so that the Router only see traffic from the VM Host (we said the guesting is using a NAT by the VM Host)
  • direct exposed to the Router (normally it is called a Bridged network. In this case, Router will see the VM guests as individual network device.)

If you want physical devices connecting to your VM guest, using Bridge mode will be easier as a start.

At this point it is as if there were no router in between correct? Just de LAN cable connected directly to the NIC, It’s right?

And here is like another phisical device (VM in this case) inside the LAN right?

In fact BRIDGE ADAPTER is my current configuration right now for my VM’s and was here when I notice this detail that when them get the ip dynamicly and after setup the hostname I can reach it from my HOST using the hostname but when I configure it using static IP I can’t reach it anymore using the hostname, only using the IP address.

I just did this but it’s doesn’t resolve my problem of being able to reach my server using the hostname, in fact, my router console doesn’t have a field for hostname anywhere.

Well… it doesn’t matter, you’ve already done a lot for me you’ve give me a 100% clear idea of the situation.

Thank you very much for your valuable time sir….

Question is: does your router have the possibilty to give a client a fixed IP address, a DHCP lease with infinite lease time. “DHCP binding” or something like that. In that case, the VM should get it’s address via DHCP, but always gets the same address. In addition, because it’s connected using DHCP, the name is registered in DNS and you can address the VM via hostname.

Thanks! @hmmsjan.

You finished making me understand that now logically, after configured the DHCP static in the Router console I should create a new connection profile ipv4.method auto that so that the router can assign the “static” IP from scratch to a new one connection. Of course in that way now it’s works!

Again. Thank you all of you guys.
@vwbusguy @sampsonf @hmmsjan