網路與通信協定 陳彥錚 (Yen-Cheng Chen) [email protected] ycchen

49
網網網網網網網 網網網 (Yen-Cheng Chen) [email protected] http://www.ncnu.edu.tw/ ~ycchen/

Transcript of 網路與通信協定 陳彥錚 (Yen-Cheng Chen) [email protected] ycchen

Page 1: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

網路與通信協定

陳彥錚 (Yen-Cheng Chen)[email protected]

http://www.ncnu.edu.tw/~ycchen/

Page 2: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

內容大綱

1. 網路基本認識 2. OSI 7 層參考模型 3. Internet 通信協定集 4. 網路設備 5. 網管相關通信協定

Page 3: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

1. 網路基本認識

網路分類 網路技術 網路傳輸介質 網路設備

Page 4: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

網路分類 網路 - 依終端應用區分

數據通信網路 (Data Communication Network)

電信網路 (Telecommunication Network)

網路 - 依距離區分 LAN (Local Area Network) MAN (Metropolitan Area Network) WAN (Wide Area Network)

Page 5: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

網路分類 ( 續 ) 網路 - 依交換方式

線路交換 (Circuit Switching) 分封交換 (Packet Switching)

網路 - 依傳輸介質 有線網路 (Wired Network) 無線網路 (Wireless Network)

Page 6: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

ATMATM

網路技術

LANLAN MANMAN WANWAN

EthernetEthernetToken RingToken Ring

GigabitGigabitEthernetEthernet

ISDN (basic rate)ISDN (basic rate)

FDDIFDDIFastFastEthernetEthernet

Frame RelayFrame RelayMAN & SMDSMAN & SMDS

Ban

dwid

th

Distance

Page 7: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

網路傳輸介質Media

WirelineTransmission

WirelessTransmission

ElectricConductors

OpticalFiber

TwistedTwistedPairPair

CoaxialCoaxialCableCable Mono-modeMono-mode Multi-modeMulti-mode

RadioRadio

MicrowaveMicrowaveSatelliteSatellite

TransmissionTransmission

InfraredInfrared Laser LinksLaser Links

Page 8: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

網路設備 LAN/Internet 設

備 Repeater Hub Bridge Switch Router Gateway

WAN 設備 Modem Repeater ADM (Add-Drop Multiplexer) Cross-Connect Switch Multiplexer Concentrator

Page 9: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

2. OSI 7 層參考模型 OSI Model

OSI - Open Systems Interconnection 由國際標準組織 ISO (International Standard

Organization) 制定之網路分層架構標準。 OSI 參考模型,從實體傳輸介質至上層網路應用,由低而高共包括七個層級

OSI 之網路標準,依循 OSI 參考模型之七層級制定,以便清楚完整規範網路應有之功能元件以及必須遵守的準則。

Page 10: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Application

Presentation

Session

Transport

Network

Data Link

Physical

77665544332211

OSI Reference Model

7: 7: 應用層應用層6: 6: 表現表現 (( 展示展示 )) 層層5: 5: 交談交談 (( 會議會議 )) 層層4: 4: 傳輸層傳輸層3: 3: 網路層網路層2: 2: 資料鏈結層資料鏈結層1: 1: 實體層實體層

Page 11: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

OSI 通信架構

ApplicationApplication

PresentationPresentation

SessionSession

TransportTransport

NetworkNetwork

PhysicalPhysical

Data LinkData Link

ApplicationApplication

PresentationPresentation

SessionSession

TransportTransport

NetworkNetwork

PhysicalPhysical

Data LinkData Link

Application protocol

NetworkNetwork NetworkNetwork

Data LinkData Link Data LinkData Link

PhysicalPhysical PhysicalPhysical

Presentation protocol

Transport protocol

Session protocol

Host A IMP 1 IMP 2 Host B

Page 12: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Layer 1 & 2

Layer 1. Physical layerLayer 1. Physical layer

•Establishes the actual physical connection between the computer equipment and the network.

•Provides the transmission of bits from one system to another.

Layer 2. Data link layerLayer 2. Data link layer

•Provides the transmission of packets.•Performs error detection and correction functions to ensure that a packet contains the same information received as sent.

Page 13: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Layer 3 & 4

Layer 3. Network layerLayer 3. Network layer

•Determines the path that will be taken through the network. •Controls the rate at which the network accepts packets, to avoid and recover from congestion.

Layer 4. Transport layerLayer 4. Transport layer

•Provides for the flow of data between sender and receiver,•Ensures that the data arrives at the correct destination.•Ensure that packets are sent at a rate the receiver and the application can cope with.

•At the receiver, the transport layer reassembles the packets into messages and delivers them to the next highest layer.

