Community discussions

MikroTik App
 
User avatar
winet
Member Candidate
Member Candidate
Topic Author
Posts: 273
Joined: Fri Mar 16, 2007 4:49 pm
Location: Indonesia

how to do src-nat on dynamic wan IP?

Thu Dec 17, 2009 12:25 pm

it is easy to set the NAT when the WAN IP is static, but how to set it if it is dynamic? for example, the WAN is a PPPoE client.

thanks for any help.
 
Sitron
newbie
Posts: 37
Joined: Wed Jul 29, 2009 11:49 pm
Location: Arendal, Norway

Re: how to do src-nat on dynamic wan IP?

Thu Dec 17, 2009 2:51 pm

Just add a rule:
chain=srcnat action=masquerade src-address=192.168.10.0/24 out-interface=ADSL 
Do not specify the IP, just say which interface.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: how to do src-nat on dynamic wan IP?

Thu Dec 17, 2009 3:47 pm

Exactly, this is my best practice too, even if I have static address i set up interface as outgoing for masquerade (and srcnat).
 
User avatar
winet
Member Candidate
Member Candidate
Topic Author
Posts: 273
Joined: Fri Mar 16, 2007 4:49 pm
Location: Indonesia

Re: how to do src-nat on dynamic wan IP?

Thu Dec 17, 2009 8:29 pm

ok :) point received, thanks
but how about forwarding a WAN port into a local port?

i used to:
chain=dstnat to-address=[local ip] to-ports=[the local ip port] protocol=tcp dst-address=[the static WAN IP] dst-port=6911
 
Sitron
newbie
Posts: 37
Joined: Wed Jul 29, 2009 11:49 pm
Location: Arendal, Norway

Re: how to do src-nat on dynamic wan IP?

Thu Dec 17, 2009 9:12 pm

Here is my setup, it port forwards port 22/tcp, some Bittorrents-ports and 1194/udp to my OpenVPN-server. Actually, all portforwarding is to the same server (192.168.10.5):
 0   chain=srcnat action=masquerade src-address=192.168.10.0/24 out-interface=ADSL 
 1   chain=dstnat action=dst-nat to-addresses=192.168.10.5 to-ports=22 protocol=tcp in-interface=ADSL dst-port=2222 
 2   chain=dstnat action=dst-nat to-addresses=192.168.10.5 to-ports=33600-33605 protocol=tcp in-interface=ADSL 
     dst-port=33600-33604 
 3   chain=dstnat action=dst-nat to-addresses=192.168.10.5 to-ports=1194 protocol=udp in-interface=ADSL dst-port=1194 
I hope you can transfer that output to the corresponding commands :-)
 
User avatar
winet
Member Candidate
Member Candidate
Topic Author
Posts: 273
Joined: Fri Mar 16, 2007 4:49 pm
Location: Indonesia

Re: how to do src-nat on dynamic wan IP?

Thu Dec 17, 2009 9:41 pm

nice, thanks :)
this is useful, i got a project coming soon that require workaround dynamic NAT, gonna test these on it.
 
User avatar
winet
Member Candidate
Member Candidate
Topic Author
Posts: 273
Joined: Fri Mar 16, 2007 4:49 pm
Location: Indonesia

Re: how to do src-nat on dynamic wan IP?

Mon Dec 21, 2009 4:22 am

i have trouble on translating your method with the PCC guide i found on the wiki:
http://wiki.mikrotik.com/wiki/PCC

especially on section:
add chain=prerouting  dst-address=10.111.0.0/24  action=accept in-interface=Local 
add chain=prerouting  dst-address=10.112.0.0/24  action=accept in-interface=Local
please help again, thank you.
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: how to do src-nat on dynamic wan IP?

Mon Dec 21, 2009 9:51 am

that is your local traffic, what problems you have there? When following how-to then try to get meaning of the rule.

Who is online

Users browsing this forum: Bing [Bot], britgent, Google [Bot], mozerd, sindy and 103 guests