บทที่ 8 : tcp/ip และอินเทอร์เน็ต part2 · c. 14.23.120.8 d....

18
บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 สธ313 การสื่อสารข้อมูลและเครือข่ายคอมพิวเตอร์ทางธุรกิจ อาจารย์อภิพงศ์ ปิงยศ [email protected]

Upload: others

Post on 03-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

บทท 8 : TCP/IP และอนเทอรเนต Part2สธ313 การสอสารขอมลและเครอขายคอมพวเตอรทางธรกจ

อาจารยอภพงศ ปงยศ

[email protected]

Page 2: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

Outline

การก าหนดต าแนงทอยใน IPv4

การแทนคาไอพแอดเดรสแบบเลขฐานสองและฐานสบ

การจดสรรไอพแอดเดรสแบบใชคลาส (Classful Addressing)

การแบงเครอขายยอย (Subnetting)

ล าดบชน 3 ระดบ (Three Levels of Hierarchy)

ซบเนตแมสก (Subnet Mask)

การจดสรรไอพแอดเดรสแบบไมใชคลาส (Classless Addressing)

2

Page 3: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

การก าหนดต าแนงทอยใน IPv4(IPv4 Addressing)

TCP/IP จะก าหนดทอยดวยไอพแอดเดรส ซงไอพแอดเดรสทใชอยางแพรหลายทสดเปนชดเลขฐานสองขนาด 32 บต ทเรยกวา IP version4 (IPv4)

IP Address v4 จะถกแบงเปน 2 สวน คอNetID ใชในการระบเครอขายทคอมพวเตอรเชอมตอHostID ใชระบต าแหนงของอปกรณ

เราเตอรจะวางเสนทางเฉพาะ NetID เทานน โฮสตทม NetID ชดเดยวกน จะอยบนเครอขายเดยวกน ภาระการสงแพคเกตในเครอขายเดยวกนจะเปนหนาทของดาตาลงกตอไป

IP Address ไมใชหมายเลขส าหรบอางองโฮสตใดโฮสตหนงจรงๆ การอางองต าแหนงจรงจะใช MAC Address บนการดเครอขาย

3

Page 4: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

การแทนคาไอพแอดเดรสแบบเลขฐานสองและฐานสบ4

The address space of IPv4 is

232 or 4,294,967,296.

IP Address มหมายเลข 4 ชด ชดละ 8 Bit รวมทงหมดเปน 32 Bit

Page 5: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

5Find the error, if any, in the following IPv4 addresses.

Example 1

Solution

a. There must be no leading zero (045).

b. There can be no more than four numbers.

c. Each number needs to be less than or equal to 255.

d. A mixture of binary notation and dotted-decimal

notation is not allowed.

Page 6: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

การจดสรรไอพแอดเดรสแบบใชคลาส (Classful Addressing)

IPv4 จะมการแบงคลาสออกเปน 5 คลาส โดยแตละคลาสออกแบบมาเพอรองรบความตองการทแตกตางกนของแตละองคกร

6

Page 7: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

การแสดงคลาสในรปแบบเลขฐานสองและเลขฐานสบ7

NetID HostID

Page 8: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

Note

จากจ านวนโฮสตของไอพแอดเดรสคลาสตางๆจะมการหกออก 2 เนองจากโฮสตไบนาร 00000000 และ 11111111 จะถกสงวนเอาไว

โฮสตไบนาร 00000000 (x.x.x.0) สงวนไวอางองหมายเลขของเครอขาย (Network IP)

โฮสตไบนาร 11111111 (x.x.x.255) จะสงวนไวเพอการบรอดคาสตไปยงทกโฮสตทอยในเครอขายนนๆ (Broadcast ID)

8

Page 9: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

9

Find the class of each address.

a. 00000001 00001011 00001011 11101111

b. 11000001 10000011 00011011 11111111

c. 14.23.120.8

d. 252.5.15.111

Example 2

Solution

a. The first bit is 0. This is a class A address.