Page 14: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Layer 5 & 6

Layer 5. The session layerLayer 5. The session layer

•Allows the setup and termination of a communications path. Ensures that the sender is authentic and has access rights to establish a connection.

•Synchronizes the communication between two systems.

Layer 6. The presentation layerLayer 6. The presentation layer

•Converts outbound data from a machine-specific format to an international standard format.

•Converts inbound data from international format to a machine-specific format.

Page 15: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Layer 7

Layer 7. The application layerLayer 7. The application layer

•Provides the software for network services, such as file transfer, remote login, remote execution, e-mail, etc.

•Provides the interface between user programs and the network.

Page 16: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

3. Internet 通信協定集 常稱 TCP/IP 通信協定 並沒嚴格定義通信層級 一般將 TCP/IP 通信協定分為四層

處理層 (Process Layer) 主機對主機層 (Host-to-host Layer) 網際網路層 (Internet Layer) 網路存取層 (Network Access Layer)

Page 17: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Transport

Network

NetworkAccess

Application

PPPPPPSLIPSLIP

RARPRARPARPARP

IPIPIGMPIGMP

BGPBGPOSPFOSPF

ICMPICMP

RIPRIP

UDPUDPTCPTCP

SNMPSNMP

NNTPNNTP

HTTPHTTP

DNSDNS

TELNETTELNET

SMTPSMTP

BOOTPBOOTP

NTPNTP

FTPFTP

DHCPDHCP

TIMETIME

ECHOECHO

Internet 通信協定

Data LinkData Link

Page 18: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

IP (Internet Protocol)

IP 位於網際網路層, (OSI 第三層 ) 主要提供多個互連網路間之路由 / 繞送

(Routing) 功能。 協定特性: Connectionless 、 Unreliable 為能提供有效路由功能,制定了 IP 定址機

制。 每一 TCP/IP 網路上之主機均有一 32-bit IP

位址。 140.131.76.1

Page 19: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

IP Address

長度: 4 Bytes (32-Bit) 每一 IP 位址包括兩個部份

網路位址 (Network Address) 主機位址 (Host Address)

有時一網路會再分割為多個子網路,此時主機位址又再細分為子網路 (Subnet) 及主機 (Host) 兩個部份。

Network Host

Network HostSubnet

Page 20: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

IP 位址分類

Page 21: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen
Page 22: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen
Page 23: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen
Page 24: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

網路遮罩 (Netmask)

網路遮罩,將一 IP 位址中之代表網路及子網路位址之位元設為 1 ,其餘設為 0 即為網路遮罩。 Class A 255.0.0.0 Class B 255.255.0.0 Class C 255.255.255.0

網路遮罩與 IP 位址利用邏輯 AND 便可得到網路位址。

Page 25: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Routers and the IP Addressing Principle

• Routers have two or more addresses. One for each interface.

Page 26: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Routing Table

IF ((Mask[i] & Destination Addr) = = Destination[i])

Forward to NextHop[i]

Page 27: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

IP Forwarding Process

Page 28: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

IF ((Mask[i] & Destination Addr) = = Destination[i]) Forward to NextHop[i]

Page 29: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

TCP (Transmission Control Protocol)

傳輸控制協定 (TCP) 位於主機對主機層, ( 相對於 OSI 第 4 層 ) 。

連結導向 (Connection-Oriented) three-way handshake

提供具可靠性 (Reliable) 之傳輸 Sequencing, Checksum

負責傳送端 (Sender) 與接收端 (Receiver)間之流量控制 (Flow Control) Sliding Window

Page 30: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

UDP (User Datagram Protocol)

UDP 位於主機對主機層, 相對於 OSI 第4 層。

協定特性: Connectionless 、 Unreliable 提供一簡單快速的主機間資金傳送機制。

Page 31: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

通信埠 (Port)

每個主機之應用 / 處理層上可能有各種不同的應用、服務、或資源,每當一主機收到由網路上傳來之資料時,傳輸層必須提供一能辨別網路應用服務之機制,以便將資料分派至正確的處理程式。

每一上層通信應用服務或程式對應一唯一的 TCP 或 UDP 通信埠號 (Port Number) 。

Page 32: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

常見 TCP/IP 應用服務與埠號

21 FTP23 Telnet25 SMTP53 DNS79 Finger80 HTTP110 POP3119 NNTP123 NTP

53 DNS67 BOOTP69 TFTP161 SNMP162 SNMP-Trap

TCPTCP UDPUDP

Port: 1~1024 ,網際網路標準專用

Page 33: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

4. 網路設備

Repeater Hub Bridge Switch Router Routing Switch Gateway

Page 34: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Repeater

