I have Voltz Server on my Ubuntu Server that can be accessed using both a domain name that is linked to my Public IP address and my actual IP Address. For some odd reason, when I want to connect to my server using the domain, the reception of the server is 1 bar, but when I log in, there is no ping spikes or nothing. When I connect using a local IP address it is fine, full bars. Anybody have an idea of a possible solution?
It takes longer because the packets are travelling a longer distance
If you're using the domain name, it doesn't know where that is. So it asks, and gets an answer: your public IP address.
It then looks up how to contact that IP address. It doesn't know that IP address goes to itself. So it asks your router, which also doesn't know, which then asks your Internet Service Provider's routers, which may know, or may pass the request further out, until it finds a server that knows how to contact that public IP address.
Finally, it reaches a server that can see that public IP address and then it creates a connection between your computer and that computer — which is your computer but it still doesn't know that — and passes messages back and forth along that whole chain. So when you use your public IP address, your Minecraft client and server are talking to each other over a long loop that goes way out into the public Internet and then back through your ISP to your computer.
That's a lot of extra time for your Minecraft client to finally get to talk to your Minecraft server about each tick! By comparison, using your actual IP address makes only 1 hop (or, if your network is configured cleverly, none), which is much faster.
To draw an analogy, connecting to your public IP address via domain name is like sending your roommate a note that it's their turn to clean the kitchen by putting it in an envelope with their name and address and sending it through the national mail system, when it would be much faster to just slide it under their bedroom door.
To illustrate this with numbers, I sent a set of tiny messages (pings) to my public IP address. The average ping time for that long round trip was 2.335ms. Sending the same thing to my actual IP address was 0.105ms — a 22× speed improvement. It was slightly faster even when I used the shortcut IP address that means “this computer” (
127.0.0.1, also available as the DNS name
localhost), at only 0.094ms — a 25× speed improvement.
So the moral of the story is, when connecting to a Minecraft server on the same machine as your Minecraft client, always use the domain name
localhost instead of your public domain name or IP address.