Community discussions

MikroTik App
 
epc
just joined
Topic Author
Posts: 5
Joined: Thu Jun 01, 2017 10:21 am

Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 10:32 am

How Link a port from the WAN to 2 lan host ? : wan 192.168.55.56:2422 - > LAN hosts same bridge 192.168.88.56:2422 & 192.168.88.186:2422
 
User avatar
hgonzale
Member Candidate
Member Candidate
Posts: 272
Joined: Thu Nov 06, 2014 1:12 pm
Location: Fuengirola, Spain
Contact:

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 12:51 pm

Impossible. Is not a mikrotik issue, is a logical issue. How could you (the router) determine what is the correct destination between two packages?
 
User avatar
matiaszon
Member
Member
Posts: 320
Joined: Mon Jul 09, 2012 9:26 am

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 1:15 pm

As @hgonzale says - impossible.
The only thing you can do is to determine another external port and forward it to the desired port of the other device, for example:

1st device
forward external port 80 to IP 192.168.1.10 internal port 80

2nd device
forward external port 81 to IP 192.168.1.11 internal port 80
 
epc
just joined
Topic Author
Posts: 5
Joined: Thu Jun 01, 2017 10:21 am

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 1:23 pm

only one host active, second passive ->
Full task: 2 wan interfases 1st 192.168.55.56 second 192.168.55.186
2 lan interfaces 1st 192.168.88.56 second 192.168.88.186
From the first wan go the requests 2421 to lan hosts
From the second wan go the requests 2422 to lan hosts.
How to split requests or switch considering that only 1 of them is active
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2880
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 2:27 pm

So ... it is possible as you have two totally different redirects.

The first is from IPA:port2421 to LAN IP1:port2421
The second from IPB:port2422 to LAN IP2:port2422

The problem is with "one is active". What means "one is active" ?

Check this https://wiki.mikrotik.com/wiki/Manual:I ... ernal_host
 
epc
just joined
Topic Author
Posts: 5
Joined: Thu Jun 01, 2017 10:21 am

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 2:45 pm

So ... it is possible as you have two totally different redirects.

The first is from IP1:port2421 to LAN IP1:port2421
The second from IP2:port2422 to LAN IP2:port2422

The problem is with "one is active". What means "one is active" ?

Check this https://wiki.mikrotik.com/wiki/Manual:I ... ernal_host
Yes, that is right
1 chain=dstnat action=dst-nat to-addresses=192.168.88.56 protocol=tcp       dst-address=192.168.55.186 dst-port=2422 
  2   chain=dstnat action=dst-nat to-addresses=192.168.88.56 protocol=tcp       dst-address=192.168.55.56 dst-port=2421 
2 Hosts listen to ports 2421 and 2422 while only one responds, the one that is at the moment the main one, they have an interconnect for changing roles.

It is necessary as that to provide switching or activation of rules NAT in a case when 2 host becomes the MAIN ->
1 chain=dstnat action=dst-nat to-addresses=192.168.88.186 protocol=tcp       dst-address=192.168.55.186 dst-port=2422 
  2   chain=dstnat action=dst-nat to-addresses=192.168.88.186 protocol=tcp       dst-address=192.168.55.56 dst-port=2421 
Or some other option, to solve the problem ...
 
User avatar
juliokato
Member Candidate
Member Candidate
Posts: 228
Joined: Mon Oct 26, 2015 4:27 pm
Location: Brazil

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 3:22 pm

I believe this can be treated as a feature request to be implemented by Mikrotik.
Because large vendors already have a server load balanced solution: F5 Networks, A10, Cisco...
There is even an open source implementation.
Is a very lucrative market as companies are looking for this high availability solution.
 
epc
just joined
Topic Author
Posts: 5
Joined: Thu Jun 01, 2017 10:21 am

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 4:54 pm

Any ideas? What can be done to solve the problem ... :(
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2880
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 4:54 pm

...It is necessary as that to provide switching or activation of rules NAT in a case when 2 host becomes the MAIN -> ...
What do we know from which server is MAIN at the moment ?
Do I understand that it is router role to decide which one is MAIN ? Do you need, mentioned earlier, load balancer ?
 
epc
just joined
Topic Author
Posts: 5
Joined: Thu Jun 01, 2017 10:21 am

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 5:04 pm

...It is necessary as that to provide switching or activation of rules NAT in a case when 2 host becomes the MAIN -> ...
What do we know from which server is MAIN at the moment ?
Do I understand that it is router role to decide which one is MAIN ? Do you need, mentioned earlier, load balancer ?
Servers handle requests on these ports and decide among themselves who is the main one, the router does not participate in this, the servers have additional interfaces (network adapters) on which they decide which of them is the main one.

The default is the master 192.168.88.56.
if he down, 192.168.88.186 becomes the main.

I need advice, a hint how to ensure the reception of requests to the server at the moment being the main
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 2880
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Can Port Forward the Same Port # to 2 Different Internal IP Addresses?

Thu Jun 01, 2017 6:39 pm

Seems to be "quite" easy.
Both servers should have script "fired" on event of becoming main router.
The first server should have script disabling the second rule and enabling the first one
The second server should have opposite script.

Scripts should be started as ssh session to the router...it could look like ... writing pseudopseudocode
/ip firewall nat
set [find where comment=RULESERVERA] disabled=yes
set [find where comment=RULESERVERB] disabled=no

Who is online

Users browsing this forum: Bing [Bot], mansuramir, Zilch and 101 guests