1 > Can I use a port-range in a filter-rule? Right now I have:
Code: Select all
/ip firewall filter
add chain=input dst-port=22,2248,2249,2250,2251,2252,2253,2254 in-interface=ether1 protocol=tcp src-address=z.z.z.z
2 > Can I optimze these rules? For every rule, x.x.x.X matches with y.y.y.X.
I now have several rules for every host, both for icmp and certain dst-port. Can this be optimized in less rules?
Code: Select all
/ip firewall nat
add action=dst-nat chain=dstnat dst-address=x.x.x.248 protocol=icmp src-address=zz.zz.0.0/12 to-addresses=y.y.y.248
add action=dst-nat chain=dstnat dst-address=x.x.x.249 protocol=icmp src-address=zz.zz.0.0/12 to-addresses=y.y.y.249
add action=dst-nat chain=dstnat dst-address=x.x.x.250 protocol=icmp src-address=zz.zz.0.0/12 to-addresses=y.y.y.250
add action=dst-nat chain=dstnat dst-address=x.x.x.251 protocol=icmp src-address=zz.zz.0.0/12 to-addresses=y.y.y.251
add action=dst-nat chain=dstnat dst-address=x.x.x.252 protocol=icmp src-address=zz.zz.0.0/12 to-addresses=y.y.y.252
add action=dst-nat chain=dstnat dst-address=x.x.x.253 protocol=icmp src-address=zz.zz.0.0/12 to-addresses=y.y.y.253
add action=dst-nat chain=dstnat dst-address=x.x.x.254 protocol=icmp src-address=zz.zz.0.0/12 to-addresses=y.y.y.254
add action=dst-nat chain=dstnat dst-address=x.x.x.248 dst-port=22,80,443 protocol=tcp src-address=zz.zz.0.0/12 to-addresses=y.y.y.248
add action=dst-nat chain=dstnat dst-address=x.x.x.249 dst-port=22,80,443 protocol=tcp src-address=zz.zz.0.0/12 to-addresses=y.y.y.249
add action=dst-nat chain=dstnat dst-address=x.x.x.250 dst-port=22,80,443 protocol=tcp src-address=zz.zz.0.0/12 to-addresses=y.y.y.250
add action=dst-nat chain=dstnat dst-address=x.x.x.251 dst-port=22,80,443 protocol=tcp src-address=zz.zz.0.0/12 to-addresses=y.y.y.251
add action=dst-nat chain=dstnat dst-address=x.x.x.252 dst-port=22,80,443 protocol=tcp src-address=zz.zz.0.0/12 to-addresses=y.y.y.252
add action=dst-nat chain=dstnat dst-address=x.x.x.253 dst-port=22,80,443 protocol=tcp src-address=zz.zz.0.0/12 to-addresses=y.y.y.253
add action=dst-nat chain=dstnat dst-address=x.x.x.254 dst-port=22,80,443 protocol=tcp src-address=zz.zz.0.0/12 to-addresses=y.y.y.254
For example, 2248 corresponds with y.y.y.248. And the ports are always forwarded to 22 on the inside. Can we use a regex or something to optimize these rules?
Code: Select all
/ip firewall nat
add action=dst-nat chain=dstnat dst-port=2248 in-interface=ether1 protocol=tcp src-address=z.z.z.z to-addresses=y.y.y.248 to-ports=22
add action=dst-nat chain=dstnat dst-port=2249 in-interface=ether1 protocol=tcp src-address=z.z.z.z to-addresses=y.y.y.249 to-ports=22
add action=dst-nat chain=dstnat dst-port=2250 in-interface=ether1 protocol=tcp src-address=z.z.z.z to-addresses=y.y.y.250 to-ports=22
add action=dst-nat chain=dstnat dst-port=2251 in-interface=ether1 protocol=tcp src-address=z.z.z.z to-addresses=y.y.y.251 to-ports=22
add action=dst-nat chain=dstnat dst-port=2252 in-interface=ether1 protocol=tcp src-address=z.z.z.z to-addresses=y.y.y.252 to-ports=22
add action=dst-nat chain=dstnat dst-port=2253 in-interface=ether1 protocol=tcp src-address=z.z.z.z to-addresses=y.y.y.253 to-ports=22
add action=dst-nat chain=dstnat dst-port=2254 in-interface=ether1 protocol=tcp src-address=z.z.z.z to-addresses=y.y.y.254 to-ports=22
Chris