Community discussions

MikroTik App
 
northman
newbie
Topic Author
Posts: 35
Joined: Thu Nov 27, 2008 10:38 pm

nice port forwarding idea. ..Is it possible? how to?

Tue Dec 30, 2008 6:56 pm

Hi.

We have MT RB450 router:
- eth1 connected to I-net and it has NAT on it and public IP say 22.33.44.1
- eth2 connected to LAN, say 192.168.2.0/24

Inside the LAN there are several boxes with web-enabled control interfaces (via http, port 80)
We need to have access to these boxes from outside and I know that I need to configure port forwarding here, but we decided to make it according some logic to make it easy to remember, for example:
22.33.44.1:55123 should be maped to 192.168.2.123:80
22.33.44.1:55124 --------------------------> 192.168.2.124:80
22.33.44.1:55125 --------------------------> 192.168.2.125:80
. . .
22.33.44.1:55199 --------------------------> 192.168.2.199:80

Are there any ways to implement this logic by one shot? :)
Or to do routine installing separate rules for each particular LAN IP is only the way?.. :(
 
netrat
Member
Member
Posts: 402
Joined: Thu Jun 07, 2007 1:16 pm
Location: Virginia

Re: nice port forwarding idea. ..Is it possible? how to?

Tue Dec 30, 2008 7:19 pm

I think you have to make each rule separately. You could make a script to automatically make the individual rules though.

/ip firewall nat
add action=dst-nat chain=dstnat comment="" disabled=no dst-address=22.33.44.1 dst-port=55123 protocol=tcp to-addresses=192.168.2.123 to-ports=80
add action=dst-nat chain=dstnat comment="" disabled=no dst-address=22.33.44.1 dst-port=55124 protocol=tcp to-addresses=192.168.2.124 to-ports=80
etc...
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7054
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: nice port forwarding idea. ..Is it possible? how to?

Fri Jan 02, 2009 8:27 am

You can write a script to make those rules automatically:
:for i from=123 to=199 do={
   /ip firewall nat add dst-port="55$i" to-addresses="192.168.2.$i" ...
}

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], GoogleOther [Bot], katopz24, tikmakro, txfz and 154 guests