Community discussions

MUM Europe 2020
 
jielun
just joined
Topic Author
Posts: 1
Joined: Thu Oct 17, 2019 4:46 pm

Load Balancing 3 ISP

Thu Oct 17, 2019 4:48 pm

Currently i'm having trouble with load balancing with 3 ISP
ISP1: Dynamic IP
ISP2: Static IP
ISP3: Static IP

The problem is i can't configure that 3 ISP line to load balance because ISP1 Have a dynamic ip which frequently change could anyone kind enough to help me with this ?
 
Sob
Forum Guru
Forum Guru
Posts: 5177
Joined: Mon Apr 20, 2009 9:11 pm

Re: Load Balancing 3 ISP

Thu Oct 17, 2019 9:32 pm

How exactly dynamic? If it's from dhcp, it has support for lease script. If it's PPPoE, it has something similar somewhere in PPP profile. And if the script looks too complex, another way is to create static config and only update some rule(s) (example).
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply. Not intended as incentive for masochists.
 
Zacharias
Forum Guru
Forum Guru
Posts: 1437
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Load Balancing 3 ISP

Thu Oct 17, 2019 11:30 pm

You can load balance them just fine...

Most of the load balancing setups i have to my customers are with dynamic IPs, either with dhcp clients or PPPoE clients...

I dont see where the problem is...
 
Sob
Forum Guru
Forum Guru
Posts: 5177
Joined: Mon Apr 20, 2009 9:11 pm

Re: Load Balancing 3 ISP

Fri Oct 18, 2019 3:51 am

Ok, small correction, it's actually very easy with PPPoE, because it can simply use interface as gateway and doesn't need any scripts (sorry, slipped my mind).

But what you do with DHCP? You need a routing table with gateway from DHCP, don't you?
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply. Not intended as incentive for masochists.
 
Zacharias
Forum Guru
Forum Guru
Posts: 1437
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Load Balancing 3 ISP

Fri Oct 18, 2019 8:28 am

Well yes... i mean you can assign a static address to your router even if there is a dhcp server before your router...
so its not a problem
 
Sob
Forum Guru
Forum Guru
Posts: 5177
Joined: Mon Apr 20, 2009 9:11 pm

Re: Load Balancing 3 ISP

Fri Oct 18, 2019 11:41 pm

It depends. If ISP would have completely dynamic config where both address and default gateway can be different every time, any static config on your router wouldn't work.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply. Not intended as incentive for masochists.
 
Zacharias
Forum Guru
Forum Guru
Posts: 1437
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Load Balancing 3 ISP

Sat Oct 19, 2019 5:41 pm

It depends. If ISP would have completely dynamic config where both address and default gateway can be different every time, any static config on your router wouldn't work.
I really dont understand what you mean!!!
Never seen any ISPs router in my life changing its default IP by it self whenever it wants!!!

Also am talking by experience with configurations i use in my customers which they perfectly work...
 
Sob
Forum Guru
Forum Guru
Posts: 5177
Joined: Mon Apr 20, 2009 9:11 pm

Re: Load Balancing 3 ISP

Sat Oct 19, 2019 6:00 pm

Routers don't change IPs by themselves, but their admins can do that. There are two basic scenarios:

a) If there's some additional router/modem between you and ISP and it actually works as router and RB get address from its DHCP server, then for you it's like static config, nothing will change there.

b) If RB is connected directly to ISP and it gets address from their DHCP, you have no control over that. If ISP decides to use completely different network, any static config on RB will break. They probably won't change it, because why would they, but it's not impossible.
People who quote full posts should be spanked with ethernet cable. Some exceptions for multi-topic threads may apply. Not intended as incentive for masochists.
 
User avatar
che
Frequent Visitor
Frequent Visitor
Posts: 94
Joined: Fri Oct 07, 2005 1:04 pm

Re: Load Balancing 3 ISP

Mon Oct 21, 2019 3:33 pm

If you are using DHCP, you could call a simple "cleanup" script with each client lease change. Add similar script either to DHCP client section, or call it from there after adding it to the /system scripts section:

:global fwIP
:local dhcpIP

:local readIP [/ip address get value-name=address [/ip address find where actual-interface="ether1 - dhcp isp" and network!=192.168.0.0 and network!=192.168.100.0]];
:local dhcpGW [/ip dhcp-client get value-name=gateway number=0];

:set dhcpIP [:pick $readIP 0 [:find $readIP "/"]];

:if ($dhcpIP != $fwIP) do={
       /ip firewall connection remove [find reply-dst-address~$fwIP]
       :set fwIP $dhcpIP
       /ip firewall address-list set [/ip firewall address-list find comment="WAN - dhcp"] address=$dhcpIP
       /ip dns static set [/ip dns static find name="dhcp.gw"] address=$dhcpGW
       /ip firewall nat set [/ip firewall nat find comment="src-nat"] to-addresses=$fwIP
       :log info "dhcp WAN IP updated. NAT and routes fixed. Purged connections via dead IP."
}

If you have a local address for accessing your modem/router via DHCP gateway I explicitly added conditon not to look for local network. The loop that figures out that IP has changed alters various things that depend on the DHCP client and gateway IP.

You can adjust this to your liking and adjust it for PPPoE or similar client setups. I presume you would want to automatically alter mangle rules and policy routing, and this approach makes it possible.

Who is online

Users browsing this forum: No registered users and 47 guests