Community discussions

MikroTik App
 
ozolsk
just joined
Topic Author
Posts: 18
Joined: Sun Dec 05, 2010 2:58 pm

RB750G port forwarding

Sun Dec 05, 2010 3:26 pm

Hello,
i set up port forward
/ip firewall nat add chain=dstnat dst-port=1234 action=dst-nat protocol=tcp to-address=192.168.1.1 to-port=1234

Now it works from outside, for example 159.148.60.20:1234, (my IP)
but when i try to connect from computer in my network, it doesn't forward to right computer.

I need to create another rule?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7198
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: RB750G port forwarding

Mon Dec 06, 2010 2:52 pm

This is because devices are from the same network and can reach each other directly.

http://wiki.mikrotik.com/wiki/Hairpin_NAT
 
ozolsk
just joined
Topic Author
Posts: 18
Joined: Sun Dec 05, 2010 2:58 pm

Re: RB750G port forwarding

Mon Dec 06, 2010 10:46 pm

thanks for your replay! :)

but i have another question.
In the link, there is note:
"The rule below is very specific to only apply to the traffic that the issue could occur with - if there are many servers the issue occurs with, the rule could be made broader to save having one such exception per forwarded service."

How to make it "broader", if i have multiple servers and ports?
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: RB750G port forwarding

Mon Dec 06, 2010 10:49 pm

/ip firewall nat
add chain=srcnat src-address=192.168.1.0/24 \
  dst-address=192.168.1.2 protocol=tcp dst-port=80 \
  out-interface=LAN action=masquerade
becomes
/ip firewall nat
add chain=srcnat src-address=192.168.1.0/24 \
  dst-address=192.168.1.0/24 \
  out-interface=LAN action=masquerade
That would be about as broad as you could get. Of course you need to adjust for your own IP addressing scheme.
 
DonGould
newbie
Posts: 26
Joined: Fri Dec 31, 2010 7:50 am

Re: RB750G port forwarding

Mon Jan 03, 2011 9:41 am

What do I need to set up to make a dns entry resolve to the right places?

eg.

www.my750g.co.nz --> myPublicIP... -->iface1<--RB750G-->iface2(192.168.2.1)<-dumb switch->192.168.1.150(MyWebServer)

How do I set up the dns correctly so that my desktop(192.168.1.123) also sees 'myWebServer' for port 80...

With my old linux box this was simple... I just ran the web server on 192.168.2.1 and if I wanted to expose the web server on .150 I'd just use a rewrite rule on apache on .1 to write the content from .150.

But with my new 750 as the firewall I'm not running a web server on it but I still want my domain name to resolve correctly for each service.

ssh for example I want to go to the 750.

SMTP & www I want on .150

Can anyone point me to what I need to read or share some example set up scripts?

TIA

D
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: RB750G port forwarding

Mon Jan 03, 2011 4:06 pm

Just port forward only the relevant services to whatever machine runs them. Maybe I'm misunderstanding what you're trying to do?
 
DonGould
newbie
Posts: 26
Joined: Fri Dec 31, 2010 7:50 am

Re: RB750G port forwarding

Tue Jan 04, 2011 2:10 am

Maybe I'm misunderstanding what you're trying to do?
In my case I just recently had a site where the customer was using an ip address to direct traffic at a database/application server.

The client software was configured the same for users both in the building on the local lan and outside the building at remote sites.

The Thompson router supplied by the ISP simply redirected the requests for the ip/port combination to the internal machine.

Even the internal machine (server) was being used as a client, and it's client software would send requests to the router which would then come back at it self. (Yes I know how dumb that sounds, but it worked and they weren't about to pay anyone to set up a more technically better solution).

However, I can see what the 750 can do, so I think I'll go off and have a play and just nut it out. :)