Syed Jahanzaib Personnel Blog to Share Knowledge !

June 4, 2011

Mikrotik Routing Youtube to another WAN Link !

Filed under: Mikrotik Related — Tags: , , , , , , , — Syed Jahanzaib / Pinochio~:) @ 3:44 PM

If you have two DSL links, and you want to dedicate one link for the YOUTUBE and FACEBOOK traffic only, you can do it with Mikrotik in few simple steps.

First understand the logic, Main idea is to first create Address list with YOUTUBE ip addresses. (u can get them from goggling) then , in mangle, create rule to mark packets with the above created address list, name it
youtube
-addresses, then in route create rule to route youtube address list to go via DSL 2 .

Some examples . . .

/ip firewall mangle chain=prerouting action=mark-routing new-routing-mark=youtube passthrough=yes src-address=0.0.0.0/0 dst-address=208.65.152.0/21
(or destination address list you created in starting, U have to create Several IP address lists)

then create ROUTE for this list.

/ip route add comment=”" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=192.168.2.1 routing-mark=youtube scope=255 target-scope=10

Its amazing, you can route any Website/traffic to specific WAN link, for example dedicated DSL link for streaming media sites or FB. its kewl ;)

For more info and ideas, please visit following link.
http://wiki.mikrotik.com/wiki/Per-Traffic_Load_Balancing

Perhaps a better approach for youtube mark and route method.

http://adminsline.wordpress.com/2012/08/03/mikrotik-youtube/

zaiB !

About these ads

