My ISP’s provided me with public IP addresses. I need a script which will ‘smartly’ check if first default link is down and switch over all users to second link.
I thought about netwatch, but if I ping my first gateway and I am working with second link, I will have replies because I have public IP’s from both ISP’s and my gateway has public IP, also I have to switch over to first link if first link is available again. Also if second link doesnt work at all, everybody has to switch to first one.
I would distribute first link to half of my users and second link to other half with routes.
are you sure that that example will do failover the way I want, be aware that my both ISP’s gateways are on public IP’s, so if first link fails, it is simple to switch to second, but if you switch to second link that first gateway will be reachable because it is with public IP so link would be switched back to first and forever I will not have internet :(, this is my doubt .
The “/tool traceroute” command has a parameter “max-hops”. Perhaps there is a possibility to check if a “/tool traceroute max-hops=1” fails because of “max-hops reached”. This would be the case if you “other, first” public ip would be reachable over your second ISP’s connection, right?
I think solution for this problem would be very helpfull to plenty of users, because simple fail-over will work fine if you have private IP’s from your ISP but wont for public (real) ones.
I don’t have an idea right now how to read out the hop count from this command in a script, nor how to catch the error message “max-hops reached”…
Let’s see if Eugene is reading this
But I’ll share the knowledge in a bit different way. There is no need to use /tool traceroute for this task. The script changes only gateway addresses under /ip route for the default route. Other routes remain unchanged. This way we are assured that ping to the gw1 will always go through the directly connected (DC) route to that gateway, because it has lower metric value, not through the gw2. Just make sure that disable-running-check value for the respective interface is set to yes (the default for ethernet).
I tried to copy some scripts from MT, in order to get proper loadbalancing with failover, but useless.
Big question, what if I have ping to the gateway, but one of the providers has lost his connection to Internet, how can you do failover.
…
does BGP help in this case, does anyone know how to do BGP with loadbalancing !!??
I got and idea, but honestly it is little bit complicated, but it will work.
So, I got one W2000 machine, I’ll put another nic and give it a ip address (throught DHCP or static), then I’ll make a smart application which does ‘tracert x.x.x.x >file’, and then I’ll run text check on that file to chek for strings like ‘Destination net unreachable.’, ‘Request timed out.’ and simillar, so if that IP is more than thats say 3 hops, then I’ll disable second nic card, and in that same time I’ll netwatch IP of that second W2000 card, so in case if it is or not reachable (depends on tracert), I’ll change gateways.
So cmit, what you think of my idea , btw, does anyone knows how to disable nic or change IP’s via cmd line on W2000, I’ll try with DHCP /release /renew, but I dont know if /release will release IP till next /renew , let me try and I’ll let you know
‘The DevCon utility is a command line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. DevCon provides information that is relevant to the developer and is not available in Device Manager.’
So, if anyone interested, i’ll post my .exe when I finish it
Do that for both of the interfaces, and when Gateway 1 is down, and gateway 2 comes online, the firewall rule will block gateway 1 from being pinged until gateway 1 comes back online itself. Same with pinging gateway1 from gateway2.