How do I set SRV records for Minecraft port mapping for local and public networks

Please follow the below template, it will help us to help you!

Expected Behaviour:

When i type mc1.udochudo.ru
i got 192.168.212.104:25565
When i type mc2.udochudo.ru
i got 192.168.212.104:25566

Actual Behaviour:

both mc1 and mc2 subdomain answer 192.168.212.104:25565

Debug Token:

https://tricorder.pi-hole.net/wdcrx854aw

Where are you typing that domain? Is this part of a dig command, nslookup, entered into a browser, etc.?

Look in the pihole log at /var/log/pihole.log and post these transactions, starting with the query and through the transactions with the upstream server and then the replies.

PS C:\Users\zvere> nslookup -type=srv _minecraft._tcp.mc2
╤хЁтхЁ:  udochudo.ru
Address:  192.168.212.104

_minecraft._tcp.mc2     SRV service location:
          priority       = 1
          weight         = 5
          port           = 25566
          svr hostname   = 192.168.212.104
PS C:\Users\zvere> nslookup -type=srv _minecraft._tcp.mc1
╤хЁтхЁ:  udochudo.ru
Address:  192.168.212.104

_minecraft._tcp.mc1     SRV service location:
          priority       = 0
          weight         = 5
          port           = 25565
          svr hostname   = 192.168.212.104

I'm try to check my srv record by nslookup and in game client. Client show me this, two different adress and same server

Can you help me....pls

I am a bit lost on what is happening here. Is this a domain you are serving on your network, or does the domain exist outside your network?

Lost here too.
From both nslookup's, it appears exactly as you requested/expected.

_minecraft._tcp.mc1.udochudo.ru appears to resolve to 192.168.212.104 with port 25565

&

_minecraft._tcp.mc2.udochudo.ru appears to resolve to 192.168.212.104 with different port 25566

But this seems to be a private address 192.168.212.104 thats not available publicly.
Did you add those DNS records to your Pi-hole setup and how have you configured this ?

This looks like a pair of Mindcraft servers running on one machine within a local network.
As two instances of Mindcraft are sharing one IP address, the server tells the instances apart by associating their hostnames with different ports.

This is neither an error in Pi-hole nor an invalid configuration.

If you require assistance on how to correctly setup Minecraft servers, you'd more likely find better answers consulting their web resources,
e.g. Configuring the Minecraft server
or Multiple Mindcraft servers sharing one IP

1 Like

I'm not noob in installing minecraft's servers, i'm noob in Pi-hole DNS configure. So, this problem in Pi-Hole FTL Dns server, i understand it correctly, right ?

What i want to do. I want make next thing
When player from local network connect to mc1.udochudo.ru his client will got 192.168.212.104:25565
When player trying connect to mc2.udochudo.ru his clietn will got 192.168.212.104:25566
But if we look on screen, When client ask server by mc1 and mc2 it will got only one DNS response, but if we check it with nslookup it will show what mc1 response port 25565 and mc2 response port 25566. And now i'm confuse, because if i do this from Yandex.DNS Manager and i'm add SRV records then i will got or Empty response, or Port 25565 or Port 25566 but client will send Error "Unknown host"

This domain exist in both network, in my Local and in External, but i want make loopback, when my PC try go to mc1.udochudo.ru it must got my local IP with specific port, but when computer from internet try ask mc1.udochudo.ru it must got my real IP adress with same specific port

No, this problem is not Pi-hole related.
Pi-hole is a DNS domain filter for your local network, and -judging by your description so far- DNS filtering is not involved at all.
Pi-hole just happens to include a tailored dnsmasq instance that will allow you to tweak DNS settings as well.

But I do not see a problem with your local setup at all, as you seem to have added the A-type and SRV-type DNS records correctly. However, once you involve public domain names, configuring a local dnsmasq is not enough.

This will only ever work from within your private, local network, since 192.168.x.x is a local address.
So your co-players have to be with you, connecting to the Minecraft servers through your private network.
Based on your posted information, your local configuration is behaving correctly:

Your above screenshot demonstrates that both of your Minecraft servers are correctly detected on your local network.

You are just seeing the appropriate answers for A-record and SRV-record DNS queries, so nothing conspicuous here.

That is because mc1.udochudo.ru and mc2.udochudo.ru are NOT publicly available hostnames, as the following lookup through Yandex's DNS server demonstrates (other DNS severs like Google return the same):

pi@raspberrypi:~ $ nslookup mc1.udochudo.ru dns1.yandex.net
Server:         dns1.yandex.net
Address:        213.180.204.213#53

** server can't find mc1.udochudo.ru: NXDOMAIN

So long story cut short:
Your local setup is OK - none of your screenshots (so far) shows any problems, specifically none attributable to Pi-hole.

