OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: Ahmedbasma1 on February 11, 2024, 10:13:26 pm

Title: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Ahmedbasma1 on February 11, 2024, 10:13:26 pm
Hello
I'm new to OPNsense but have been figuring out things lately.
I'm running a multiwan setup, that has 3 WANs. Also, All devices connected to my setup have been given static IPs. I have set rules and aliases to switch between each WAN according to my needs.

Now i'm thinking
if there is a set of rules or a way to automate gateway switching for specific IPs according to their bandwidth usage?
I primarily thought it would include pipes, queues and rules. I don't know how to use them that much but I'd appreciate if someone could help me figure it out or set it up.
Thanks in advance!
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: CJ on February 13, 2024, 06:17:31 pm
I don't have any advice to provide you as I've not worked with multi-WAN setups, but I'm really curious as to what caused you to end up with 3 different WANs.  Would you mind elaborating on that?
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Ahmedbasma1 on February 13, 2024, 06:29:09 pm
Hello CJ

We’ve been running a 3 Multiwan setup due to the very slow speed and instability of internet provided in Egypt.
We are a simple gaming cafe, however due to instability and a lot of limitations on internet usage and speed from our ISPs we thought of using multiwan setup

This helps us put some of our  clients on whichever optimal connection
For example:
Some of our clients get into ranked/competitive games but the ping is unplayable on a certain connection. So we can transfer this client to another WAN which gives better results for ping.

Also due to restricted amount of gigabytes to use through the month (limited quota )
We figured that if we use this multiwan setup to merge or loadbalance all 3 wans that would give us better speed and less usage on each individual WAN.

That’s the whole idea. It’s not that we want to do crazy things but we’re just trying to make what we have better.
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: CJ on February 13, 2024, 06:43:41 pm
Hello CJ

We’ve been running a 3 Multiwan setup due to the very slow speed and instability of internet provided in Egypt.
We are a simple gaming cafe, however due to instability and a lot of limitations on internet usage and speed from our ISPs we thought of using multiwan setup

This helps us put some of our  clients on whichever optimal connection
For example:
Some of our clients get into ranked/competitive games but the ping is unplayable on a certain connection. So we can transfer this client to another WAN which gives better results for ping.

Also due to restricted amount of gigabytes to use through the month (limited quota )
We figured that if we use this multiwan setup to merge or loadbalance all 3 wans that would give us better speed and less usage on each individual WAN.

That’s the whole idea. It’s not that we want to do crazy things but we’re just trying to make what we have better.

Ah, that makes total sense.  Thanks for providing the info. :)

On a side note, I assume you are using things like lancache in order to speed up your installs and reduce your quota usage, but if not, you should definitely look into that.
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Ahmedbasma1 on February 13, 2024, 06:45:18 pm
Could you please provide me with more explanation with what lancache does and how to install it or use it?
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Ahmedbasma1 on February 13, 2024, 08:13:32 pm
Also, We're running something like LANcache, so Idk if it's gonna help out or not.
we're running a diskless/iPxe server to run games on our clients pcs. So i do believe they use another module rather than lancache but i'd love to know more.
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: CJ on February 14, 2024, 03:47:39 pm
https://lancache.net/

I've never really looked into it as I don't have a need for it.
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Amr on February 14, 2024, 06:33:21 pm
hello Ahmedbasma1,
You can load balance different WANs based on latency https://docs.opnsense.org/manual/how-tos/multiwan.html (https://docs.opnsense.org/manual/how-tos/multiwan.html).
Also you can look into Traffic shaping to make sure traffic is distributed evenly between users https://docs.opnsense.org/manual/how-tos/shaper_share_evenly.html (https://docs.opnsense.org/manual/how-tos/shaper_share_evenly.html).
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Ahmedbasma1 on February 14, 2024, 11:51:51 pm
Hello Amr, Thank you for your advice.
I'll try it out and I'll get back to you.
meanwhile, I would like to let you know exactly what we're trying to do.

The idea is we want that when a client starts downloading he automatically gets switched to the WAN specified for downloads, but when the download is done, He goes back to the optimal (Stable Ping) WAN
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Seimus on February 15, 2024, 10:11:10 am
You could achieve this would be via RPL. meaning you would setup routing policies that would define what service/destination would be routes thru which specific WAN.

For this you would need to know what are the specific destinations.

Basically if your concern is Competitive gaming let say for a specific game like Dota, you can create a Rule that would route traffic for the Dota thru the low latency link and rest would go thru the WAN dedicated to downloads.

Regards,
S.
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: CJ on February 16, 2024, 08:36:04 pm
I'm wondering how well that would work.  With the prevalence of things like AWS it could be painful to try and determine what software needs what.
Title: Re: Possible way to Automate gateway switching according to IP Bandwidth usage?
Post by: Seimus on February 17, 2024, 01:33:01 am
Indeed, I agree with you, no easy feat to achieve.

Would need a lot researching and possibly keep track and updating it as well. But is worth the shot if the topic owner wants to achieve his goal and there is no other way.

Regards,
S.