Community discussions

MikroTik App
 
User avatar
omidkosari
Trainer
Trainer
Topic Author
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

which ip routed to which address of router

Thu Oct 06, 2011 11:47 am

we have 2 ip addresses on one interface . those 2 ip are gateways for different ip addresses .

how we can mangle which ip addresses routed from outside to 192.168.10.1 and which ip addresses routed from outside to 192.168.11.1 ?
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: which ip routed to which address of router

Thu Oct 06, 2011 12:04 pm

routed or NATed?

with routing there are no problems, ARP and routing will take care of that.
 
User avatar
omidkosari
Trainer
Trainer
Topic Author
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: which ip routed to which address of router

Thu Oct 06, 2011 12:07 pm

routed .
i want to mangle them and do some task with them . i want to know 192.168.10.1 is gateway for which users and 192.168.11.1 is gateway for which ones ?
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: which ip routed to which address of router

Thu Oct 06, 2011 12:13 pm

using mangle you can set routing-mark and then when you have routes that have routing-mark set packets marked with certain routing-mark will be routed by route with same routing-mark
 
User avatar
omidkosari
Trainer
Trainer
Topic Author
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: which ip routed to which address of router

Thu Oct 06, 2011 12:20 pm

i think you misunderstood . i did the task you said at router1 .
now i want to detect which ip addresses routed to which ip addresses at router2 side .
 
User avatar
omidkosari
Trainer
Trainer
Topic Author
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: which ip routed to which address of router

Thu Oct 06, 2011 6:47 pm

at routerA
/ip route print

 0 A S  dst-address=0.0.0.0/0 gateway=192.168.10.1 gateway-status=192.168.10.1 reachable ether1 distance=1 scope=255 target-scope=10 
        routing-mark=first-route-mark 
 1 A S  dst-address=0.0.0.0/0 gateway=192.168.11.1 gateway-status=192.168.11.1 reachable ether1 distance=1 scope=255 target-scope=10 
        routing-mark=second-route-mark 
at routerB i have 192.168.10.1 and 192.168.11.1 on ether3 . now how i can detect (on routerB ) which ip addresses routed from routerA to 192.168.10.1 and which ip addresses routed to 192.168.11.1 ?
 
User avatar
nest
Forum Veteran
Forum Veteran
Posts: 822
Joined: Tue Feb 27, 2007 1:52 am
Location: UK
Contact:

Re: which ip routed to which address of router

Thu Oct 06, 2011 9:46 pm

Are you trying to identify the routing purely for diagnostics purposes or because you are then trying to do something further with the packets on Router B?

Some thoughts.... If you are trying to identify at Router B, what packet came from which routing rule on Router A, how about marking the packets on Router A with a different value in the DSCP(TOS) flag for each of your two routing rules. (The DSCP(TOS) value will survive the transport unmodified between Router A to Router B as long as you are in control of the equipment between those two routers - if there is some other network between, it is possible that the DSCP(TOS) flag can be changed)
 
User avatar
omidkosari
Trainer
Trainer
Topic Author
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: which ip routed to which address of router

Thu Oct 06, 2011 11:10 pm

Thanks for the idea . it shows that you got the situation .
I have thought about dscp and it was a good solution but there is a problem which breaks it . i want to use about 50 ( maybe more ) different routing marks in routerA so dscp is not enough .
 
User avatar
nest
Forum Veteran
Forum Veteran
Posts: 822
Joined: Tue Feb 27, 2007 1:52 am
Location: UK
Contact:

Re: which ip routed to which address of router

Thu Oct 06, 2011 11:44 pm

DSCP can easily cope with 50 different routes, as I recall it is actually limited to 63 or 64? Is that not enough? You did originally only state that you had two routes to identify. It is always better to give the whole story when posting than to over-simplify and then have to change it when our answer is not good for you. LOL
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: which ip routed to which address of router

Thu Oct 06, 2011 11:53 pm

