I can not use full PCC load balancing and at same time pay TV casting from phone to chromecast / TV (over Wifi).
It only works if I don’t do load balancing (or use “source IP” only in PCC). This is not good solution in my case.
The problem is the pay TV server wants to see same public IP from both devices (phone and the Chromecast).
I tested this by creating 2 address lists, one list that traces all the connections from the chromecast device out and another from the phone
when launching the app.
I compared then the IP addresses and saw they use different public server IP addresses but in the same /24 subnet.
I then created by hand a final list which only has 3 IP address of type xxx.xxx.xxx.0/24 and mangle those to the same WAN interface!
It works!!!
So what I would like to do now is automate this:
compare both address lists, and combine it in a way to create just subnet lists. Example
Pay-TV-Cast list has 123.123.123.10; (and some other IP which are not in the other list)
Phone-TV-Cast list has 123.123.123.22 (and some other IP which are not in the other list).
→ I would like to have a list that has 123.123.123.0/24
and ignore any entry that is only in one of the lists, and which has not the same subnet IP in the other list.
I am not a scripting expert and could use some help / recommendations here…
:local list1 {\
1.1.1.1;\
2.2.2.2;\
3.3.3.3;\
4.4.4.4;\
5.5.5.5;\
2.2.2.200}
:local list2 {\
1.1.1.1;\
2.2.2.2;\
3.3.3.3;\
4.4.5.4;\
5.5.6.5}
:local AgregateMask 24
:local AgregatedList
:local i
:local j
:local net
:local ReversMask (32-$AgregateMask)
:foreach i in=$list1 do={
:foreach j in=$list2 do={
:put "$i and $j"
:set net (($i>>$ReversMask)<<$ReversMask)
:set net ($net . "/$AgregateMask")
:if ($j in $net) do={
:put "$j in $net"
:if ([:typeof [:find $AgregatedList $net]]="num") do={
:put "$net alredy exist in AgregatedList"
} else={
:set AgregatedList ($AgregatedList, $net)
}
} else={
:put "$j not in $net"
}
:put ""
}
}
:put "AgregatedList:"
:foreach i in=$AgregatedList do={
:put "$i"
}
Result:
1.1.1.1 and 1.1.1.1
1.1.1.1 in 1.1.1.0/24
1.1.1.1 and 2.2.2.2
2.2.2.2 not in 1.1.1.0/24
1.1.1.1 and 3.3.3.3
3.3.3.3 not in 1.1.1.0/24
1.1.1.1 and 4.4.5.4
4.4.5.4 not in 1.1.1.0/24
1.1.1.1 and 5.5.6.5
5.5.6.5 not in 1.1.1.0/24
2.2.2.2 and 1.1.1.1
1.1.1.1 not in 2.2.2.0/24
2.2.2.2 and 2.2.2.2
2.2.2.2 in 2.2.2.0/24
2.2.2.2 and 3.3.3.3
3.3.3.3 not in 2.2.2.0/24
2.2.2.2 and 4.4.5.4
4.4.5.4 not in 2.2.2.0/24
2.2.2.2 and 5.5.6.5
5.5.6.5 not in 2.2.2.0/24
3.3.3.3 and 1.1.1.1
1.1.1.1 not in 3.3.3.0/24
3.3.3.3 and 2.2.2.2
2.2.2.2 not in 3.3.3.0/24
3.3.3.3 and 3.3.3.3
3.3.3.3 in 3.3.3.0/24
3.3.3.3 and 4.4.5.4
4.4.5.4 not in 3.3.3.0/24
3.3.3.3 and 5.5.6.5
5.5.6.5 not in 3.3.3.0/24
4.4.4.4 and 1.1.1.1
1.1.1.1 not in 4.4.4.0/24
4.4.4.4 and 2.2.2.2
2.2.2.2 not in 4.4.4.0/24
4.4.4.4 and 3.3.3.3
3.3.3.3 not in 4.4.4.0/24
4.4.4.4 and 4.4.5.4
4.4.5.4 not in 4.4.4.0/24
4.4.4.4 and 5.5.6.5
5.5.6.5 not in 4.4.4.0/24
5.5.5.5 and 1.1.1.1
1.1.1.1 not in 5.5.5.0/24
5.5.5.5 and 2.2.2.2
2.2.2.2 not in 5.5.5.0/24
5.5.5.5 and 3.3.3.3
3.3.3.3 not in 5.5.5.0/24
5.5.5.5 and 4.4.5.4
4.4.5.4 not in 5.5.5.0/24
5.5.5.5 and 5.5.6.5
5.5.6.5 not in 5.5.5.0/24
2.2.2.200 and 1.1.1.1
1.1.1.1 not in 2.2.2.0/24
2.2.2.200 and 2.2.2.2
2.2.2.2 in 2.2.2.0/24
2.2.2.0/24 alredy exist in AgregatedList
2.2.2.200 and 3.3.3.3
3.3.3.3 not in 2.2.2.0/24
2.2.2.200 and 4.4.5.4
4.4.5.4 not in 2.2.2.0/24
2.2.2.200 and 5.5.6.5
5.5.6.5 not in 2.2.2.0/24
AgregatedList:
1.1.1.0/24
2.2.2.0/24
3.3.3.0/24
Result for “:local AgregateMask 16”:
1.1.1.1 and 1.1.1.1
1.1.1.1 in 1.1.0.0/16
1.1.1.1 and 2.2.2.2
2.2.2.2 not in 1.1.0.0/16
1.1.1.1 and 3.3.3.3
3.3.3.3 not in 1.1.0.0/16
1.1.1.1 and 4.4.5.4
4.4.5.4 not in 1.1.0.0/16
1.1.1.1 and 5.5.6.5
5.5.6.5 not in 1.1.0.0/16
2.2.2.2 and 1.1.1.1
1.1.1.1 not in 2.2.0.0/16
2.2.2.2 and 2.2.2.2
2.2.2.2 in 2.2.0.0/16
2.2.2.2 and 3.3.3.3
3.3.3.3 not in 2.2.0.0/16
2.2.2.2 and 4.4.5.4
4.4.5.4 not in 2.2.0.0/16
2.2.2.2 and 5.5.6.5
5.5.6.5 not in 2.2.0.0/16
3.3.3.3 and 1.1.1.1
1.1.1.1 not in 3.3.0.0/16
3.3.3.3 and 2.2.2.2
2.2.2.2 not in 3.3.0.0/16
3.3.3.3 and 3.3.3.3
3.3.3.3 in 3.3.0.0/16
3.3.3.3 and 4.4.5.4
4.4.5.4 not in 3.3.0.0/16
3.3.3.3 and 5.5.6.5
5.5.6.5 not in 3.3.0.0/16
4.4.4.4 and 1.1.1.1
1.1.1.1 not in 4.4.0.0/16
4.4.4.4 and 2.2.2.2
2.2.2.2 not in 4.4.0.0/16
4.4.4.4 and 3.3.3.3
3.3.3.3 not in 4.4.0.0/16
4.4.4.4 and 4.4.5.4
4.4.5.4 in 4.4.0.0/16
4.4.4.4 and 5.5.6.5
5.5.6.5 not in 4.4.0.0/16
5.5.5.5 and 1.1.1.1
1.1.1.1 not in 5.5.0.0/16
5.5.5.5 and 2.2.2.2
2.2.2.2 not in 5.5.0.0/16
5.5.5.5 and 3.3.3.3
3.3.3.3 not in 5.5.0.0/16
5.5.5.5 and 4.4.5.4
4.4.5.4 not in 5.5.0.0/16
5.5.5.5 and 5.5.6.5
5.5.6.5 in 5.5.0.0/16
2.2.2.200 and 1.1.1.1
1.1.1.1 not in 2.2.0.0/16
2.2.2.200 and 2.2.2.2
2.2.2.2 in 2.2.0.0/16
2.2.0.0/16 alredy exist in AgregatedList
2.2.2.200 and 3.3.3.3
3.3.3.3 not in 2.2.0.0/16
2.2.2.200 and 4.4.5.4
4.4.5.4 not in 2.2.0.0/16
2.2.2.200 and 5.5.6.5
5.5.6.5 not in 2.2.0.0/16
AgregatedList:
1.1.0.0/16
2.2.0.0/16
3.3.0.0/16
4.4.0.0/16
5.5.0.0/16
Thanks for the code and I was thinking about optimizing address-lists. I think that running itin the background is best to minimize the load on the router.
I like to combine several subnets to one if the list has several adjoining /24 or even larger subnets. When combining, a timeout if present should be the same or very close.
It wiil be a very intensive task on the router and then is the advantage enough looking at the investment of time.