Wednesday, 10 February 2016

Management Bandwidth Prioritize Online Games on Mikrotik

Basic Idea Management Bandwidth Prioritize Online Games Mikrotik
In order to make the Internet Network that is used for the purposes. So inconsiderate and bad for the future if you think should be expel the clients who likes to download files and video streams when you want to prioritize the online games on the internet network that you have for the clients. Bandwidth Management for the Online Games on Mikrotik absolutely necessary, so that all interests can be run in proportion and balanced.


The internet purposes for the online games has become a very sensitive thing before browsing for the client. Without ignoring the interests of others, we just need to control downloads and video streams are hugely wasteful of the bandwidth, giving breath to browsing, and giving priority and make safe to online games. So that the Internet network that we build can be used for various purposes, and the services that we provided to the client to be open to a wider variety of interests.

Our focus now is how do we allocate bandwidth for the online games among with various other interests. The most appropriate way to capture the packets of online games is using TCP and UDP destination ports of online games. Actually, when a running online games, it doesn't use a lot of bandwidth, something taht we have to do is giving bandwidth that more stable by adjusting with highest priority to the others. TCP and UDP ports of online games usually are at a recommendation and referenced by online games itself, if not, it would be very difficult to know the destination ports that are really relevant.

TCP and UDP destination port of online games are usually very privacy. Many free tools there is not too much to help us in order to find the destination port of an online game. Have you try to use Wireshark or Curr Port to find the ports destination of the online games? which can only detect packets that pass through connections of local port only, which will be always changing as far as my experience in an effort to determine the TCP and UDP ports of an online game. How about you?

1. Here is references of some TCP and UDP ports commonly used for the online games, I have included in the mangle scripts for the mark connection of online games:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/ip firewall mangle
add action=mark-connection chain=prerouting comment="POINT BLANK KONEKSI TCP" disabled=no src-address=192.168.1.0/24 dst-port=39190 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="POINT BLANK UDP" disabled=no src-address=192.168.1.0/24 dst-port=40000-40010 new-connection-mark="GAME-conn" passthrough=no protocol=udp
add action=mark-connection chain=prerouting comment="POKER TCP" disabled=no src-address=192.168.1.0/24 dst-port=9339,843 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="AYODANCE TCP" disabled=no src-address=192.168.1.0/24 dst-port=18901,18902,18903,18904,18905,18906,18907,18908,18909 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="LOST SAGA TCP" disabled=no src-address=192.168.1.0/24 dst-port=14009-14010 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="LOST SAGA UDP" disabled=no src-address=192.168.1.0/24 dst-port=14009-14010 new-connection-mark="GAME-conn" passthrough=no protocol=udp
add action=mark-connection chain=prerouting comment="SEAL ONLINE TCP" disabled=no src-address=192.168.1.0/24 dst-port=1818 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="LINE AGE2 TCP" disabled=no src-address=192.168.1.0/24 dst-port=7777 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="RF-ELVENT TCP" disabled=no src-address=192.168.1.0/24 dst-port=27780 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="RF KONEKSI UDP" disabled=no src-address=192.168.1.0/24 dst-port=10001,10002,10003,10004,10005,10006,10007 new-connection-mark="GAME-conn" passthrough=no protocol=udp
add action=mark-connection chain=prerouting comment="PERFECT WORLD TCP" disabled=no src-address=192.168.1.0/24 dst-port=29000 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="ROHAN TCP" disabled=no src-address=192.168.1.0/24 dst-port=22100 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="ZEUS RO TCP" disabled=no src-address=192.168.1.0/24 dst-port=5121 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="DOTTA TCP" disabled=no src-address=192.168.1.0/24 dst-port=6000-6152 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="GHOST ONLINE TCP" disabled=no src-address=192.168.1.0/24 dst-port=19101 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="WOW AMPM TCP" disabled=no src-address=192.168.1.0/24 dst-port=8085 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="DRIFT CITY TCP" disabled=no src-address=192.168.1.0/24 dst-port=11011-11041 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="GET AMPED TCP" disabled=no src-address=192.168.1.0/24 dst-port=13413 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="YULLGANG TCP" disabled=no src-address=192.168.1.0/24 dst-port=19000 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="IDOL STREET TCP" disabled=no src-address=192.168.1.0/24 dst-port=2001 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="CRAZY KART TCP" disabled=no src-address=192.168.1.0/24 dst-port=9601-9602 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="RAN ONLINE TCP" disabled=no src-address=192.168.1.0/24 dst-port=5105 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="CROSS FIRE KONEKSI TCP" disabled=no src-address=192.168.1.0/24 dst-port=10009 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="CROSS FIRE KONEKSI UDP" disabled=no src-address=192.168.1.0/24 dst-port=40000-40010 new-connection-mark="GAME-conn" passthrough=no protocol=udp
add action=mark-connection chain=prerouting comment="RETURN OF WARRIOR TCP" disabled=no src-address=192.168.1.0/24 dst-port=10402 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="CRAZY KART 2 TCP" disabled=no src-address=192.168.1.0/24 dst-port=9600 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="LUNA ONLINE TCP" disabled=no src-address=192.168.1.0/24 dst-port=15002 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="RUNES OF MAGIC TCP" disabled=no src-address=192.168.1.0/24 dst-port=16402-16502 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="FRESH RO TCP" disabled=no src-address=192.168.1.0/24 dst-port=5126 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="WAR ROCK TCP" disabled=no src-address=192.168.1.0/24 dst-port=5340-5352 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="FASTBLACK TCP" disabled=no src-address=192.168.1.0/24 dst-port=6000-6001 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="ROSE ONLINE TCP" disabled=no src-address=192.168.1.0/24 dst-port=29200 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="X-SHOT TCP" disabled=no src-address=192.168.1.0/24 dst-port=7341,7451 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="X-SHOT UDP" disabled=no src-address=192.168.1.0/24 dst-port=7808,30000 new-connection-mark="GAME-conn" passthrough=no protocol=udp
add action=mark-connection chain=prerouting comment="TANTRA ONLINE TCP" disabled=no src-address=192.168.1.0/24 dst-port=3010 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="COUNTER STRIKE TCP" disabled=no src-address=192.168.1.0/24 dst-port=36567,8001 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting comment="COUNTER STRIKE UDP" disabled=no src-address=192.168.1.0/24 dst-port=11100-11125,8001 new-connection-mark="GAME-conn" passthrough=no protocol=udp
add action=mark-connection chain=prerouting comment="3 KINGDOMS UDP" disabled=no src-address=192.168.1.0/24 dst-port=42051-42052 new-connection-mark="GAME-conn" passthrough=no protocol=udp
add action=mark-connection chain=prerouting comment="Carom3D TCP" disabled=no src-address=192.168.1.0/24 dst-port=42051-42052 new-connection-mark="GAME-conn" passthrough=yes protocol=tcp

