Ch 22 -present1. 7. Application Layer
6. Presentation Layer
5. Session Layer
4. Transport Layer
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
2. Transport layer duties
Application layer
Transport layer
Network layer
Datalink layer
Physical layer
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
3. Transport layer duties
Connection-oriented:
มีก ารสร้า งการเชื่อ มต่อ (connection) ก่อ น จากนั้น จึง ส่ง
ข้อ มูล
ช้า ในตอนเริ่ม ต้น แต่ช ัว ร์
Connectionless:
ไม่ม ีก ารสร้า งการเชื่อ มต่อ (connection) สามารถส่ง ข้อ มูล ได้เ ลย
ส่ง ได้ร วดเร็ว แต่ไ ม่ร ับ ประกัน ว่า ถึง หรือ ไม่
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
4. Transport layer duties
กำา หนดหมายเลข port สำา หรับ process
บนคอมพิว เตอร์ เพื่อ การส่ง ข้อ มูล แบบ
process-to-process delivery
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
5. Transport layer duties
Flow control
Error control
คล้า ย Datalink layer แต่จ ะทำา ใน
ระดับ process-to-process แทนที่
จะเป็น ในระดับ node-to-node
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
6. Chapter 22
Process-to-Process
Delivery:
UDP and TCP
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
7. 22.1 Process-to-Process Delivery
The transport layer is responsible for
process-to-process delivery.
process-to-process delivery คือ การ
ส่ง ข้อ มูล (ส่ว นของข้อ ความ) จาก
process หนึ่ง ไปยัง อีก process หนึง่
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
8. Figure 22.1 Types of data deliveries
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
9. Note:
สอง process ใดๆ จะสื่อ สารกัน
ในลัก ษณะ
ผูร ับ บริก ารและผู้ใ ห้บ ริก าร
้
(client/server relationship)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
10. Port numbers Channel 35
Channel
21
Channel 18
Port 1863
Port 80
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
11. Figure 22.3 IP addresses versus port numbers
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
12. Figure 22.5 Socket address
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
13. Figure 22.6 Multiplexing and demultiplexing
Port 23
Port Port 21
80
192.168.0.15
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
14. 22.2 UDP
Port Numbers
User Datagram
Applications
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
15. - UDP is a connectionless, unreliable
- ไม่ม ีก ารทำา flow and error control
- ใช้ port numbers ทำา multiplex data
จาก application layer.
- มีค วามเร็ว เพราะ ไม่ต ้อ งผ่า นการ
จัด การข้อ ผิด พลาดใด ๆ
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
16. หมายเลขพอร์ต (Port number)
หมายเลขพอร์ต คือ หมายเลขที่ใช้ระบุโพรโทคอลของโปรแกรมประยุกต์เป็น
ตัวเลขขนาด 16 บิต เป็นเสมือนแอดเดรสประจำาโพรโทคอลในชั้นประยุกต์ทีซีพี /ไอพี
IANA ( Internet Assigned Numbers Authority ) ได้จำาแนกประเภทของพอร์ตเป็น
3 ประเภท ดังนี้
1. The well-known ports เป็นหมายเลขพอร์ตสากลที่ใช้เป็นมาตรฐานในเครือข่าย
อินเทอร์เน็ต เช่น พอร์ตหมายเลข 21 เป็นพอร์ตสำาหรับรับส่งไฟล์ FTP (File
Transfer Protocol) เป็นต้น โดย The well-known ports เป็นพอร์ตตั้งแต่ 0 - 1023
2. The Registered Ports เป็นหมายเลขพอร์ตลงทะเบียนสำาหรับองค์กรต่างๆ เช่น
พอร์ตหมายเลข 1863 เป็นของ MSN Messenger เป็นต้น โดย The Registered
Ports เป็นพอร์ตตั้งแต่1024 -49151
3. The Dynamic and/or Private Ports เป็นหมายเลขพอร์ตอิสระที่ไม่ใช่ The well
knownports และไม่ใช่ The Registered Ports โดย Dynamic Ports นี้ แอพลิเคชั่
นทั่วไป สามารถเลือกมาใช้ได้และเป็นพอร์ตตั้งแต่ 49152 – 65535
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
18. TCP เป็น โพรโทคอล TCP/IP ทำา งานบน Transport
เป็น โพรโทคอลแบบ “ Connection - oriented”
1. จัด เตรีย มการส่ง ถ่า ยข้อ มูล โดยสร้า งการเชื่อ มต่อ
2. รัก ษาสภาพการเชื่อ มต่อ
3. ส่ง ข้อ มูล ให้แ น่ใ จว่า ข้อ มูล ถึง ปลายทางอย่า งถูก ต้อ ง ทีซ ีพ ี
ฝั่ง
ผู้ส ่ง ต้อ งส่ง แพ็ค เก็ท ซำ้า ใหม่ห ากแพ็ค เก็ท สูญ หาย
3.จัด ลำา ดับ แพ็ค เก็ท ให้ถ ูก ต้อ งตามลำา ดับ , กำา จัด แพ็ค เก็ท ซำ้า
ซ้อ น
4. ยกเลิก สภาพการเชื่อ มต่อ เมื่อ สิ้น สุด การส่ง ถ่า ยข้อ มูล
TCP ต้น ทางจัด รูป แบบข้อ มูล เพื่อ ส่ง ให้ไ อพีด ำา เนิน การ ทีซ ีพ ี
ปลายทางเมื่อ รับ แพ็ค เก็ท จากไอพี ก็จ ะส่ง ต่อ ให้โ พรโทคอล
ประยุก ต์ท ี่ใ ช้บ ริก ารผ่า นทีซ ีพ ี
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
19. Session layer
- Half - full duplex
- Socket
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
20. Presentation
layer
- Data format, ACSII,EBCDIC
- JPEC
- Data Encode
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
21. Application Layer
ได้จ ัด เตรีย มโปรโตคอลต่า งๆ มากมาย ใน
ทีน ไ ด้ก ล่า วถึง โปรโตคอลทีส ำา คัญ อย่า ง
่ ี้ ่
คร่า วๆ ดัง นี้ DHCP, DNS, TELNET, FTP,
SMTP, POP, SNMP, HTTP, URL, WWW,
HTML
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
22. TCP/IP
protocol
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
23. messag
e
segment
Packet
Frame
ส่ง
สถาปัต ยกรรมชุด ข้อ มูล
แบบจำา ลอง ผ่า น
โปรโตคอล TCP/IP
OSI
ตัว กลา
งไปยัง
สื่อ สาร
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
24. source Encapsulatio
message
n
M application
segment Ht M transport
datagram Hn Ht M network
frame Hl Hn Ht M link
physical
Hl Hn Ht M link Hl Hn Ht M
physical
switch
destination Hn Ht M network Hn Ht M
M application
Hl Hn Ht M link Hl Hn Ht M
Ht M transport physical
Hn Ht M network
Hl Hn Ht M link router
physical
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
26. OSI and Protocol Stack
OSI Model TCP/IP Hierarchy Protocols
7 th
Application Layer
6 th
Presentation Layer Application Layer
5 th
Session Layer
4 th
Transport Layer
Transport Layer
3 rd
Network Layer
Network Layer
2 nd
Link Layer
Link Layer
1 st
Physical Layer
Link Layer : includes device driver and network interface card
Network Layer : handles the movement of packets, i.e. Routing
Transport Layer : provides a reliable flow of data between two
hosts
Application Layer : handles the details of the particular application
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
27. มีโ ปรโตคอลหลัก คือ IP และ
ยัง สนับ สนุน โปรโตคอลอืน ๆ
่
อีก 4 โปรโตคอล ได้แ ก่ ARP,
RARP, ICMP และ IGMP ดัง
ต่อ ไปนี้
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
28. โปรโตคอล ARP (Address Resolution
Protocol)
TCP/IP ใช้ว ิธ ีอ ้า งอิง โดยกำา หนด
หมายเลข IP ซึ่ง เป็น วิธ ีท าง
ซอฟท์แ วร์
โปรโตคอล ARP จะทำา งานร่ว มกับ
โปรโตคอล IP โดยการ เปลี่ย น
หมายเลข IP ให้เ ป็น หมายเลขแมค
แอดเดรสของ Network Interface
(IP -> MAC)
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
29. โปรโตคอล ARP (Address Resolution
Protocol)
เมือ เครื่อ งต้น ทางต้อ งการทราบ MAC Address
่
ปลายทาง จะทำา การค้น หา Physical Address ปกติ
จะตรวจสอบจาก ARP Cache อัน ดับ แรก หากใน
ARP Cache ไม่ม ี จึง ทำา การ ARP Request และ
ARP Response ดัง นี้
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
30. โปรโตคอล RARP (Reverse
Address Resolution Protocol)
RARP ทำา หน้า ที่เ ปลี่ย นหมายเลขแมค
แอดเดรสให้เ ป็น หมายเลขไอพีแ อดเดรส
(MAC -> IP)
ใช้ง านกับ Diskless Computer โดยจัด
เก็บ ความสัม พัน ธ์ร ะหว่า ง IP Address กับ
Mac Address บนเครื่อ งเซิร ์ฟ เวอร์
หากต้อ งการทราบหมายเลขไอพีป ลายทาง
ต้น ทางจะทำา การบรอดแคสต์ RARP
Query Packet ที่ม ีห มายเลขแมคแอดเดรส
เพื่อ สอบถามทุก ๆโฮส เมือ ถึง ปลายทางจะ
่
ทำา การตอบกลับ หมายเลขไอพี McGraw-Hill Companies, Inc., 2004
McGraw-Hill ©The ไปยัง โฮส
31. โปรโตคอล ICMP (Internet Control Message
Protocol)
โปรโตคอลที่ใ ช้ใ นการตรวจสอบและ
รายงานสถานภาพของดาต้า แกรม เช่น
กรณี Routerไม่ส ามารถส่ง ดาต้า แกรมไป
ถึง ปลายทางได้ ICMP จะถูก ส่ง ออกไป ยัง
โฮสต้น ทางเพื่อ รายงานข้อ ผิด พลาด ที่เ กิด
ขึ้น อย่า งไรก็ด ี ไม่ม อ ะไรรับ ประกัน ได้ว ่า
ี 1. Query ใช้ส อบถาม
ICMP Message ที่ส ่ง ไปจะถึง ผูร ับา งกัง หรือ
สถานะระหว่ จริ น จาก
้
ไม่ โดยมีห ลัก การทำา งานดัง นีน การส่ง Echo
รูป เป็ ้
request เพือ ถามสถานะ
่
ของปลายทาง ซึ่ง โฮส
ปลายทางอยู่ใ นสถานะ
ปกติ สามารถทำา การ
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
32. 2. Error Report ใช้ร ายงานข้อ ผิด พลาดทีเ กิด
่
ขึ้น เช่น หากไม่ส ามารถส่ง ดาต้า แกรมไปถึง
ปลายทางได้ เร้า เตอร์จ ะส่ง ICMP Message
Host Unreachable กลับ มารายงานโฮส
ต้น ทาง ดัง รูป
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
33. - LAYER
1,2
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
34. F8 F8
F7 F7
F6 F6
F5 F5
F4 F4
F3 F3
F2 F2
F1 F1
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
35. ตึก A ตึก B
Dis. Switch 8 x24 Utp x24 Utp x24 Dis. Switch 9 x24
Fl8
Utp x24 Utp x24
Fl7
Utp x24 Utp x15
Fl6
Utp x 40
Utp x 10
Fl5
FO 4x4 FO 1x4
FO 4x4
Cord Switch 2x12 FO
Fl4
Utp x20
Utp x1 Utpx8
Utp x1
FO 3x4 FO 3x4
Fl5 Utp x24 Utp x24
Utp x24
Fl2 Utp x24
Fl1 Utp x10 Utp x15
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
36. - LAYER 3
- Public IP
- Private IP
-
Subnetting
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
37. SUBNETTIN
G
IP Address 1 ชุด จะ
ต้อ งบอกคือ
1.Subnet Mask
2.Network IP
3.Broadcast IP
4.Number of Host IP ที่
นำำ มำใช้ง ำน
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
38. 192.168.100.0/24
Broadcast =
Host n 192.168.100.254 192.168.100.255
Host 1
192.168.100.1
Host n-1 Host 2
x 192.168.100.2
Network IP
192.168.100.0
192.168.100.253
Host 3
Host n-2 192.168.100.3
192.168.100.252
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
39. 192.168.100.0/24 192.168.200.0/24
192.168. 192.168.200.255
Host 1
100.255
Host 1 192.168.100.1
192.168.200.1
192.168.
Host n-1 Host 2
192.168.200.0
x
192.168.200.2
100.0
192.168.100.2
Host n
Host n 192.168.200.3
192.168.100.254
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
40. 192.168.100.0/24 192.168.200.0/24
192.168. 192.168.200.255
Host 1
100.255
Host 1 192.168.100.1
192.168.200.1
192.168.
Host n-1 Host 2
192.168.200.0
192.168.100.5
192.168.200.2
100.0
192.168.100.2 192.168.200.5
Host n
Host n 192.168.200.254
192.168.100.254
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
41. กำรดูค ่ำ จำก ของ Subnet Mask
/30 = 11111111 . 11111111 .
11111111 . 111111/00 =
/27 = 11111111 . 11111111 .
255.255.255.252
11111111 . 111/00000 =
/20 = 11111111 . 11111111 . 1111/0000 . 00000000 = 255.255.240.0
255.255.255.224
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
43. Ex.1 192.168.22.50/30
1) Subnet
/30 = 11111111 . 11111111
. 11111111 . 111111/00
2) หำจำำ= 255.255.255.252ดูจ ำก
นวน IP ต่อ Subnet
2(32-30) =2 = 4 คืSubnet หรือ Network
3) หำจำำ นวน อ (00,01,10,11)
Subnet 0 form อ 2
ทั้ง หมด คื (000000) = 6192.168.22.0-192.168.22.3
= 64
(8-2) =
Subnet 1 from(000001) = 192.168.22.4-192.168.22.7
Subnet 2 from(000010) = 192.168.22.8-192.168.22.11
--------------------------------
Subnet 12 from (0001100) = 192.168.22.48 -
192.168.22.51
---------------------------------
Subnet 63 form (111111) = 192.168.22.252-
192.168.22.255
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
44. จำก
Subnet 12 = 192.168.22.- 192.168.22.51
192.168.22.48
50/30
Subnet Mask =
255.255.255.252
Network IP =
192.168.22.48 =
Broadcast IP
192.168.22.51
Host IP = 192.168.22.49
and 192.168.22.50
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
45. Subnet Mask = 255.255.255.252
Broadcast =
Host 1 192.168.22.51
192.168.22.49
192.168.
22.48
Host 2
192.168.22.50
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
46. END
.
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Editor's Notes Ports were developed so that computers could accept data from multiple sources over the same IP address . Think if it like this; Your TV service is the Internet, and the ports are you channels . You have many forms of entertainment, news, and information available through many different channels . Think about this, lets say that MTV is channel 35 on your TV . The same is true for web servers that run on port 80 . Every port has a special purpose just as each channel serves a different television program . While you only have 1 cable TV subscription, you can still receive multiple channels . Two main types of ports : TCP and UDP . TCP stands for Transmission Control Protocol . UDP stands for User Data Protocol . Some programs on your computer will use TCP ports to communication and other may use UDP . It is important to know the difference between how the two operation . You can see how the server is listening for 3 ports over a single IP address ( 192.168.0.15 ). You should also know that it is possible for multiple devices to connect to a single port . Meaning, a telnet server may accept over 100 simultaneous connections to port 23 . UDP ( User Datagram Protocol ) is anther commonly used protocol on the Internet . However, UDP is never used to send important data such as webpages, database information, etc; UDP is commonly used for streaming audio and video . Streaming media such as Windows Media audio files (. WMA ) , Real Player (. RM ) , and others use UDP because it offers speed ! The reason UDP is faster than TCP is because there is no form of flow control or error correction . The data sent over the Internet is affected by collisions, and errors will be present . Remember that UDP is only concerned with speed . This is the main reason why streaming media is not high quality . TCP ( Transmission Control Protocol ) is the most commonly used protocol on the Internet . The reason for this is because TCP offers error correction . When the TCP protocol is used there is a " guaranteed delivery ." This is due largely in part to a method called " flow control ." Flow control determines when data needs to be re - sent, and stops the flow of data until previous packets are successfully transferred . This works because if a packet of data is sent, a collision may occur . When this happens, the client re - requests the packet from the server until the whole packet is complete and is identical to its original .