Tuesday, February 5, 2019

Chapter 3: OSI Model


Chapter 3: OSI Model


Network ကိုု အတန္အသင့္ ေလ့လာခဲ့ပီးပီဆိုုေတာ့ အေျခခံက်တဲ့ OSI model  ကိုု ဆက္လက္ေလ့လာ ၾကရေအာင္ဗ်ာ။ network  ကိုု စတင္ပီး အသံုုးျပဳ ၾကတုုန္းက ဆိုုရင္ ေတာ္ေတာ္ ေလးကိုု ပရမ္းပတာ နိုုင္ခဲ့တာပါ။ vendor တစ္ခုုစီတိုုင္းမွာ ကိုုယ္ပိုုင္ solution တစ္ခုုစီနဲ႔ေပါ့။ အဲတာေၾကာင့္ မိုု႔လိုု႔လဲ OSI model ျဖစ္ေပၚလာဖိုု႔ အေၾကာင္းဖန္လာတာပါ။ vendor ေတြအားလံုုး တူညီတဲ့ စံႏွုုန္း တစ္ခုုေပၚမွာ အလုုပ္လုုပ္ၾကဖိုု႔ international organization for standardization ကေနပီးေတာ့ OSI model ကိုု 1984 မွာ release လုုပ္ခဲ့တာပါ။ OSI ဟာ network ကိုု ေလ့လာသင္ယူမဲ့ သူေတြ အတြက္ေရာအလြန္ေကာင္းမြန္တဲ့ model တစ္ခုုလဲ ျဖစ္ပါတယ္။ သူ႕မွာ ူlayer ၇ခုုပါ ပါတယ္။
clip_image003.png
All People Seem To Need Data Processing
အဲလိုု အလြယ္မွတ္ၾကပါတယ္။ က်ေနာ္ကေတာ့ မမွတ္ေစခ်င္ဘူး။ network ကိုု ေလ့လာေတာ့မယ္ဆိုုရင္ layer 7 ရဲ့ အလုုပ္လုုပ္ပံုုနဲ႔ သေဘာတရားကိုု စဲြျမဲေနရမွာ ျဖစ္ပါတယ္။အလြတ္ က်က္မွာရမည့္ အရာမဟုုတ္လိုု႔ပါ။ ထားပါေတာ့။ က်ေနာ္တိုု႔ layer 1 ကေနစပီးေလ့လာၾကည့္ၾကရေအာင္၊
3.1     OSI seven Layer

Layer 1: physical layer
ဒီ layer မွာ voltage levels, timing, physical data rates, physical connectors စတာေတြကိုု သတ္မွတ္ေပးပါတယ္။ physical layer မွာေတာ့ hub, cable, media, repeater, transceiver and NIC card စတာေတြ ပါ၀င္ပါတယ္။ everything you can touch since it is physical.


Layer 2: Datalink layer
ဒီ layer  ရဲ့ အဓိက တာ၀န္ကေတာ့ transmission လုုပ္ဖိုု႔ အတြက္ ိdata format ရယ္ physical media ေတြကိုု ဘယ္လိုု control လုုပ္ရမယ္၊ access လုုပ္ရမယ္ဆိုုတာေတြ ပါ၀င္ပါတယ္။ error detection ကိုု ဂရုုတစိုုက္ လုုပ္ေဆာင္ေပးပီး error correct , reliably ရဖိုု႔ တာ၀န္ယူပါတယ္။ switching, MAC address,
And Ethernet frames are on the data link layer. Layer 2 devices ေတြကေတာ့ switch, bridge, wireless access point စတာေတြျဖစ္ပီး၊ ppp, Ethernet,စသည့္ protocol ေတြကိုု အသံုုးျပဳပါတယ္။

Layer 3: Network layer
ဒီ layer ကေတာ့ connectivity and patch selection (routing) ကိုု အဓိက လုုပ္ေဆာင္ေပးပါတယ္။ internet protocol ျဖစ္တဲ့ IPv4 and IPv6 တိုု႔ အလုုပ္လုုပ္တဲ့ layer လဲ ျဖစ္ပါတယ္။ every network devices need a unique address on the network. Layer 3 ရဲ့ devices ကေတာ့ routers  ေတြျဖစ္ပီး protocol ကိုု ေျပာပါဆိုုရင္ေတာ့ internet protocol ,IPv4 and IPv6 ပဲျဖစ္ပါတယ္။

