Page 1 of 1

Multi gateway pppoe and static

Posted: Fri Jul 30, 2021 5:45 pm
by cooling
i have 3 connections, 2 pppoe and 1 static ip, how to make that gateway can be 1 routing? does anyone have a script for that?

thanks for advice

Re: Multi gateway pppoe and static

Posted: Fri Jul 30, 2021 5:48 pm
by rextended
Explain better and probably someother help you

Re: Multi gateway pppoe and static

Posted: Sat Jul 31, 2021 5:29 am
by cooling
Explain better and probably someother help you
I have 2 pppoe accounts dynamically, and 1 static account, can with a script we can enter the ip route in 1 comment?
:local newgw1 [/ip address get [find interface="pppoe-out1"] network];
:local newgw2 [/ip address get [find interface="pppoe-out2"] network];
:local routegw1 [/ip route get [find comment="Test"] gateway ];
:local routegw2 [/ip route get [find comment="Test"] gateway ];
:if ($newgw1 != $routegw1),($newgw2 != $routegw2) do={
     /ip route set [find comment="Test"] gateway=$newgw1,$newgw2;
}

Re: Multi gateway pppoe and static

Posted: Sat Jul 31, 2021 10:58 am
by Jotne
@cooling
No need for crossposing same question in multiple threads.

Re: Multi gateway pppoe and static

Posted: Sat Jul 31, 2021 11:11 am
by cooling
ok Jotne , i'am sorry

Re: Multi gateway pppoe and static

Posted: Sat Jul 31, 2021 8:02 pm
by mbaute
hi cooling,

You shouldn't be doing this at all because it will break most of your nat'd connections over pppoe interfaces (/ip route set [find comment="Test"] gateway=$newgw1,$newgw2; this will do ecmp and multi socket like https will go haywire)

Try creating a default route with routing marks and a ppp profile for each of your links, and use the script tab to automate the gateway change and then split traffic using mangle, maybe pcc with source address matcher
/ip route set [find where comment=#pppoe1] gateway=[/ip address get [/ip address find interface=pppoe-cli-1] network]
Regards,

Re: Multi gateway pppoe and static  [SOLVED]

Posted: Sun Aug 01, 2021 7:48 am
by cooling
Solved
:local newgw1 [/ip address get [find interface="pppoe-out1"] network];
:local newgw2 [/ip address get [find interface="pppoe-out2"] network];
:local routegw1 [/ip route get [find comment="Test"] gateway ];
:local routegw2 [/ip route get [find comment="Test"] gateway ];
:if ($newgw1 != $routegw1) do={
/ip route set [find comment="Test"] gateway="$newgw1,$newgw2";

}
Insert route with one comment Test

Thanks All