at routerA
/ip route print

 0 A S  dst-address=0.0.0.0/0 gateway=192.168.10.1 gateway-status=192.168.10.1 reachable ether1 distance=1 scope=255 target-scope=10 
        routing-mark=first-route-mark 
 1 A S  dst-address=0.0.0.0/0 gateway=192.168.11.1 gateway-status=192.168.11.1 reachable ether1 distance=1 scope=255 target-scope=10 
        routing-mark=second-route-mark 
at routerB i have 192.168.10.1 and 192.168.11.1 on ether3 . now how i can detect (on routerB ) which ip addresses routed from routerA to 192.168.10.1 and which ip addresses routed to 192.168.11.1 ?
Don't overload IP addresses on the same broadcast domain just like you shouldn't be, anyway. Overloading IPv4 addresses is ugly. Use VLAN subinterfaces instead for the different networks. That'll keep the physical link down to one, but allow you to use in-interface on router B as it would be the VLAN subinterface instead of the physical interface.
 
User avatar
omidkosari
Trainer
Trainer
Topic Author
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: which ip routed to which address of router

Fri Oct 07, 2011 12:04 am

DSCP can easily cope with 50 different routes, as I recall it is actually limited to 63 or 64? Is that not enough? You did originally only state that you had two routes to identify.
Maybe no in near future .
It is always better to give the whole story when posting than to over-simplify and then have to change it when our answer is not good for you. LOL
You are right . sorry . i am lazy :)

Don't overload IP addresses on the same broadcast domain just like you shouldn't be, anyway. Overloading IPv4 addresses is ugly. Use VLAN subinterfaces instead for the different networks. That'll keep the physical link down to one, but allow you to use in-interface on router B as it would be the VLAN subinterface instead of the physical interface.
I am doing it with vlans right now but i am trying to find a way without vlan . main problem is when i put such number of vlans on router it starts some strange behaviors . without vlans everything is fine .
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: which ip routed to which address of router

Fri Oct 07, 2011 3:14 am

Can you quantify "weird behavior"?

The proper solution to your problem is to use VLANs, so it might be worth investing some more time in getting that to work. It's a good, clean solution.

Alternatively, why do you need this at all? What is the reason for wanting to determine what gateway a packet arrived through? Outside a persistent packet mark (DSCP) that isn't really possible if you don't have an interface to go with it. If you're using some mechanism on the downstream router to determine which gateway it is supposed to use for certain traffic streams wouldn't you be able to use the same classification on the upstream router and re-mark based on the same criteria, such as source address?
 
User avatar
omidkosari
Trainer
Trainer
Topic Author
Posts: 640
Joined: Fri Sep 01, 2006 4:18 pm
Location: Canada, Toronto

Re: which ip routed to which address of router

Fri Oct 07, 2011 2:08 pm

The proper solution to your problem is to use VLANs, so it might be worth investing some more time in getting that to work. It's a good, clean solution.
I know and agree and using it right now .
Can you quantify "weird behavior"?
Main problem is at routerA . it is pppoe concentrator and creating many vlans causes random ppp crashes on it . but it is not the purpose of this topic .
Alternatively, why do you need this at all? What is the reason for wanting to determine what gateway a packet arrived through? Outside a persistent packet mark (DSCP) that isn't really possible if you don't have an interface to go with it. If you're using some mechanism on the downstream router to determine which gateway it is supposed to use for certain traffic streams wouldn't you be able to use the same classification on the upstream router and re-mark based on the same criteria, such as source address?
It is a little tricky . the main idea comes from here http://forum.mikrotik.com/viewtopic.php?f=2&t=34792 . i have some dynamic address-lists on routerA which i want them on routerB . syncing with api is not so easy and reliable . so i am trying to mark each address-list with a routing-mark and route it to a unique ip of routerB . in routerB each ip that routed to specific ip should include in specific address-list .

Who is online

Users browsing this forum: Bing [Bot], GoogleOther [Bot], KBW, litogorospe and 54 guests