Layer 4: Transport layer
ဒီ layer ကေတာ့ transport ကိုုပဲ လုုပ္ေပးပါတယ္။  အခုု ဒီစာအုုပ္ကိုု အင္တာနက္က ေန သင္  download  လုုပ္တဲ့ အခ်ိန္မွာ pdf file  ဟာ segement အေနနဲ႔ သင့္ရဲ့  computer ထဲကိုု ေရာက္လာတာပါ။
  • TCP lives here; it is a protocol which send data in a reliable way.
  • UDP lives here; it is a protocol which sends data in an unreliable way.

Layer 5: Session layer
ဒီ layer ကေတာ့ host ၂ခုု ၾကားမွာ session ေတြကိုု establishing, managing and termination စတာေတြကိုု တာ၀န္ယူလုုပ္ေဆာင္ေပးပါတယ္။ သင္ဟာ website တစ္ခုု ကိုု  အင္တာနက္ကေနတဆင့္ access  လုုပ္ မယ္ဆိုုရင္ ေတာ့ တျခားသူေတြ အသံုုးျပဳမွဳနဲ႔ session ေတြ မတူၾကပါဘူး။ အဲတာ ကိုု session layer က  လမ္းေၾကာင္းသတ္မွတ္ေပးတာပါ။ this webserver needs to keep track of all the different sessions.

Layer 6: Presentation layer
ဒီ layer ကေတာ့ က်ေနာ္တုုိ႔ ရဲ့ information ေတြကိုု application layer မွာ readable ျဖစ္ေအာင္ formatting and structuring လုုပ္ေပးတာျဖစ္ပါတယ္။ most computers use the ASCII table for characters. If another character like EBCDIC than the presentation layer needs to refotmat the data so both computers agree on the same characters.

Layer 7: Application layer
Here are your applications. E-mail, browsing the web (HTTP or HTTPs), FTP and more.

ဟုုတ္ကဲ့ပါ၊ network engineer တစ္ေယာက္အေနနဲ႔ osi 7 layer ကိုု ရင္းနွီးပီးသားျဖစ္မွာပါ။ အဲဒီေတာ့ စာျပန္ေနြးတဲ့ အေနနဲ႔ပဲ အက်ဥ္းခ်ံုဳ႕ ပီး ေရးထားတာျဖစ္ပါတယ္။
Going from the application layer all the way down to the physical layer is what we call ENCAPSULATION. Going from the physical layer and working your way up to the application layer is called DE-ENCAPSULATION.
အခုု က်ေနာ္တိုု႔ OSI-model  အေၾကာင္းလဲ သိပီ၊ မတူညီတဲ့ layer ေတြနဲ႔ သူတိုု႔ ရဲ႕ function ေတြကိုုလဲ တီးမိေခါက္မိ ပီဆိုုေတာ့ ေရွ႕ဆက္ၾကမယ္ေလ ေနာ။

During peer-to-peer communication each layer has packets of information. We call these protocol data unit (PDU).

Now every unit has a different name on the different layers
  • Application, presentation, session; we talk about DATA
  • Transport layer; we talk about TCP SEGMENTS
  • Network layer; we talk about IP PACKETS
  • Data link layer; we talk about ETHERNET FRAME
  • Physical layer; we talk about BIT

ေနာက္တစ္ခုု
Network model မွာ တျခား popular ျဖစ္တဲ့ model  ရွိပါေသးတယ္။ အဲတာကေတာ့ TCP/IP stack  ပါပဲ


As you can see the upper three layers are now combined to the “Application layer”. The
network layer is called the “Internet” layer and the bottom 2 layers are combined into the
“Network Access” layer.clip_image004
က်ေနာ္တို႕ Chapter 4: TCP/IP Protocol မွာ ျပန္ေတြ႕ၾကမယ္ဗ်ာ။


 #Nikoye Network Training 
