Community discussions

MikroTik App
 
dejanp
newbie
Topic Author
Posts: 37
Joined: Wed Oct 08, 2008 4:57 pm

PCC with dinamyc IP

Mon Feb 15, 2010 9:58 pm

Hi,

I need to configure PCC for 3 connections, two of them are cable modems, dynamic IP and one is PPPoE, dynamic IP too.

For a moment I saw examples with static IP only and that didn't work for me. I have tested with two connections and this will not work without specified IP gateway for each routing mark and I am not sure is there is another way to do it. There is always possibility to made script which will read what DHCP client and PPPoE clients get, to run script each min and to look for difference, to rebuild all ... I don't like complicated solutions, there shall be something better ?

Something like (I know, this won't work but why ?):
add dst-address=0.0.0.0/0 gateway=wlan1 routing-mark=to_wlan1 check-gateway=ping
instead of :
add dst-address=0.0.0.0/0 gateway=10.111.0.1 routing-mark=to_wlan1 check-gateway=ping


Another question :
if I have two DHCP clients and have assigned for both of them "add default route", why this must be exclusive ? When second client add default route this disables previous one default route and this again pushing me to scripts, not to use automatic default rute but to run script and to made "static" route (if can be called static route something checked every 1 minute).

Thank you in advance,
Dejan

btw. Article http://wiki.mikrotik.com/wiki/PCC may be confusing. In first part 10.111.0.0/24 is assigned to wlan1 and in second part this is assigned to wlan2.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: PCC with dinamyc IP

Mon Feb 15, 2010 11:58 pm

are your non-pppoe gateways dynamic?..
 
dejanp
newbie
Topic Author
Posts: 37
Joined: Wed Oct 08, 2008 4:57 pm

Re: PCC with dinamyc IP

Tue Feb 16, 2010 5:04 am

all 3 are dynamic :

2 cable modem, dhcp dynamic (may have more then 2 connections)
1 pppoe, dynamic
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: PCC with dinamyc IP

Tue Feb 16, 2010 12:38 pm

I mean, you have dynamic IP address... but gateway should be static - so you simply add static routes for your Ethernet uplinks, and then use gateway=pppoe-out1 for your 3rd uplink
 
logros
newbie
Posts: 49
Joined: Thu Feb 04, 2010 11:01 pm

Re: PCC with dinamyc IP

Tue Feb 16, 2010 1:28 pm

i have the same situation
my config work but i dont know well or not :))

3 ISP dynamic PPPoE and 1 LAN port

/ ip firewall mangle
add chain=input in-interface=pppoe-out1 action=mark-connection new-connection-mark=wan1_conn
add chain=input in-interface=pppoe-out2 action=mark-connection new-connection-mark=wan2_conn
add chain=input in-interface=pppoe-out3 action=mark-connection new-connection-mark=wan3_conn


add chain=output connection-mark=wan1_conn action=mark-routing new-routing-mark=to_wan1
add chain=output connection-mark=wan2_conn action=mark-routing new-routing-mark=to_wan2
add chain=output connection-mark=wan3_conn action=mark-routing new-routing-mark=to_wan3



add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:3/0 \
action=mark-connection new-connection-mark=wan1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:3/1 \
action=mark-connection new-connection-mark=wan2_conn passthrough=yes

add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:3/2 \
action=mark-connection new-connection-mark=wan3_conn passthrough=yes

add chain=prerouting connection-mark=wan1_conn in-interface=Local action=mark-routing new-routing-mark=to_wan1
add chain=prerouting connection-mark=wan2_conn in-interface=Local action=mark-routing new-routing-mark=to_wan2
add chain=prerouting connection-mark=wan3_conn in-interface=Local action=mark-routing new-routing-mark=to_wan3

/ ip route
add dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_wan1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out2 routing-mark=to_wan2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out3 routing-mark=to_wan3 check-gateway=ping

add dst-address=0.0.0.0/0 gateway=pppoe-out1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out2 distance=2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=pppoe-out3 distance=3 check-gateway=ping

