Community discussions

MikroTik App
 
TIQA
just joined
Topic Author
Posts: 15
Joined: Thu Jul 16, 2015 10:06 pm

need help with dynamic ip NAT

Sun Oct 11, 2015 3:26 pm

how to properly configure NAT with dynamic ip address, so i can open some ports and access them? i've gone through a lot of tutorials, but none of those works for me. tried, instead of giving dst address, to give in interface, but that doesnt work :(
 
zerounu
newbie
Posts: 32
Joined: Thu Jun 07, 2007 1:22 pm
Location: Romania

Re: need help with dynamic ip NAT

Sun Oct 11, 2015 5:29 pm

how to properly configure NAT with dynamic ip address, so i can open some ports and access them? i've gone through a lot of tutorials, but none of those works for me. tried, instead of giving dst address, to give in interface, but that doesnt work :(
- for dynamic ip's you can activate ip cloud function on mikrotik to get a permanent hostname no matter what ip do you have
- for masquerade I use : /ip firewall nat add action=masquerade chain=srcnat out-interface=ether1
- for port rediction I use something like :
/ip firewall nat add action=dst-nat chain=dstnat dst-port=333 protocol=tcp to-addresses=192.168.0.1 to-ports=333
 
TIQA
just joined
Topic Author
Posts: 15
Joined: Thu Jul 16, 2015 10:06 pm

Re: need help with dynamic ip NAT

Mon Oct 12, 2015 10:49 pm

port redirection not working with these settings :(
 
User avatar
chechito
Forum Guru
Forum Guru
Posts: 3196
Joined: Sun Aug 24, 2014 3:14 am
Location: Bogota Colombia
Contact:

Re: need help with dynamic ip NAT

Mon Oct 12, 2015 11:30 pm

maybe you need a script to update the changing ip address on dst-nat rules

do a search for script nat rules
 
kimoo
just joined
Posts: 3
Joined: Tue Oct 06, 2015 2:36 pm

Re: need help with dynamic ip NAT

Thu Oct 15, 2015 11:39 pm

The best way to do dynamic NAT set public rang on wan interface and add NAT rule like
eg: I use 6 public IP
ip address add address=x.x.x.x1/x interface=WAN
ip address add address=x.x.x.x2/x interface=WAN
ip address add address=x.x.x.x3/x interface=WAN
ip address add address=x.x.x.x4/x interface=WAN
ip address add address=x.x.x.x5/x interface=WAN
ip address add address=x.x.x.x6/x interface=WAN
after that add NAT rule
 chain=srcnat action=src-nat to-addresses=x.x.x.x - x.x.x.x     
 src-address-list="privet-network "  out-interface=WAN log=no log-prefix=""