720 likes | 732 Views
This course provides an overview of networking, including network classification, OSI 7-layer model, Internet protocols, network equipment, and more. Learn the fundamentals of networking and gain a solid foundation in the field. Course taught by Yen-Cheng Chen at NCNU.
E N D
網路與通信協定 陳彥錚 (Yen-Cheng Chen) ycchen@ncnu.edu.tw http://www.ncnu.edu.tw/~ycchen/
內容大綱 • 1. 網路基本認識 • 2. OSI 7層參考模型 • 3. Internet 通信協定集 • 4. 網路設備 • 5. 網管相關通信協定
1. 網路基本認識 • 網路分類 • 網路技術 • 網路傳輸介質 • 網路設備
網路分類 • 網路 - 依終端應用區分 • 數據通信網路 (Data Communication Network) • 電信網路 (Telecommunication Network) • 網路 - 依距離區分 • LAN (Local Area Network) • MAN (Metropolitan Area Network) • WAN (Wide Area Network)
網路分類 (續) • 網路 - 依交換方式 • 線路交換 (Circuit Switching) • 分封交換 (Packet Switching) • 網路 - 依傳輸介質 • 有線網路 (Wired Network) • 無線網路 (Wireless Network)
網路技術 Gigabit Ethernet ATM Bandwidth Fast Ethernet FDDI MAN & SMDS Frame Relay Ethernet Token Ring ISDN (basic rate) Distance LAN MAN WAN
Media Wireline Transmission Wireless Transmission Electric Conductors Optical Fiber Radio Laser Links Infrared Twisted Pair Coaxial Cable Mono-mode Multi-mode Satellite Transmission Microwave 網路傳輸介質
網路設備 • LAN/Internet設備 • Repeater • Hub • Bridge • Switch • Router • Gateway • WAN設備 • Modem • Repeater • ADM (Add-Drop Multiplexer) • Cross-Connect • Switch • Multiplexer • Concentrator
2. OSI 7層參考模型 • OSI Model • OSI - Open Systems Interconnection • 由國際標準組織ISO (International Standard Organization)制定之網路分層架構標準。 • OSI參考模型,從實體傳輸介質至上層網路應用,由低而高共包括七個層級 • OSI之網路標準,依循OSI參考模型之七層級制定,以便清楚完整規範網路應有之功能元件以及必須遵守的準則。
7 6 5 4 3 2 1 Application Presentation Session Transport Network Data Link Physical OSI Reference Model 7: 應用層 6: 表現(展示)層 5: 交談(會議)層 4: 傳輸層 3: 網路層 2: 資料鏈結層 1: 實體層
OSI 通信架構 Application protocol Application Application Presentation protocol Presentation Presentation Session protocol Session Session Transport protocol Transport Transport Network Network Network Network Data Link Data Link Data Link Data Link Physical Physical Physical Physical Host A IMP 1 IMP 2 Host B
Layer 1 & 2 • Layer 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 layer • Provides the transmission of packets. • Performs error detection and correction functions to ensure that a packet contains the same information received as sent.
Layer 3 & 4 • Layer 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 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.
Layer 5 & 6 • Layer 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 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.
Layer 7 • Layer 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.
3. Internet通信協定集 • 常稱TCP/IP通信協定 • 並沒嚴格定義通信層級 • 一般將TCP/IP通信協定分為四層 • 處理層 (Process Layer) • 主機對主機層 (Host-to-host Layer) • 網際網路層 (Internet Layer) • 網路存取層 (Network Access Layer)
HTTP SMTP ECHO FTP TIME NNTP TELNET NTP DHCP SNMP DNS BOOTP TCP UDP RIP OSPF BGP ICMP IGMP IP ARP RARP SLIP PPP Internet通信協定 Application Transport Network Network Access Data Link
IP (Internet Protocol) • IP位於網際網路層,(OSI第三層) • 主要提供多個互連網路間之路由/繞送(Routing)功能。 • 協定特性:Connectionless、Unreliable • 為能提供有效路由功能,制定了IP定址機制。 • 每一TCP/IP網路上之主機均有一32-bit IP位址。 • 140.131.76.1
Host Network IP Address • 長度:4 Bytes (32-Bit) • 每一IP 位址包括兩個部份 • 網路位址 (Network Address) • 主機位址 (Host Address) • 有時一網路會再分割為多個子網路,此時主機位址又再細分為子網路(Subnet)及主機(Host)兩個部份。 Subnet Host Network
Special IP Addresses • All-0 host suffix Þ Network Address • All-0s Þ This computer (0.0.0.0) • All-0s network Þ This network. E.g., 0.0.0.7 = Host 7 on this network • All-1 host suffix Þ All hosts on the destination net (directed broadcast) • All-1s Þ All hosts on this net (limited broadcast) Þ Subnet number cannot be all 1 • 127.*.*.* Þ Looback through IP layer
Private IP Addresses • Any organization can use these inside their network • Can’t go on the internet. [RFC 1918] • 10.0.0.0 - 10.255.255.255 (10/8 prefix) • 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) • 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) 1 16 256
網路遮罩(Netmask) • 網路遮罩,將一IP位址中之代表網路及子網路位址之位元設為1,其餘設為0即為網路遮罩。 • Class A 255.0.0.0 • Class B 255.255.0.0 • Class C 255.255.255.0 • 網路遮罩與IP位址利用邏輯AND便可得到網路位址。
Routers and the IP Addressing Principle • Routers have two or more addresses. One for each interface.
Routing Table IF ((Mask[i] & Destination Addr) = = Destination[i]) Forward to NextHop[i]
TCP (Transmission Control Protocol) • 傳輸控制協定(TCP)位於主機對主機層,(相對於OSI第4層)。 • 連結導向(Connection-Oriented) • three-way handshake • 提供具可靠性(Reliable)之傳輸 • Sequencing, Checksum • 負責傳送端(Sender)與接收端(Receiver)間之流量控制(Flow Control) • Sliding Window
UDP (User Datagram Protocol) • UDP位於主機對主機層,相對於OSI第4層。 • 協定特性:Connectionless、Unreliable • 提供一簡單快速的主機間資金傳送機制。
通信埠(Port) • 每個主機之應用/處理層上可能有各種不同的應用、服務、或資源,每當一主機收到由網路上傳來之資料時,傳輸層必須提供一能辨別網路應用服務之機制,以便將資料分派至正確的處理程式。 • 每一上層通信應用服務或程式對應一唯一的TCP或UDP通信埠號(Port Number)。
常見TCP/IP應用服務與埠號 UDP TCP 21 FTP 23 Telnet 25 SMTP 53 DNS 79 Finger 80 HTTP 110 POP3 119 NNTP 123 NTP 53 DNS 67 BOOTP 69 TFTP 161 SNMP 162 SNMP-Trap Port: 1~1024,網際網路標準專用
4. 網路設備 • Repeater • Hub • Bridge • Switch • Router • Routing Switch • Gateway
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.
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.
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.
Application Presentation Session Transport Network Network Data Link Data Link Physical Physical Bridge Example Application Presentation Session Bridge Transport Data Link Data Link Physical Physical
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.
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.
Application Presentation Session Transport Network Network Network Network Data Link Data Link Data Link Data Link Physical Physical Physical Physical Router Example Application Presentation Session Router Transport
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.
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.
5. 網管相關通信協定 • SNMPv1 • SNMPv2C • ICMP • ARP/RARP • DHCP
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.
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.
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.
ICMP Type Echo Request / Echo Reply Destination Unreachable Source Quench Redirect Time Exceeded Parameter Problem Timestamp Request / Timestamp Reply Address Mask Request / Address Mask Reply 8 / 0 3 4 5 11 12 13 / 14 17 / 18
Ping • Most basic tool for internet management • Based on ICMP ECHO_REQUEST message • Available on all TCP/IP stacks • Useful for measuring • Connectivity • Packet Loss • Round Trip Time • Can do auto-discovery of TCP/IP equipped stations on single segment
ping Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] destination-list Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet. -i TTL Time To Live. -v TOS Type Of Service. -r count Record route for count hops. -s count Timestamp for count hops. -j host-list Loose source route along host-list. -k host-list Strict source route along host-list. -w timeout Timeout in milliseconds to wait for each reply.
Example C:\>ping -n 10 -l 256 www.im.ncnu.edu.tw Pinging euler.im.ncnu.edu.tw [163.22.20.16] with 256 bytes of data: Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Reply from 163.22.20.16: bytes=256 time=1ms TTL=253 Ping statistics for 163.22.20.16: Packets: Sent = 10, Received = 10, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 1ms, Maximum = 1ms, Average = 1ms