/ ip firewall nat
add chain=srcnat out-interface=pppoe-out1 action=masquerade
add chain=srcnat out-interface=pppoe-out2 action=masquerade
add chain=srcnat out-interface=pppoe-out3 action=masquerade
 
dejanp
newbie
Topic Author
Posts: 37
Joined: Wed Oct 08, 2008 4:57 pm

Re: PCC with dinamyc IP

Tue Feb 16, 2010 2:27 pm

I mean, you have dynamic IP address... but gateway should be static - so you simply add static routes for your Ethernet uplinks, and then use gateway=pppoe-out1 for your 3rd uplink
The problem is because static routes didn't work well. I am doing testing with two cable modem connections right now and, if I add default route to interface instead of default gateway IP that didn't work by some reason. If I add static routes after DHCP client get addresses that working but that IP may change anytime and I don't want to think about that.

two dhcp clients assigned to two ports, both getting default gateway results is :
wan1 111.111.111.111/24 gateway 111.111.111.1
wan2 222.222.222.222/24 gateway 222.222.222.1

in routing table both show as assigned as default gateway but one is disabled, randomly.

after static routes are added there are extra records in routing table, some of them dissabled but all working OK. If I delete default route to gateway IP (111.111.111.1) and add default route to interface wan1 this just don't working, can't connect anywhere.

as I can see best way is to have disabled default route in dhcp client, once dhcp client get IP to check what is gateway for each one interface and to made static routes. I have tried that and this is working but, in order to have this working after IP change I need to made script which will check IP on each interface every 1 minute and to recreate all routes if something is changed. Also, would like to have default route to all interfaces, in case one connection drop another connections would take all traffic.

So, my question is : shall routes working to interface instead of IP when IP is dynamic ? Maybe I am doing something wrong, I have done something like that already on debian couple years ago, only one difference was because all IP were fixed.

Thank you,
Dejan
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: PCC with dinamyc IP

Tue Feb 16, 2010 2:52 pm

if I add default route to interface instead of default gateway IP that didn't work by some reason
it works only for tunnel interfaces (pppoe, etc)

so, your gateway address is dynamic too?.. it's crazy...
 
logros
newbie
Posts: 49
Joined: Thu Feb 04, 2010 11:01 pm

Re: PCC with dinamyc IP

Tue Feb 16, 2010 5:07 pm

))) you are right it's crazy)))))
:shock: )))))
 
dejanp
newbie
Topic Author
Posts: 37
Joined: Wed Oct 08, 2008 4:57 pm

Re: PCC with dinamyc IP

Tue Feb 16, 2010 10:00 pm

if I add default route to interface instead of default gateway IP that didn't work by some reason
it works only for tunnel interfaces (pppoe, etc)

so, your gateway address is dynamic too?.. it's crazy...
Yup. This may change subnet and mask. For example, IP can be 80.80.80.2/22 and next time can be 90.90.90.2/24 (yup, this switch class A).

OK, then I have clear that need to made script.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8712
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: PCC with dinamyc IP

Wed Feb 17, 2010 12:29 am

I wonder how can they change gateway's address on the fly...
 
dejanp
newbie
Topic Author
Posts: 37
Joined: Wed Oct 08, 2008 4:57 pm

Re: PCC with dinamyc IP

Wed Feb 17, 2010 5:18 am

dhcp lease is 24 hours, that usually don't change for days and weeks and then they work on something and this all reset. I don't know what is in backgrund but this is local cable provider with bunch /16 IP blocks.

I have done one of scripts needed for route change but can't find how to call script from another script. In all documentations this is mentioned as allowed but I just can't find syntax.
 
pedja
Long time Member
Long time Member
Posts: 687
Joined: Sat Feb 26, 2005 5:37 am

Re: PCC with dinamyc IP

Wed Feb 17, 2010 11:03 am

I guess this is the same I asked long time ago. I actually proposed to Mikrotik to include option that is availiable even on Windows Home: option to set priority of interfaces.

That way, interface can obtain network parameters dynamicaly, including default gateway. If several interfaces obrain default gateway, priority of the interfaces would rule priority of default gateways. That is plain and simple.

For some reason, this is declined.