Copy the above Mangle scripts, select that only you use and paste to the new terminal window of mikrotik winbox, to capture the connection for the variety of online games! The results are as shown below!

description : 
  • comment = "xxx" is the name of an online game that we want to capture the connection
  • src-address = 192.168.1.0/24 is range of the clients IP addresses that you have, to separate the online games on each clients
  • dst-port = xxxx-xxxx is the ports of TCP or UDP of the online games
2. After making the mark connection for all online games that used, the next is making mark packets for every clients.

If you want to make the mark packet online games into one to all clients, you do not need src-address = 192.168.1.11/24 on mark connetion on mangle rule, remove src-address of the mark connection above, then make the packet into single packet the online game as the script below!

1
2
3
4
/ip firewall mangle
add action=mark-packet chain=prerouting comment="GAME ALL CLIENTS" connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-pkt passthrough=no
/queue tree
add name="GAME ALL CLIENTS" parent=global-out packet-mark=GAME-pkt limit-at=220k queue=default priority=7 max-limit=220k burst-limit=256k burst-threshold=165k burst-time=2s


But here I have separated the packets of online game for every clients, the scripts for the packets as shown below!

1
2
3
4
5
6
7
8
9
/ip firewall mangle
add action=mark-packet chain=forward comment="BILLING-GAME" src-address=192.168.1.11 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-BILL-pkt passthrough=no
add action=mark-packet chain=forward comment="CLIENT1-GAME" src-address=192.168.1.17 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-CLIENT1-pkt passthrough=no
add action=mark-packet chain=forward comment="CLIENT2-GAME" src-address=192.168.1.16 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-CLIENT2-pkt passthrough=no
add action=mark-packet chain=forward comment="CLIENT3-GAME" src-address=192.168.1.15 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-CLIENT3-pkt passthrough=no
add action=mark-packet chain=forward comment="CLIENT4-GAME" src-address=192.168.1.14 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-CLIENT4-pkt passthrough=no
add action=mark-packet chain=forward comment="CLIENT5-GAME" src-address=192.168.1.20 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-CLIENT5-pkt passthrough=no
add action=mark-packet chain=forward comment="CLIENT6-GAME" src-address=192.168.1.21 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-CLIENT6-pkt passthrough=no
add action=mark-packet chain=forward comment="MASTER-GAME" src-address=192.168.1.12 connection-mark="GAME-conn" disabled=no new-packet-mark=GAME-MASTER-pkt passthrough=no

Adjust src-address ip address on the mark packets above according with computer clients that you have, then paste to the new terminal window on mikrotik winbox, the result is shown as below!


3. The next we'll make queue tree based on connection packet of mangle rule of the online games per clients and we can limit and give with the highest priority. Changes the simple queue as maximum bandwidth per clients with the priority = 2. After that we make queue tree for online games with the priority = 1 this is for the online games is not lose with the browsing. The script for the online games queue tree per clients like below!

1
2
3
4
5
6
7
8
9
/queue tree
add name=BillingGame parent=global-out packet-mark=GAME-BILL-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s
add name=Client1Game parent=global-out packet-mark=GAME-CLIENT1-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s
add name=Client2Game parent=global-out packet-mark=GAME-CLIENT2-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s
add name=Client3Game parent=global-out packet-mark=GAME-CLIENT3-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s
add name=Client4Game parent=global-out packet-mark=GAME-CLIENT4-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s
add name=Client5Game parent=global-out packet-mark=GAME-CLIENT5-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s
add name=Client6Game parent=global-out packet-mark=GAME-CLIENT6-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s
add name=MasterGame parent=global-out packet-mark=GAME-MASTER-pkt limit-at=200k queue=default priority=1 max-limit=200k burst-limit=256k burst-threshold=150k burst-time=2s

As usually for more quickly just copy the online games queue tree above to the new terminal window mikrotik winbox, the result like the picture below!


Note. If you want to limit and prioritize the online games that no TCP and UDP ports that are not referenced by the online games itself, it would be difficult part to find a relevant ports by self, even you have such a wireshark tool or using torch on mikrotik. Make sure the ports that was captured is really working all times. There are some kind of the online games has dynamic IP, TCP and UDP that makes so difficult to captured the ports, in this case I just used the content site to capture it.
For more clearly I have made the scripts above using mikrotik winbox and to prove the scripts above works, let’s watch the article video above! for the newest method, don't to see the Perfection II of the Bandwidth Mangement!