ပထမ ေတာ့ သူတို႕ မင္းကို မသိက်ိဳးကၽြံ ျပဳၾကလိမ့္မယ္
ေနာက္ပီး မင္းကို ေလွာင္ရယ္ၾကလိမ့္မယ္
ပီးေတာ့ တိုက္ခိုက္ၾကလိမ့္မယ္
ဒါဆိုရင္ မင္းနိုင္ပီေလ။။
Gandhi
PCC ႏွင့္ လ ိုင္း ေပါင္း ၾကည့္ ရ ေအာင္ ######################## ( 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) က ို လ ိုင္း က ို ေပါင္းပါမယ္ Lan ip =192.168.0.1/24 ေပး ထားပါတယ္ ၊ ပထမ ဆံိုး ip ေပး တ ့ အပ ိုဒ္ ပါ / ip address add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=LAN add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=ISP1 add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=ISP2 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ထံိုးစံအတ ိုင္း 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 checkgateway=ping 2. add dst-address=0.0.0.0/0 gateway=10.112.0.1 routing-mark=to_ISP2 checkgateway=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 ကေန မွတ္တာ က အေသခ ာဆံိုး ပါပ မ မ ကြ မ္းက င္ မွွဴ အတ ိုင္း တျခားေနရာ ေနမွလည္း မွတ္သားန ိုင္ ပါတယ္ add chain=prerouting dst-address=10.111.0.0/24 action=accept in-interface=LAN add chain=prerouting dst-address=10.112.0.0/24 action=accept in-interface=LAN ျပီးေတာ့ wan ဘက္ အျခမ္း ကေန ဝင္ေရာက္မယ္ connection ေတြ က ို ျပန္ထြက္ ရင္ ဝင္ တ ့ လ ိုင္း ကေန ျပန္ ထြက္ေပးန ိုင္ ေအာင္ လ ို႕ ေရးေပးတာ ပါ ဒီ မွာ Mark လိုပ္ ေပး တ ့ connection-mark က ို routing-mark ထပ္ မွတ္ေပးျပီး routing table ကေန ထ န္းေပးလ ိုက္ မွာ ျဖစ္ပါတယ္ add chain=prerouting in-interface=ISP1 connection-mark=no-mark action=markconnection new-connection-mark=ISP1_conn add chain=prerouting in-interface=ISP2 connection-mark=no-mark action=markconnection new-connection-mark=ISP2_conn @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 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| srcaddress|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-addresstype=!local per-connection-classifier=both-addresses:2/0 action=mark-connection newconnection-mark=ISP1_conn 2. add chain=prerouting in-interface=LAN connection-mark=no-mark dst-addresstype=!local per-connection-classifier=both-addresses:2/1 action=mark-connection newconnection-mark=ISP2_conn @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ line No 1 and 2 ကေတာ့ အေပၚက connection-mark ေတြက ို routing mark ျပန္ လိုပ္ ေပး ထားတာပါ line No 3 and 4 ကေတာ့ router output ကေန ျဖတ္ မယ့္ connection-mark ထား တာ ေတြ က ို လည္း အဆင္ေျပေျပ ထြက္န ိုင္ ေအာင္ routing-mark လိုပ္ေပးတာျဖစ္ ပါတယ္ 1. add chain=prerouting connection-mark=ISP1_conn in-interface=LAN action=markrouting new-routing-mark=to_ISP1 2. add chain=prerouting connection-mark=ISP2_conn in-interface=LAN action=markrouting new-routing-mark=to_ISP2 3. add chain=output connection-mark=ISP1_conn action=mark-routing new-routingmark=to_ISP1 4. add chain=output connection-mark=ISP2_conn action=mark-routing new-routingmark=to_ISP2 ဒီ routing-mark ေတြက ို routing table ထ က ေန ခြ လႊတ္ေပးလ ိုက္ ရင္ ကြ န္ေတာ္ တ ို႕ လ ိုျခင္ တ ့ equal bandwith load balancing ရပါျပီ ။ Kyaw ko ko thu

Discord



We are in discord now.
https://discord.gg/u3GdPPS