Community discussions

 
ik3umt
Member Candidate
Member Candidate
Topic Author
Posts: 248
Joined: Tue Jul 08, 2014 3:58 pm

Managing two separate subnet with same class addresses

Wed May 29, 2019 10:12 am

Is it possible to manage two LAN having each the same IP subnet both containing machines with same ip address ?

Image

I would say NO, but I'm not aware if Ros has some obscure feature......
I could use netmap to addressing two different subnet , but how to know on wich target machines ?
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 1718
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Managing two separate subnet with same class addresses

Wed May 29, 2019 10:59 am

Why?
Real admins use real keyboards.
 
Sob
Forum Guru
Forum Guru
Posts: 4808
Joined: Mon Apr 20, 2009 9:11 pm

Re: Managing two separate subnet with same class addresses

Wed May 29, 2019 11:08 am

Why not? ;) It's of course better to not have something like this, but if it already happened and it's not possible to change it...

Netmap with some virtual subnets is good first step. Next one would be two routing tables, one for each subnet on different interfaces. And finally mangle rules in prerouting to choose the right routing table based on which virtual subnet is destination.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
ik3umt
Member Candidate
Member Candidate
Topic Author
Posts: 248
Joined: Tue Jul 08, 2014 3:58 pm

Re: Managing two separate subnet with same class addresses

Wed May 29, 2019 11:43 am

Sob, How can I define a virtual subnet to the real one and routing through the right interface ?
I suppose each ethernet has not to be configured with an ip address...
 
anav
Forum Guru
Forum Guru
Posts: 3127
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada

Re: Managing two separate subnet with same class addresses

Wed May 29, 2019 5:03 pm

Why?
So Sob can show off his MT networking skills ;-)
I'd rather manage rats than software. Follow my advice at your own risk! (Sob & mkx forced me to write that!)
 
Sob
Forum Guru
Forum Guru
Posts: 4808
Joined: Mon Apr 20, 2009 9:11 pm

Re: Managing two separate subnet with same class addresses

Thu May 30, 2019 12:00 am

Simple example showing how to set up access from outside:

First some addresses (*):
/ip address
add address=192.168.0.1/24 interface=test1
add address=192.168.0.1/24 interface=test2
Routes in two different routing tables:
/ip route
add dst-address=192.168.0.0/24 gateway=test1 routing-mark=net1
add dst-address=192.168.0.0/24 gateway=test2 routing-mark=net2
Mangle rules (packets to virtual 192.168.91.x will get "net1" routing mark, and packets to virtual 192.168.92.x will get "net2" routing mark):
/ip firewall mangle
add action=mark-routing chain=prerouting dst-address=192.168.91.0/24 new-routing-mark=net1
add action=mark-routing chain=prerouting dst-address=192.168.92.0/24 new-routing-mark=net2
Map virtual networks to real ones:
/ip firewall nat
add action=netmap chain=dstnat dst-address=192.168.91.0/24 to-addresses=192.168.0.0/24
add action=netmap chain=dstnat dst-address=192.168.92.0/24 to-addresses=192.168.0.0/24
Small fix for when this router is not default gateway for both networks:
/ip firewall nat
add action=masquerade chain=srcnat out-interface=test1
add action=masquerade chain=srcnat out-interface=test2
(*) Same address and network on two interfaces like this is of course wrong. For this example, it could be maybe a little less wrong with /32 netmask.

This example also shows only the basic idea, the RB won't work as default gateway for both subnets. It could, but it would require additional connection marking. But since I don't know how exactly is everything connected, I won't bother with that now.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
ik3umt
Member Candidate
Member Candidate
Topic Author
Posts: 248
Joined: Tue Jul 08, 2014 3:58 pm

Re: Managing two separate subnet with same class addresses

Thu May 30, 2019 2:31 am

I didn't know more interfaces can be configured with the same ip address and subnet , I thought this would mess up things.

It happens, rarely, but happens, you find a place having the same addressing i.e. for PC and for ip cameras or ip telephony, completely separated , each with its own switch (sometimes ip cameras network stand-alone without a router) and you're asked for managing both remtely......

Surely I'll give it a try !
 
Sob
Forum Guru
Forum Guru
Posts: 4808
Joined: Mon Apr 20, 2009 9:11 pm

Re: Managing two separate subnet with same class addresses

Thu May 30, 2019 3:48 am

I thought it was clear that it does mess things up. :) The fact that to some extent it's possible to make it work doesn't change that it's wrong. If it's at all possible, the config should be changed into something clean, i.e. either join the networks correctly, or renumber some.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply.
 
ik3umt
Member Candidate
Member Candidate
Topic Author
Posts: 248
Joined: Tue Jul 08, 2014 3:58 pm

Re: Managing two separate subnet with same class addresses

Thu May 30, 2019 12:53 pm

No, wait, I haven't undesrtood if two eth with the same ip address and class on the same routerboard is IMPOSSIBLE (don't work) or is WRONG (but works because of using interface names and routing marks).

Each LAN has it own gateway (not the routerboard).
 
savage
Forum Guru
Forum Guru
Posts: 1213
Joined: Mon Oct 18, 2004 12:07 am
Location: Cape Town, South Africa
Contact:

Re: Managing two separate subnet with same class addresses

Thu May 30, 2019 2:36 pm

Only way to do this without messing things up, is to use a VRF
Regards,
Chris

Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 22 guests