Professional Documents
Culture Documents
PCC Loadbalancing by KyawKoThu PDF
PCC Loadbalancing by KyawKoThu PDF
########################
( MikroTik ႏွင့္ပါတ္သတ္၍ သင္ ၾကား ရွင္းျပ ေပးေသာ ko sithu aung , ko wai htut paing ,and
ko min thu တို ကို လည္း ေက းဇးတင္ပါသည္။)
Internet လိုင္း ေတြ ေပါင္ တ့ နည္း လမ္း ေတြ MikroTik Router OS မွာ မ ား စြာ ရွ ပါ တယ္ အ့ ထ
က မွ မတညီ တ့ bandwith ေတြ ကို ေပါင္း စည္း ဖို့ ဆို ရင္ ေတာ့ PCC က ပို အဆင္ ေျပ မွာ ပါ
ဒီ post မွာေတာ႔ equal bandwith load balancing ကို ကြ န္ေတာ္နားလည္ သလို sharing လိုပ္
ပါ႔မယ္
http://wiki.mikrotik.com/wiki/Manual:PCC
PCC(per-connection-classifier) န့ ေပါင္း ဖို့ ဆို ရင္ bandwith ေတြ ကို အခ း ခ မွန္ ဖို့ လို ပါ
တယ္
Eg .. 2Mb န့ 2Mb နွစ္ လိုင္း ေပါင္း မယ္ ဆို ရင္ နွစ္လိုင္ လံိုး ကို စား လို့ ျပတ္ ေစ မယ့္ စားကန္း ႏွင့္
စားလဒ္ တခို အရင္ ရွာ ရမယ္ 2Mb/2 =1 and 2Mb/2=1 ဆို ရင္ စားလဒ္ က 1 and 1 ရမယ္ အ့
စားလဒ္ 1ရယ္ 1 ရယ္ ကို ေပါင္းမယ္ 1+1=2 2 ရမယ္
အ့ 2 ကို ၾကည့္ ရင္ ပထမ 2Mb မွာ 1 ၾကမ္ ေနာက္ 2Mb မွာ 1 ၾကမ္ ရတယ္ pcc ရ႕ သေဘာ
အတိုင္း အၾကမ္းျဖင္း အား ျဖင့္ connection ေတြ ကို a hashing algorithm အတိုင္း တြက္ပါ တယ္
Router ကို ျဖတ္ သြား တ့ connection ကို connection mark မွတ္ တယ္ ျပီး ရင္ routing mark
မွတ္ ျပီး internet လိုင္း နွစ္ ခို စီ ေပၚကို ခြ လႊတ္ေပးတယ္
ဒါ ဆို pcc ေရး ရင္ 2/0 ကေန 2/1, အထကိုconnection mark ေရး ရမယ္
2/0 တေၾကာင္း က ပထမ 2Mb လိုင္း ကေန ထြက္ ဖို႕ connection mark လိုပ္ေပး ရမယ္
ေနာက္ 2/1 က ေနာက္ 2Mb လိုင္း ကေနထြက္ ဖို႕ connection mark လိုပ္ေပး ရမယ္
အ့ connection mark ကို routing mark ျပန္ မွတ္ ျပီး internet လိုင္းေပၚေတြကို မွ လႊတ္ ေပး လိုက္
ရင္ load balancing ရပါျပီ
Mikrotik Firewall ရ့ marker လို႕ ေခၚတ့ mangel ကေန အဓက လိုပ္ေပးသြားတာ ျဖစ္ပါတယ္
ေရး နည္း မ း စံို ထ ကေန မွ baginer က က wiki ေပၚမွာ ေရးထားတ့ အတိုင္း ရွင္းျပ ေပးမွာပါ
Wan
ISP 1 -Ip =10.111.0.2/24 Gw=10.111.0.1 (2Mb)
ISP 2 –Ip =10.112.0.2/24 Gw=10.112.0.1 (2Mb)
ကို လိုင္း ကို ေပါင္းပါမယ္
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ထံိုးစံအတိုင္း Nat ေရး ပါ့ မယ္
/ ip firewall nat
add chain=srcnat out-interface=ISP1 action=masquerade
add chain=srcnat out-interface=ISP2 action=masquerade
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Wan နွစ္ လိုင္း ကို static ip ေပး တာမို႕ routing table ထကို static route ရိုက္ ထည္႕ေပးရပါမယ္
အ့ဒီ့မွာ line number 3 and 4 က distance=1 and 2 and check-gateway=ping က ဘာ ကို ဆို
လို တာလည္းဆို ေတာ့ fail over အတြက္ ပါ
Line number 1 and 2 က routing-mark က mangle ကေန mark ေပး မယ့္ routing mark ေတြ
ကို route လိုပ္ေပးျပီး load balancing လိုပ္ေပး လိုက္ တာျဖစ္တယ္
/ ip route
1. add dst-address=0.0.0.0/0 gateway=10.111.0.1 routing-mark=to_ISP1 check-
gateway=ping
2. add dst-address=0.0.0.0/0 gateway=10.112.0.1 routing-mark=to_ISP2 check-
gateway=ping
3. add dst-address=0.0.0.0/0 gateway=10.111.0.1 distance=1 check-gateway=ping
4. add dst-address=0.0.0.0/0 gateway=10.112.0.1 distance=2 check-gateway=ping
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
MikroTik ရ့ marker ၾကီး mangel ထ ကို ဝင္ မယ္
/ ip firewall mangle
ျပီးေတာ့ lan or router ထကေန wan gateway ျဖစ္ တ့ 10.111.0.1 /10.112.0.1 ကို သြားတ့
connection ေတြ ကို ပါတ္ မသြား ရေအာင္ ေရးေပးတာ ျဖစ္ပါတယ္ ဥပမာ 10.111.0.1 ကို ping တ့
အေျခေန ဆို ပါေတာ့ pcc က အ့ connection ကို 10.112.0.1 ဘက္ကေန ေပးသြားမလိုက္ ရင္ အ့
ping ကေရာက္ မွာ မဟိုတ္ပါဘး
Chain=prerouting ကေန မွတ္တာ က အေသခ ာဆံိုး ပါပ မမ ကြ မ္းက င္ မွွဴ အတိုင္း တျခားေနရာ
ေနမွ လည္း မွတ္သားနိုင္ ပါတယ္
ျပီးေတာ့ wan ဘက္ အျခမ္း ကေန ဝင္ေရာက္မယ္ connection ေတြ ကို ျပန္ထြက္ ရင္ ဝင္ တ့ လိုင္း
ကေန ျပန္ ထြက္ေပးနိုင္ ေအာင္ လို႕ ေရးေပးတာ ပါ ဒီ မွာ Mark လိုပ္ ေပး တ့ connection-mark ကို
routing-mark ထပ္ မွတ္ေပးျပီး routing table ကေန ထန္းေပးလိုက္ မွာ ျဖစ္ပါတယ္
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
PCC စေရးပါမယ္ no-1 line က 2Mb ISP 1 က ေန ထြက္ေအာင္ connection mark ေပး ရ မွာ ျဖစ္
ပါတယ္ က န္တ့ no -2 က 2Mb ISP 2 ကေန ထြက္ ေအာင္ connection mark ေပး ထားတာ ျဖစ္
ပါတယ္ ValuesToHash ::= both-addresses|both-ports|dst-address-and-port| src-
address|src-port|both-addresses-and-ports|dst-address|dst-port|src-address-and-port
ၾက က္တ့ ValuesToHash ကို သံိုးပါ လိုပ္ငန္း အေျခေနေပၚမ တည္ ေျပာင္းလသံိုး နိုင္ မွာ ပါ အသံိုး
မ ား တာ ကေတာ့ both-addresses-and-ports ပါ
1. add chain=prerouting in-interface=LAN connection-mark=no-mark dst-address-
type=!local per-connection-classifier=both-addresses:2/0 action=mark-connection new-
connection-mark=ISP1_conn
2. add chain=prerouting in-interface=LAN connection-mark=no-mark dst-address-
type=!local per-connection-classifier=both-addresses:2/1 action=mark-connection new-
connection-mark=ISP2_conn
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
line No 1 and 2 ကေတာ့ အေပၚက connection-mark ေတြကို routing mark ျပန္ လိုပ္ ေပး
ထားတာပါ
line No 3 and 4 ကေတာ့ router output ကေန ျဖတ္ မယ့္ connection-mark ထား တာ ေတြ ကို
လည္း အဆင္ေျပေျပ ထြက္နိုင္ ေအာင္ routing-mark လိုပ္ေပးတာျဖစ္ ပါတယ္
Kyaw ko ko thu