Score:0

Redirecting Netflix and Youtube traffic to another gateway by IP addresses on Mikrotik router

it flag

I help a friend in taking care of the network with few buildings with appartments for rent.

During the holiday season all apartments are fully booked, and that means we have 40-60 guests. There are 18 smart TV boxes with Netflix, Youtube etc.

We have 4 internet provider connections at this moment and all of them have average stability and speed because houses are in the mountains and there are no fiber optic links and we have to use 1 radio link (not bad) and 3 LTE connections (pretty bad at holiday season because there are many tourists and hotels nearby and the LTE infrastructure sometimes cannot handle all devices properly).

I was experimenting with load balancing (multiple WAN, with packet marking), but when we had problems with LTE stability during holidays everything was not working properly, so I gave up on splitting traffic and I switched all to best gateway and I archieved best stability (but with slow speed) this way.

Now I want to set default routes to Netflix and maybe Youtube to slower/less reliable gateways, and leave the best connection for other internet connections.

I'm using relatively low cost Mikrotik router (RB760) and I want to avoid complicated configuration that would use a lot of CPU time and this is why I want to use simple routing for this task.

My question is:

Do youtube and netflix provide any IP address lists which can be used to create default routes to them through the selected gateway?

So far I have found this article regarding Netflix: link and this article for Youtube: link but I'm not sure if these addresses appropriate for the traffic control I want to achieve.

I also would like to read what you guys think about this idea in general.

yagmoth555 avatar
cn flag
Just asking, Will giving your customers slow link for the media content will make them unhappy ? On my side I have a family with multiple kid, hotel wifi are a life saving to make the kid listen to something. My own net usage is low. I ask it, as on my side I would prefer the kid to have a good connection vs my own. I would more think to make sure that your renter got a % of the bandwidth if they use all the same gateway. (To be sure no one will use all the bandwitdh if in example one renter use bittorrent)
Kamil avatar
it flag
@yagmoth555 Well, at this particular place people or companies rent apartments for remote work (covid-19) and we have to give them higher priority over tourists entertainment needs. "Working customers" actually loose money and/or time when internet is not working at all or is unstable. According unhappy tourists - I think not working media content will make them more happy. They should go ski, sit outside around fire instead of watching youtube or netflix :]
Score:0
hk flag

I've done this, here are the steps:

  1. Set your Mikrotik router as DNS server for the clients
  2. Run the following script every 10 seconds or so, to find in DNS table all netflix entries, and put them in a list (address-list)
  3. Set up mangle rule to mark all packets going to that list (i.e. Netflix) a particular route mark.
  4. Add a route to your special tourist gateway for all packets marked as above.
  5. Get a coffee

Script

:global ajouteIP do={
  :if ([:len [/ip firewall address-list find address="$nouvelleIP" and list="netflix"]] = 0) do={
    /ip firewall address-list add list="netflix" address=$nouvelleIP timeout=02:00:00
  }
}

:local myServers { "nflx";"nflximg";"unodns";"uno";"netfl"}
/ip dns cache all {
  :foreach i in=$myServers do={
    :foreach j in=[find where (name~$i)] do={
      :local myName [get $j name]
      :local myType [get $j type]
      :local myData [get $j data]
      :if ($myType = "A") do={
        $ajouteIP nouvelleIP=$myData
       }

      :if ($myType = "CNAME") do={
        :local ipResolue [:resolve "$myData"];
         $ajouteIP nouvelleIP=$ipResolue
      }
    }
  }
}

Mangle rule

/ip firewall mangle
add action=mark-routing chain=prerouting comment="Sortie Netflix" dst-address-list=netflix new-routing-mark=via-sortie-netflix passthrough=yes protocol=tcp src-address=[your clients IP addresses]

Route rule

/ip route
add distance=1 gateway=[Tourist gateway IP] routing-mark=via-sortie-netflix
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.