Operates at Layer 1, the physical layer. Connects two network segments into one large

segment, or to expand an existing segment. Enhances data signals and thus can be used to

extend maximum cabling distances. There is no network intelligence built into a simple

repeater; it is used strictly for signal propagation.

Page 35: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Hub Operates at Layer 1, the physical layer. Simply a multiport repeater. Can be used to increase overall network size and

number of nodes on a single segment. Can isolate faults within the subnet. Allows you to add stations to a segment without

disrupting the entire network.

Page 36: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Bridge

Operates at Layer 2, the data link layer. Allows networks with different physical signaling, but

with compatible data link addressing schemes, to communicate.

Helps reduce traffic on a backbone LAN by filtering any information coming from one segment to another that does not need to be forwarded through the backbone.

A common use for a bridge is to allow users on an Ethernet LAN and a Token Ring LAN to communicate with each other.

Page 37: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Bridge Example

ApplicationApplication

PresentationPresentation

SessionSession

TransportTransport

PhysicalPhysical

NetworkNetwork

Data LinkData Link

ApplicationApplication

PhysicalPhysical

PresentationPresentation

SessionSession

TransportTransport

NetworkNetwork

Data LinkData Link

PhysicalPhysical

Data LinkData Link

PhysicalPhysical

Data LinkData Link

BridgeBridge

Page 38: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Switch Operates at Layer 2, the data link layer. Dispatches data to its destination, which it

determines from the packet’s lower-layer media access control (MAC) address.

Can limit traffic, and does not understand network protocols.

Page 39: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Router Operates at Layer 3, the network layer. Connects two networks with different

technologies, and provides an intelligent means of transferring packets from one network to the other.

Also forwards traffic among multiple hubs and bridges.

Page 40: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Router Example

ApplicationApplication

PresentationPresentation

SessionSession

TransportTransport

PhysicalPhysical

NetworkNetwork

Data LinkData Link

ApplicationApplication

PhysicalPhysical

PresentationPresentation

SessionSession

TransportTransport

NetworkNetwork

Data LinkData Link

PhysicalPhysical

NetworkNetwork

Data LinkData Link

PhysicalPhysical

NetworkNetwork

Data LinkData Link

RouterRouter

Page 41: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Routing Switch Operates at Layer 3, the network layer. Combines the intelligence of a router with the

efficiency of a switch, Routing data at higher speeds.

Page 42: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

Gateway Operates at Layer 7, the application layer. Can encompass all seven of the OSI model

layers. A computing system that can be programmed

to do any number of intricate protocol conversions and negotiations, such as between IP and IPX.

Page 43: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen
Page 44: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

5. 網管相關通信協定

SNMPv1 SNMPv2C ICMP ARP/RARP DHCP

Page 45: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

SNMPv1 (Simple Network Management Protocol version 1)

The most common management protocol in use in data networks. Provides a means of obtaining information from, and sending

information to, network devices. Based on the manager-agent model. Uses Management Information Bases (MIBs) to exchange

information between the manager and the agent. Using the SNMP protocol, a manager can query and modify the

status and configuration information on each managed device by making requests to the agent running on the managed device.

All commands use the UDP/IP protocol, which means that communication between the manager and the agent is connectionless.

SNMP operates at Layer 7, the application layer.

Page 46: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

SNMPv2C (version 2)

SNMPv2C includes the basic functions of SNMPv1. Adds

new message types, standardized multi-protocol support, enhanced security, new MIB objects, and a way to co-exist with SNMPv1.

SNMPv2C is useful for the retrieval of large amounts of management information using fewer network resources.

Page 47: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

ICMP (Internet Control Message Protocol)

ICMP is the part of IP that handles error and control messages.

ICMP operates at Layer 3, the network layer. ICMP supports an echo function, which sends a packet

on a round-trip between two hosts. Ping, which sends a signal to see if an interface is up

and running, is based on ICMP echo. ICMP can also send an address mask request that

returns the address of the subnet mask on the remote system. This feature is important for non-SNMP devices.

Page 48: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

ARP/RARP (Address Resolution Protocol / Reverse ARP)

ARP/RARP are used at Layer 2, the link layer, ARP is used to map an IP address to a MAC (or

link level, or hardware) address. RARP is used to map a MAC address to an IP

address.

Page 49: 網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw ycchen

DHCP(Dynamic Host Configuration Protocol)

DHCP allows IP addresses to be allocated on a temporary basis (a lease).

When the lease for an IP address expires, the address can be reused by a different node.

This is useful in environments supporting mobile users who connect to the network with a laptop from many different places.

This helps alleviate the problem of limited IP addresses and simplifies TCP/IP client configurations.