But I've got the feeling that we do not quite understand your actual problem yet.
So, if missing public domain names are not related to your problem, please try to rephrase your question. It would also help if your references to your attachments would be more clear.

Ok, will try to describe what i want to do.
First, i have my personal domain Whois Lookup Captcha

I have my personal local server with PiHole installed
My curent DNS records in local network is
https://gist.github.com/UdoChudo/0d0fae65fa87cc3b2389279bc7e090be

My Curent Yandex Dns records is

Summary
udochudo.ru - 46.146.231.120
mc.udochudo.ru - same ip
_minecraft._tcp.mc1 SRV 300 IN SRV 0 5 25565 udochudo.ru. 0
_minecraft._tcp.mc2 SRV 300 IN SRV 0 5 25566 udochudo.ru. 0

Expected Behaviour:

WAN  
Minecraft Client send packet to mc1.udochudo.ru and Yandex resolve 46.146.231.120:25565 
Minecraft Client send packet to mc2.udochudo.ru and Yandex resolve 46.146.231.120:25566

LAN 
Minecraft Client send packet to mc1.udochudo.ru and PiHole-FTL resolve 192.168.212.104:25565 
Minecraft Client send packet to mc2.udochudo.ru and PiHole-FTL resolve 192.168.212.104:25566

Actual Behaviour:

WAN  
Minecraft Client send packet to mc1.udochudo.ru and Yandex resolve nothing 
Minecraft Client send packet to mc2.udochudo.ru and Yandex resolve nothing

LAN 
Minecraft Client send packet to mc1 OR mc2 and PiHole-FTL resolve 192.168.212.104:25565 on BOTH MC1 and MC2 subdomain 

UPD.
Example in Client
Imgur: The magic of the Internet SkyFactory runing on port 25565 Milona's Family runing on port 25566

Thank you for providing a more detailed configuration. It's much easier to grasp what you are up to now :wink:

However, it is still as I deduced from your previous input:
Pi-hole is not involved here - your local setup is correct.

Your /etc/dnsmasq.d/04-mcsrv-record.conf correctly sets up the local SRV records for your port redirects, and your /etc/dnsmasq.d/02-udochudo.ru.conf sets the correct local A records for your mc1 and mc2 subdomains.
As a side note, just adding your domain names to /etc/hosts would have had the same effect for your A records. But it's also nice to have the config files for one solution all in one place, much as you do have now. For that reason, I'd probably consider to put A and SRV record definitions in a single file together:

host-record=mc1.udochudo.ru,192.168.212.104
host-record=mc2.udochudo.ru,192.168.212.104
srv-host=_minecraft._tcp.mc1,192.168.212.104,25565,0,5
srv-host=_minecraft._tcp.mc2,192.168.212.104,25566,1,5

That's purely cosmetic, your local config is OK the way it is.

But seeing them all in one place possibly highlights the way to the solution:

Your public DNS config with Yandex is missing the A records for your subdomains.
Without them, mc1.udochudo.ru and mc2.udochudo.ru will never get resolved in the first place.

Try adding them to your Yandex DNS.
Oh, and doublecheck the SRV records there - udochudo.ru. sports a trailing dot. I can't tell whether that is a display glitch only.

Also note that this just addresses public DNS.
You still might not be able to successfully connect to your MC servers through the Internet. You have to make sure the ports are allowed and forwarded by your router (which accepts the requests from the Internet) to your Minecraft server (which ultimately consumes them). How you do this will be highly specific to your router model.
Again, this is not Pi-hole related. You are more likely to find support when looking for web resources related to your router model.

And finally, a favour I'd like to ask:
Could you possibly rename this topic so it better reflects what problem you tried to address here?
Maybe 'How do I set SRV records for Minecraft port mapping for local and public networks' or something alike. Your post contains information that certainly could help other Minecraft enthusiasts :wink:

Ok, thank you ))

I would also put the full name in the config file and give them same priority eg.:

srv-host=_minecraft._tcp.mc1.udochudo.ru,192.168.212.104,25565,1,5
srv-host=_minecraft._tcp.mc2.udochudo.ru,192.168.212.104,25566,1,5

Priority matters when have multiple SRV records with the same name.
You dont have that so priority doesnt matter for your instance.

EDIT: Here is a nice example for an apt repository (yes apt supports SRV as well) where priority and weight for the records could be applied:

pi@noads:~ $ host -t srv _http._tcp.apt.xbian.org
_http._tcp.apt.xbian.org has SRV record 10 1 80 xbian-apt.mirrorservice.org.
_http._tcp.apt.xbian.org has SRV record 10 1 80 apt.xbian.org.
_http._tcp.apt.xbian.org has SRV record 10 1 80 apt1.xbian.org.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.