Community discussions

MikroTik App
 
XTLMeth
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Sep 07, 2009 7:10 am

2 Dynamic Connections on same subnet.

Fri Jan 08, 2010 7:45 am

So here's a problem I am having. I have 2 cable modems one with a 5mbit limit and one with a 10mbit limit. I have setup PCC with mikrotik before but never with 2 dynamic ips on the same subnet.

Modem A:
72.24.169.111/23 with GW of 72.24.168.1

Modem B:
72.24.169.223/23 with GW of 72.24.168.1

LAN:
192.168.1.0/24

the problem isn't PCC it's routing since both modems have ips in the same subnet and share the same gateway. I have done this in the past with home made linux routers but I would like to figure out how to get this to work with Mikrotik. I need to be able to tell the router that if the connection is going out modem B not to pick the first route in the list and send it out modem A all the time.

in linux I create 2 routing tables

Table 1:
ip route add 72.24.168.0/23 dev eth0 proto kernel scope link src 72.24.169.111 table 1
ip route add 192.168.1.0/24 dev eth3 proto kernel scope link src 192.168.1.1 table1
ip route add default via 72.24.168.1 dev eth0 table 1

Table 2:
ip route add 72.24.168.0/23 dev eth1 proto kernel scope link src 72.24.169.223 table 2
ip route add 192.168.1.0/24 dev eth3 proto kernel scope link src 192.168.1.1 table 2
ip route add default via 72.24.168.1 dev eth1 table 2

Then I do ip rule:

ip rule add from 72.24.169.111 table 1 prio 100
ip rule add from 72.24.169.223 table 2 prio 200
ip rule add fwmark 1 table 1 prio 1000
ip rule add fwmark 2 table 2 prio 2000

Then in iptables I just mark on the mangle table where I want stuff to go and it sends it that direction but for some reason I can't figure out how to accomplish this with mikrotik. The key here is when you look at the 2 routing table you see what is spacific is each routing table has the same subnet but different interfaces.

I will be setting this router up for a LAN party in february and instead of hauling my big pc linux box I would like to take my routerboard 600 with instead.

I almost forgot. I don't want to load balance them but be able to take ip's/procols/servers and have the router send them out spacific interfaces for things like online games or file downloads. The idea is to be able to seperate traffic to keep things running smooth.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8393
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 2 Dynamic Connections on same subnet.

Fri Jan 08, 2010 9:23 pm

if these are tunneling interfaces, then simply use interface name instead of GW IP:
/ip route add routing-mark=channel1 gateway=ModemA
/ip route add routing-mark=channel2 gateway=ModemB
if it's broadcast interfaces, then use the following syntax:
/ip route add routing-mark=channel1 gateway=72.24.168.1%ModemA
/ip route add routing-mark=channel2 gateway=72.24.168.1%ModemB
for second case in v3 you will need to have routing-test package installed
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
XTLMeth
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Sep 07, 2009 7:10 am

Re: 2 Dynamic Connections on same subnet.

Fri Jan 08, 2010 11:39 pm

I am running version 4.4 on all my devices. I tried the gateway=ip%interface thing but the issue I have is when ever the router is rebooted or the interface is disabled/enabled it goes back to gateway=ip and I have redo the routes. Is there a way to make that stick?

If I use just the gateway=modema then the gateway address isn't specified and the packets don't know where to go.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8393
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 2 Dynamic Connections on same subnet.

Sat Jan 09, 2010 1:16 am

when ever the router is rebooted or the interface is disabled/enabled it goes back to gateway=ip and I have redo the routes. Is there a way to make that stick?
huh... seems like a 'feature to be fixed' =) Maris? =)
If I use just the gateway=modema then the gateway address isn't specified and the packets don't know where to go.
it's not for Ethernet, it's for tunneling interfaces (pptp, pppoe, etc)
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
XTLMeth
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Sep 07, 2009 7:10 am

Re: 2 Dynamic Connections on same subnet.

Sat Jan 09, 2010 6:00 am

Example of what's happening. This is a mikrotik I have in the lab for playing around with.

