I know that this thread is 5 years old.
The statement that port-forwarding is hardware specific is plain wrong.
There are a number of ways to achieve this within most Unix like systems (Linux, etc…)
I prefer the DNS solution. It’s easier to setup.
First some assumptions.
You can edit your zone file.
You have a domain name.
You have an IP address associated with your domain that is static.
Your system is running
Let your domain name be
foobar.com for sake of argument in this example.
Let your IP address be
ADDRESS in this example for sake of argument.
To get your real IP address just run
ifconfig and look for the interface that is connected to your gateway. It needs to be a routable address so addresses on networks like
192.168.0.0 are not routable. They are also called private networks, sometimes.
Ensure you have routable IP address. Let us call it
ADDRESS for sake of argument.
PORT be equal to the actual non-default port that a Minecraft server is running. If you have several servers on different ports on the same machine, that’s OK. We can discuss how to map them individually.
- In your zone file, increment the serial number of the records:
The preamble of your zone file may look very similiar to this:
foobar.com. IN SOA ns1.foobar.com. root.foobar.com. (
3h ; Refresh
1h ; Retry
1w ; Expire
1h ) ; Negative Cache TTL
201902101 is the serial number. Many choose to use the
YYYYMMDDN as a pattern. You can start with
1, or whatever number you want as long as each time you update the zone file, you increment the number.
In your zone file, add 1 to the number.
- In your zone file add this:
_minecraft._tcp.foobar.com. 86400 IN SRV 0 5 PORT ADDRESS
- Restart bind
systemctl restart bind9
It might take a few hours for the information in your zone file to propagate.
Once this is done, when people try to connect to
foobar.com expecting a Minecraft server, they will get connected to
foobar.com:PORT instead. They won’t know the difference.
If you have multiple hosts to map, just add more records with unique
PORT numbers. Remember each time you change the zone file to increment the serial number
You might have thought that the in-application handling of this would be doable with Minecraft. It is, for it’s not uncommon to see applications use the strategy to map multiple domains to one IP address, even on the same port number. Look at how Apache works for instance.
But for Minecraft, the simple solution is just