Community discussions

MikroTik App
 
lemonmagic
newbie
Topic Author
Posts: 39
Joined: Mon Apr 29, 2013 10:32 am

Port Forwarding + internal Network

Fri Sep 27, 2013 10:23 pm

Hi, we have a Mikrotik Router with 2 Port Forwardings enabled, with one being forwarded to an electric Bus System.
The Bus System offers a Software for Iphone / Android which only gives the Possibility to enter 1 Adress.
Now ususally you would enter 2 Adresses -> 1 internal Adress to the System, and one from outside through Port Forwarding.
But as the Software only offers 1 Adress, we would like to only define the Wan Ip to access the System.
Unforunatly the Port Forwarding only works if we really access the System from the Wan Side of our Network. Trying to route from the internal Network, to the outside Wan Adress, Port Forwarding doesn't work.
Would I have to set a simple Firewall Rule, or something special to make it work?

thanks
 
samsung172
Forum Guru
Forum Guru
Posts: 1191
Joined: Sat Apr 04, 2009 3:45 am
Location: Østfold - Norway
Contact:

Re: Port Forwarding + internal Network

Sat Sep 28, 2013 12:55 am

You should not have to use a "wan" ip in you bus system.

It should work if you use a internal ip, eg 192.168.1.1 at router, and 192.168.1.2 at bus device. Set 192.168.1.1 as gateway, and put both to a switch. You should then be able to connect to it trough the other port at switch in the internal range (depends on the netmask and or routing at router for internal ip's)

At router you make a dst nat roule. Lets say you want to access a web server at your bus devise. Then you put an inbound dst nat, 80 as dest port, protocol tcp, dst address your wan ip, and action dst-nat address 192.1681.2 and port 80.

ros code

/ip firewall nat add action=dst-nat chain=dstnat dst-address=yourwanip dst-port=80 protocol=tcp to-addresses=192.168.1.2 to-ports=80
 
lemonmagic
newbie
Topic Author
Posts: 39
Joined: Mon Apr 29, 2013 10:32 am

Re: Port Forwarding + internal Network

Sat Sep 28, 2013 7:53 am

thanks,

but your Code is only a simple port forwarding as I do it now, which lacks the functionality to access the internal Device from the internal Network through the Wan Side.
I have seen in the Forums that I would have to src-nat the same route back to the Wan Side, but therefor it seems that I will need to have a static IP which I don't have from my Provider.
 
User avatar
Caci99
Forum Guru
Forum Guru
Posts: 1075
Joined: Wed Feb 21, 2007 2:26 pm
Location: Tirane
Contact:

Re: Port Forwarding + internal Network

Sat Sep 28, 2013 12:34 pm

 
lemonmagic
newbie
Topic Author
Posts: 39
Joined: Mon Apr 29, 2013 10:32 am

Re: Port Forwarding + internal Network

Mon Sep 30, 2013 2:23 pm

Awesome Caci99, it finally works!

Here is the Code Snippet which worked for me:
/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
thanks again

Who is online

Users browsing this forum: Google [Bot], mkx, mszru, sas2k, vetal12311 and 206 guests