ATAN,
MARECEK: nekde jsem to nasel a možná trošku modifikoval
mám to tak, že všichni klienti dostávají adresy z DHCP serveru - mají je vždy stejné pres rezervace.
# Script for redirect non static dhcp leases
# authors: Sevcik Roman, Kliment Michal
# for MikroTik 3.x
:global destinationip "78.102.xxx.yyy";
:global destinationport "82";
:global sourceip;
#Remove firewall rule for redirection to target ip and port.
/ip firewall nat
:foreach i in=[find comment="Redirect dynamic ip addresses"] do=[remove $i];
#Erase dynamic address list
/ip firewall address-list
:foreach i in=[find list="povoleni"] do=[remove $i];
#Fill static address list by addresses of static leases.
/ip dhcp-server lease
:foreach i in=[find dynamic=no] do={
:set sourceip [get $i address]
:log info ("Redirect dynamic ip lease for ip: " . $sourceip);
/ip firewall address-list
add list=povoleni comment="Staticke povolene" address=$sourceip
}
#Create firewall rule for redirection to target ip and port.
/ip firewall nat add chain=dstnat protocol=tcp dst-port=80 src-address-list=!povoleni dst-address=!78.102.xxx.yyy in-interface=!eth1-internet action=dst-nat to-addresses=$destinationip \
to-ports=$destinationport comment="Redirect dynamic ip addresses";