Community discussions

MikroTik App
 
MathiasPM
just joined
Topic Author
Posts: 2
Joined: Tue Jun 28, 2022 11:33 am

Connecting to multiple devices with same IP-address

Tue Jun 28, 2022 11:48 am

Hello
Im completely new to MikroTik's and networking in general. I've searched the forum, but need something of a clear answer.

My problem is, that i have 4 identical indsutrial machines which have the exact same IP-addresses. The addresses is like:

192.168.0.2
192.168.0.20
192.168.0.90

I need to accsess all four machine from a SCADA server, with the IP of 172.168.0.1.

Is it possible to connect machine 1 to port 1 on the router, machine 2 on port 2 and so on - and after that use NAT to translate the ip addresses like this:

Machine 1 internal ip : 192.168.0.2 on port 1 - external address: 172.168.0.10
Machine 2 internal ip : 192.168.0.2 on port 2 - external address: 172.168.0.20
.... and so on.
The first thing i am worried about ip-conflicts, but hope it is possible to isolate the ports in som way.
I cannot change the IP-adresses of each machine.

The router im going to use is MikroTik RB2011UiAS-RM Router.
 
Sob
Forum Guru
Forum Guru
Posts: 9119
Joined: Mon Apr 20, 2009 9:11 pm

Re: Connecting to multiple devices with same IP-address

Tue Jun 28, 2022 1:13 pm

 
MathiasPM
just joined
Topic Author
Posts: 2
Joined: Tue Jun 28, 2022 11:33 am

Re: Connecting to multiple devices with same IP-address

Tue Jun 28, 2022 4:41 pm

Thank you Sob. I am not sure how to implement it at my project, but i will keep looking. Thanks again.
 
Sob
Forum Guru
Forum Guru
Posts: 9119
Joined: Mon Apr 20, 2009 9:11 pm

Re: Connecting to multiple devices with same IP-address

Wed Jun 29, 2022 12:41 am

You didn't choose exactly easy thing to start with. If I take the first example, with your addresses it should be:
/ip address
add address=172.168.0.10/24 interface=ether1
add address=172.168.0.20/24 interface=ether1
...
add address=192.168.0.1 interface=ether2
add address=192.168.0.1 interface=ether3
...
/ip firewall mangle
add action=mark-connection chain=prerouting dst-address=172.168.0.10 new-connection-mark=port1
add action=mark-connection chain=prerouting dst-address=172.168.0.20 new-connection-mark=port2
...
add action=mark-routing chain=prerouting connection-mark=port1 new-routing-mark=port1 passthrough=no
add action=mark-routing chain=prerouting connection-mark=port2 new-routing-mark=port2 passthrough=no
...
/ip firewall nat
add action=dst-nat chain=netmap dst-address=172.168.0.10 to-addresses=192.168.0.2
add action=dst-nat chain=netmap dst-address=172.168.0.20 to-addresses=192.168.0.2
...
add action=masquerade chain=srcnat out-interface=ether2
add action=masquerade chain=srcnat out-interface=ether3
...
/ip route
add dst-address=192.168.0.0/24 gateway=ether2 routing-mark=port1
add dst-address=192.168.0.0/24 gateway=ether3 routing-mark=port2
...
Where ether1 is where you have the server and ether2-x is for those machines with fixed addresses.

And btw, 172.168.x.x are public addresses that you shouldn't be using in LAN. Private range is only 172.16.0.0/12, i.e. 172.16-31.x.x.

Who is online

Users browsing this forum: No registered users and 46 guests