b. The first 2 bits are 1; the third bit is 0. This is a class C

address.

c. The first byte is 14; the class is A.

d. The first byte is 252; the class is E.

Page 10: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

ปญหาของการจดสรรไอพแอดเดรสแบบใชคลาส (Classful Addressing)คอการสญเสยหมายเลขไอพทไมไดน ามาถกใชงานจรงเปนจ านวนมาก

10

Page 11: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

การแบงเครอขายยอย (Subnetting)

โดยพนฐานแลว ไอพแอดเดรสจะมการแบงสวนออกเปน 2 สวน คอ NetID และ HostID แตปญหาคอเครอขายจะไมสามารถแบงกลมเปนเครอขายยอย ๆ ตามการใชงานจรงได

แนวทางการแกไขปญหาคอการจดกลมโฮสตโดยการแบงเปนเครอขายยอย (Subnetting) เพอใหเครอขายมขนาดเลกลง

เชน ก าหนดให 2 ไบตแรกเปน NetID (Class B), ไบตท 3 เปน SubnetIDและไบตท 4 เปน HostID

11

Page 12: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

12

Page 13: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

ล าดบชน 3 ระดบ (Three Levels of Hierarchy)

เปนการท าซบเนต โดยยมบตบางสวนของ HostID มาใชก าหนดซบเนตหมายเลขไอพจงประกอบไปดวยNetID ใชระบเนตเวรคไซต

SubnetID ใชระบฟสคลซบเนตเวรค

HostID ระบการเชอมตอของโฮสตกบซบเนตเวรค

การออกแบบซบเนตเปนหนาทของผดแลเครอขาย จ าเปนตองมการบรหารจดการใหการใชแอดเดรสมประสทธภาพ

13

Page 14: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

ซบเนตแมสก (Subnet Mask)

Subnet Mask เปนกระบวนการทบอกใหรวาเครอขายมการแบงซบเนต และมบตทยมไปแบงซบเนตจ านวนเทาไร

การออกแบบเครอขายจงจ าเปนตองมการระบซบเนตแมสกดวย

คา Default Subnet ของแตละคลาส เมอไมมการท าซบเนต จะเปนไปตามตารางน

14

Page 15: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

ซบเนตแมสก (Subnet Mask) [2]

บตทถกตงคาเปน 1 ทงหมด จะตรงกบ NetID และ SubnetID

บตทถกตงคาเปน 0 ทงหมด จะตรงกบ HostID

15

Subnet Mask Host IP Address Network IP

255.255.0.0 15.32.56.7 15.32.0.0

255.255.255.0 135.67.13.9 135.67.13.0

255.255.255.192 201.34.12.72 201.34.12.64

.11000000 (mask 192)

.01001000 (Host IP 72)

.01000000 (Net IP 64)

น า bit มา AND กน

Page 16: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

16

A block of addresses is granted to a small organization. We

know that one of the addresses is 205.16.37.39/28. What is the

first address in the block?

Solution

The binary representation of the given address is

11001101 00010000 00100101 00100111

If we set 32−28 rightmost bits to 0, we get

11001101 00010000 00100101 00100000

or

205.16.37.32

Example 3

Page 17: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

การจดสรรไอพแอดเดรสแบบไมใชคลาส(Classless Addressing)

การใช Classful Addressing จะคอนขางตายตวและไมยดหยน และกอใหเกดการใชไอพแอดเดรสอยางไมมประสทธภาพ จงแกปญหาดวยการจดสรรไอพแบบ Classless Addressing

Classless Addressing จะเนนจ านวนโฮสตทตองการใชงานจรง โดยไมสนวาเปนคลาสใด

ตอคาบหนา.....เตรยมตวใหพรอมส าหรบการค านวณ

17

Page 18: บทที่ 8 : TCP/IP และอินเทอร์เน็ต Part2 · c. 14.23.120.8 d. 252.5.15.111 Example 2 Solution a. The first bit is 0. This is a class A address

18