I have been learning to use iptables recently and i made a small nat network in virtualbox. I have a Debian server Natting for the internal clients. One of the internal clients is hosting a minecraft server for testing.
What im wanting to do is have any incoming connections using port 25565 going in eth0 from the debian server, to forward them specifically to the internal minecraft server (192.168.200.4) out eth1. Just like you would in a regular Linksys router.
What i had come up with, but doesnt actually work was:
iptables -A FORWARD -i eth0 --dport 25565 -o eth1 -d 192.168.200.4 -j ACCEPT
Then i read in the errors and other tuts out there, that its actually POSTROUTING/PREROUTING that i need to use. so then i tried:
iptables -t nat -A POSTROUTING -i eth0 -p tcp --dport 25565 -o eth1 -d 192.168.200.4 -j ACCEPT
Now obviously none of these work, but i want to know if i am in the right track?
Here is a diagram of the virtual network so yall can see it visually:
https://i.stack.imgur.com/P9rZS.jpg
Currently, the iptables config looks like this:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere tcp dpt:telnet
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Any additional details will be gladly added :)
(Anything in the INPUT chain is just other rules i was messing with earlier, originally, the only rules it had were the ones under the FORWARD chain)
This is the tutorial that i had followed for NAT: http://www.revsys.com/writings/quicktips/nat.html