In this answer, How can I open a range of ports in ubuntu using (g)ufw, a simple command for opening a range of ports is given.
For example, using this command I can open the ports 1000-1999 very easily for my firewall on my local machine.
Now, though, I would like to set-up port forwarding on the local machine, so that:
- Port 1001 forwards to port 1
- Port 1002 forwards to port 2
- Port 1003 forwards to port 3
- ... etc -
Does anyone have a simple bash script for doing this?
I have to do this for multiple machines on a local network. Constraints by the router are making this more difficult than it needs to be.
So machine A, ports 1000-1999 on the router would be opened to link to machine A. On machine A, they would be forwarded to the traditional port. For machine B, ports 2000-2999 on the router would be used (mapped to the appropriate port locally). Etc