hello all
I have two WAN connections. One is providing me unlimited bandwidth for youtube. so I want to redirect all traffic to youtube via the that connection.
Both wan connections are PPPoE Client.
is it possible?
hello all
I have two WAN connections. One is providing me unlimited bandwidth for youtube. so I want to redirect all traffic to youtube via the that connection.
Both wan connections are PPPoE Client.
is it possible?
Hi sir
you can accomplish this using policy based routing concepts in a standard way on the mikrotik.
The idea is to select all youtube traffic and routing mark it in such way, youtube will use only the link you decide.
Creating dynamic youtube ip address list
Youtube like facebook and other sites/webplatforms using server farms, will show you different Ips they use , from time to time. For this we need an additional script that you need to use on your mikrotik equipment just to update a youtube ip list that will then be used to say what kind of traffic will go through the unlimited link.
To achieve this, just configure the mikrotik board following the script on the mikrotik wiki page ath the url http://wiki.mikrotik.com/wiki/Manual:Scripting-examples . Specifically you need to follow the instruction in Block access to specific websites. Install the script on the mikrotik and change the list name to youtube_ips (two occurencies in the script) , so you will have this script :
:foreach i in=[/ip dns cache find] do={
:local bNew "true";
:local cacheName [/ip dns cache all get $i name] ;
# :put $cacheName;
:if ([:find $cacheName "youtube"] != 0) do={
:local tmpAddress [/ip dns cache get $i address] ;
# :put $tmpAddress;
# if address list is empty do not check
:if ( [/ip firewall address-list find ] = "") do={
:log info ("added entry: $[/ip dns cache get $i name] IP $tmpAddress");
/ip firewall address-list add address=$tmpAddress list=youtube_ips comment=$cacheName;
} else={
:foreach j in=[/ip firewall address-list find ] do={
:if ( [/ip firewall address-list get $j address] = $tmpAddress ) do={
:set bNew "false";
}
}
:if ( $bNew = "true" ) do={
:log info ("added entry: $[/ip dns cache get $i name] IP $tmpAddress");
/ip firewall address-list add address=$tmpAddress list=youtube_ips comment=$cacheName;
}
}
}
}
[/size]
Mark youtube traffic
Apply Mark-routing mark to all http traffic with destination address an ip belonging to the youtube_ips address list:
[admin@greenTIK]/ip firewall mangle add chain=prerouting protocol=tcp dst-port=80
dst-address-list=youtube_ips action=mark-routing
new-routing-mark=YOUTUBE_RT passthrough=yes
Apply policy based routing
Define as next hop for the youtube traffic , the gatewy on the unlimited link you have (let’s say provider ip next hop is x.y.z.w )
[admin@greenTIK]/ip route add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=x.y.z.w routing-mark= YOUTUBE_RT scope=255 target-scope=10
Hoping this guidelines will help you to implement the wanted solution
Have a nice day
Thanks,
But this is not working,…
The mangle rule is working well. but the routing is done by the default WAN link.
[admin@greenTIK]/ip route add disabled=no distance=1 dst-address=0.0.0.0/0 gateway=x.y.z.w routing-mark= YOUTUBE_RT scope=255 target-scope=10
in gateway I don’t have ip address… I am using PPPoE Client.