[admin@MikroTik] > ip route add gateway=24.116.80.1%ether1 routing-mark=table3
[admin@MikroTik] > ip route export
/ip route
add check-gateway=ping comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=24.116.80.1 \
routing-mark=to_wan1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=216.161.237.206 routing-mark=\
to_wan2 scope=30 target-scope=10
add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=24.116.80.1%ether1 routing-mark=table3 scope=30 \
target-scope=10
add check-gateway=ping comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=24.116.80.1 scope=30 \
target-scope=10
add check-gateway=ping comment="" disabled=no distance=2 dst-address=0.0.0.0/0 gateway=216.161.237.206 scope=30 \
target-scope=10
add comment="" disabled=no distance=1 dst-address=192.168.0.0/24 gateway=ether2 scope=30 target-scope=10
[admin@MikroTik] >


Then after I disable the route then re-enable it I get...

[admin@MikroTik] > ip route export
/ip route
add check-gateway=ping comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=24.116.80.1 \
routing-mark=to_wan1 scope=30 target-scope=10
add check-gateway=ping disabled=no distance=1 dst-address=0.0.0.0/0 gateway=216.161.237.206 routing-mark=\
to_wan2 scope=30 target-scope=10
add comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=24.116.80.1 routing-mark=table3 scope=30 \
target-scope=10
add check-gateway=ping comment="" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=24.116.80.1 scope=30 \
target-scope=10
add check-gateway=ping comment="" disabled=no distance=2 dst-address=0.0.0.0/0 gateway=216.161.237.206 scope=30 \
target-scope=10
add comment="" disabled=no distance=1 dst-address=192.168.0.0/24 gateway=ether2 scope=30 target-scope=10


As you can see the the ip is the only part that came back.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8393
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 2 Dynamic Connections on same subnet.

Sat Jan 09, 2010 2:35 pm

just checked - you should not use WinBox while working with that route. it doesn't support that syntax. if you disable and enable the route via CLI - all is okay, but as soon you disable the route with WinBox - it losts '%interface' part
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
XTLMeth
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Sep 07, 2009 7:10 am

Re: 2 Dynamic Connections on same subnet.

Sun Jan 10, 2010 1:25 am

Is it intentionally designed that way for a reason? If not it still seems like a bug or an incomplete feature. It would be nice to be able to modify this with winbox. I find it funny that I say that considering I love CLI based stuff.

I still have to put the gateway=ip%interface thing into practice. I am waiting for a couple more routers to come from ups this week so I can start testing. I have one in the lab but i don't want to modify it as it's actually doing something. :-D
 
XTLMeth
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Sep 07, 2009 7:10 am

Re: 2 Dynamic Connections on same subnet.

Sun Jan 10, 2010 9:36 pm

OH man you weren't kidding about messing with routes in winbox that were created from the CLI. After adding a few routes from the CLI then deleting them through winbox they are now stuck in the router. I rebooted the router and the routes that I deleted from winbox came back! So then I tried to delete them from CLI and the router doesn't freeze but hangs and wont delete the routes. So I tried once again the remove through winbox and rebooted and they come back. I think the only way I can get rid of them is to reset the router to factory. This is good to know because I would hate to having something in production and have to wipe a router config to undo something.

[admin@MikroTik] > ip route remove 2
action timed out - try again, if error continues contact MikroTik support and send a supout file (13)
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8393
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 2 Dynamic Connections on same subnet.

Mon Jan 11, 2010 9:02 am

that problem with routes in v4.4 will be fixed in v4.5
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
XTLMeth
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Sep 07, 2009 7:10 am

Re: 2 Dynamic Connections on same subnet.

Mon Jan 11, 2010 9:43 pm

So now I restored to a previous config so all those funky routes I was playing with are gone but now I'm even more frustrated. I previously has this router setup to do PCC for 1 dynamic ip and 1 static ip. After I restored the backup config I proceeded to test the config by disabled or unplugging one of the ISPs to make sure the internet would continue to function. This was not the case after doing this a couple times so I thought ok just to make sure it isn't me I left one wan disable and reboot the router. Everything seemed to work fine so I did the same or the other side. After the reboot it works fine so I enabled both and everything works well. Where I run into troubles is when I fail one side then bring it back then fail again (flapping). After this I can't get the router to behave normally. My traceroutes time out randomly and my pings go anywhere from timeout to 400+ ms to someone normal response time. I'm frustrated enough to give up at this point. :(

EDIT: It seems I'm doing something wrong with this whole mess as others seem to get this stuff to function properly or they don't talk about it and just deal with the issues. I'm almost to the point to pay someone to look at my configs and tell me where I'm wrong.

Who is online

Users browsing this forum: Baidu [Spider], ctlo, Kobe14, marisp, markos222, ulrickaka and 67 guests