21 Comments »

  1. thats good i think its better than load balancing

    Comment by usman — August 7, 2011 @ 7:21 PM

    • Hmmm in some scenario its good.
      For example, at my friends setup, I used it to route only Youtube base traffic to DSl line (10mb x 4 dsl). Main internet backbone was 30mb via fiber optics. but I didn’t wanted it to put youtube load on main feed, therefore I marked Youtube content and route it to RB750 Load balancer. That’s how I saved considerably bandwidth :) ~

      Comment by Pinochio / zaib — August 8, 2011 @ 7:23 AM

  2. i apply the rule but still the same situation kindly tell me how to put the browsing on one wan and download on one wan.Thanks

    Comment by salman — October 14, 2011 @ 1:22 PM

  3. use packet marking.
    Mark the packet with the extentions you want to route to 2nd wan for example .mp3 .exe .flv etc etc.
    Then create new route for marked packet and set its gateway to 2nd wan.

    Comment by Pinochio~:) — October 14, 2011 @ 1:58 PM

  4. kindly u can tell me the script Thanks

    Comment by Salman — October 17, 2011 @ 12:56 AM

  5. In this paket marking youtube streaming will also be balance?

    Comment by salman — October 17, 2011 @ 7:19 PM

    • Actually the method described in this post will mark packets for specific destination ips, then request for these destination will be routed to second gateway. These ips can be any web site ip whether its you-tube or any other.

      Comment by Pinochio~:) — October 18, 2011 @ 10:52 AM

  6. Sir u can give me example of packet marking.That how to do

    Thanks

    Comment by salman — October 27, 2011 @ 1:51 PM

  7. Q:1- Can we route youtube (same addresses) on 2 to 3 wan links at a time? and give us Rules.
    Q:2- Can we use PCC with this routing.

    thanks,
    Azam

    Comment by crownwirelessm — December 18, 2011 @ 2:09 PM

    • 1# You can define only one Route for specific marked packets.
      2# Yes you can use PCC with some minor editing.

      Comment by Pinochio~:) — December 19, 2011 @ 10:40 AM

      • when i use you tube routing, then all other traffic automatically route to second WAN link?

        regards,

        Comment by crownwirelessazam — December 24, 2011 @ 1:17 PM

      • Well, the target was to route youtube or FLV related traffic to one WAN link and all other traffic to Second WAN link.
        Describe in detail if you have any query regarding it.

        Comment by Pinochio~:) — December 24, 2011 @ 2:32 PM

  8. Youtube routing
    /ip route add comment=”” disabled=no distance=1 dst-address=0.0.0.0/0 gateway= routing-mark=youtube scope=255 target-scope=10

    all other traffic routing
    /ip route add comment=”” disabled=no distance=1 dst-address=0.0.0.0/0 gateway= scope=255 target-scope=10 check-gateway=ping

    for failover DSL-2
    /ip route add comment=”” disabled=no distance=2 dst-address=0.0.0.0/0 gateway= scope=255 target-scope=10 check-gateway=ping

    is this ok?

    regards

    Comment by muhammad azam — December 27, 2011 @ 3:00 PM

  9. Youtube routing
    /ip route add comment=”” disabled=no distance=1 dst-address=0.0.0.0/0 gateway=”DSL-1 IP address” routing-mark=youtube scope=255 target-scope=10
    all other traffic routing
    /ip route add comment=”” disabled=no distance=1 dst-address=0.0.0.0/0 gateway=”DSL-2 IP address” scope=255 target-scope=10 check-gateway=ping
    for failover DSL-2
    /ip route add comment=”” disabled=no distance=2 dst-address=0.0.0.0/0 gateway=”DSL-1 IP address” scope=255 target-scope=10 check-gateway=ping

    is this ok?

    regards

    Comment by muhammad azam — December 27, 2011 @ 3:02 PM

  10. Good job. Sir i want better youtube service on one wan. i.e, prioritize youtube over downloading

    Comment by waqar — May 10, 2012 @ 11:20 PM

  11. Dear Jhanzaib Bhai…. AOA

    I cant able to traceout the IP’s of youtube, as they hide he IP’s on the backend of Google.com….. Kindlt tell me how to deal with this issue…. 173.194.35.97 IP is showing at nslookup but its not to be UTUBE IP

    Comment by kashif khan — September 1, 2012 @ 9:08 PM

    • Create a address list name Youtube

      Try this

      /ip firewall mangle chain=prerouting action=add-dst-to-address-list protocol=tcp address-list=Youtube address-list-timeout=60m in-interface=!ether2(WAN Interface) dst-port=80 content=youtube.com

      Addresses will be added to Youtube address list and will be there for 1 hour.

      Comment by Syed Jahanzaib / Pinochio~:) — September 1, 2012 @ 10:49 PM

  12. Asalam O Alikum sir

    sir thanks for this article.. sir if you can please tell how to use this thing with pcc, i hve tried it but not working :(

    Comment by ZJ — September 22, 2012 @ 2:07 PM

  13. Hi, can some one help me to make one WAN for browsing (HTTP&HTTPS), and the other one for Download and youtube?

    DSL1=192.168.0.1
    DSL2=192.168.100.250

    Mikrotik:-
    LAN 10.0.0.1/23
    WAN1 192.168.0.2/24
    WAN2 192.168.100.1/24

    please help!

    Comment by zoomoos — December 12, 2012 @ 6:07 PM

  14. Thank you! Thats what I was looking for :)
    I am using YT dst-address mark by content youtube.com and add to address-list
    right now around 1300 IPs
    but I noticed some streams of downloading are going through YT WAN also…
    but in general it free 40% utilization from WAN_1 to WAN_YT :)

    Comment by Arni — February 6, 2013 @ 4:41 AM

  15. Hi every body
    I have 2 inter face as following:
    !-lan-1 192.168.10.0/22
    2-Wan-1 xxx.xxx.xxx.xxx/27 and in the wan interface i have 4 valid ip and i has set all of the 4 IP in the IP Address List.

    As example I want to send all traffic for youtube.com through the one of the valid ip on WAN-1, and all more traffic to the next valid ip on the same wan interface. Can some one help me?????????

    Comment by Pooyan — March 1, 2013 @ 3:19 AM


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 663 other followers

%d bloggers like this: