1 / 135

封包的切割與組合

封包的切割與組合. 傳統 TCP/IP 通訊協定處理. TCP/IP 通訊協定架構的運作. 發送 應用程式透過 Socket API 以 TCP/IP 協定送出資料,作業系統再從使用者空間 (Memory) 複製要傳送的資料到系統空間前,先將資料封裝成數個封包,再進入 IP 佇列,引發軟體中斷來通知作業系統,再由作業系統使用 DMA 將封包複製到相對應的網路卡緩衝記憶體中。 傳送完成後,網路卡會發出硬體中斷告知驅動程式釋放剛才被佔用的緩衝記憶體。 接收

adia
Télécharger la présentation

封包的切割與組合

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 封包的切割與組合

  2. 傳統 TCP/IP 通訊協定處理

  3. TCP/IP 通訊協定架構的運作 • 發送 • 應用程式透過 Socket API 以TCP/IP協定送出資料,作業系統再從使用者空間(Memory)複製要傳送的資料到系統空間前,先將資料封裝成數個封包,再進入 IP 佇列,引發軟體中斷來通知作業系統,再由作業系統使用 DMA 將封包複製到相對應的網路卡緩衝記憶體中。 • 傳送完成後,網路卡會發出硬體中斷告知驅動程式釋放剛才被佔用的緩衝記憶體。 • 接收 • 當封包抵達網路卡時,會產生一個硬體中斷並使網路卡驅動程式運作,將進入的封包存放到網路卡的緩衝記憶體中,接著網路卡驅動程式使用DMA把封包從網路卡的緩衝記憶體複製到系統空間(Memory) ,並且把封包表頭的資訊推入 IP 層的接收佇列中。在此中斷服務常式結束前,會發出軟體中斷來通知作業系統。 • 當這些封包完成通訊協定的處理後,應用程式便可透過網路應用程式介面(Socket API)的接收命令把資料從系統的TCP/IP通訊協定層中複製過來。

  4. 網路各層的 MTU • Data Link Layer • Ethernet:1500 bytes • PPPoE:1492 bytes (8 bytes PPP Header)/1454 • ATM:48 bytes(5-byte ATM Header) • Token Ring:2044 bytes • IP Network Layer • Total length:65535 bytes • IP header:20 bytes ~ 60 bytes • Transport Layer • TCP/UDP:65535 bytes

  5. IP Message Fragmentation Process (1) • Fragmentation Issues and Concerns • IP is an unreliable, connectionless protocol. • Sequencing and Placement • The fragments will typically be sent in sequential order from the beginning of the message to the end, but they won't necessarily show up in the order in which they were sent. The receiving device must be able to determine the sequence of the fragments to reassemble them in the correct order. In fact, some implementations send the last fragment first, so the receiving device will immediately know the full size of the original complete datagram. This makes keeping track of the order of segments even more essential. • Separation of Fragmented Messages • A source device may need to send more than one fragmented message at a time; or, it may send multiple datagrams that are fragmented en route. This means the destination may be receiving multiple sets of fragments that must be put back together. Imagine a box into which the pieces from two, three or more jigsaw puzzles have been mixed and you understand this issue. • Completion • The destination device has to be able to tell when it has received all of the fragments so it knows when to start reassembly (or when to give up if it didn't get all the pieces).

  6. An Example

  7. IP Message Fragmentation Process (2) • Fragmentation-Related IP Datagram Header Fields • Total Length • Identification • More Fragments • Fragment Offset • The Copied Flag • The Don’t Fragment Flag

  8. IP Message Reassembly Process (1) • Asymmetry of Fragmentation and Reassembly • In IPv4, fragmentation can be performed by a router between the source and destination of an IP datagram, but reassembly is only done by the destination device. • Multiple-Stage Fragmentation • A primary differentiation between the two is that while intermediate routers can fragment a single datagram or further fragment a datagram that is already a fragment, intermediate devices do not perform reassembly. • The Reassembly Process • The receiving device follows a procedure to keep track of the fragments as they are received and build up its copy of the total received message from the source device. Most of its efforts are geared around dealing with the potential difficulties associated with IP being an unreliable protocol.

  9. IP Message Reassembly Process (2) • The details of implementation of the reassembly process • Fragment Recognition and Fragmented Message Identification • The recipient knows it has received a message fragment the first time it sees a datagram with the More Fragments bit set to one or the Fragment Offset a value other than zero. It identifies the message based on: the source and destination IP addresses; the protocol specified in the header; and the Identification field generated by the sender. • Buffer Initialization • The receiving device initializes a buffer where it can store the fragments of the message as they are received. It keeps track of which portions of this buffer have been filled with received fragments, perhaps using a special table. By doing this, it knows when the buffer is partially filled with received fragments and when it is completely full.

  10. IP Message Reassembly Process (3) • Timer Initialization • The receiving device sets up a timer for reassembly of the message. Since it is possible that some fragments may never show up, this timer ensures that the device will not wait “forever” trying to reassemble the message • Fragment Receipt and Processing • Whenever a fragment of this message arrives (as indicated by it having the same source and destination addresses, protocol and Identification as the first fragment), the fragment is processed. It is inserted into the message buffer in the location indicated by its Fragment Offset field. The device also makes note of the fact that this portion of the message has been received.

  11. UDP Operation • What UDP Does • Higher-Layer Data Transfer • UDP Message Encapsulation • Transfer Message To IP • What UDP Does Not • UDP does not establish connections before sending data. It just packages it and… off it goes. • UDP does not provide acknowledgments to show that data was received. • UDP does not provide any guarantees that its messages will arrive. • UDP does not detect lost messages and retransmit them. • UDP does not ensure that data is received in the same order that they were sent. • UDP does not provide any mechanism to manage the flow of data between devices, or handle congestion

  12. TCP Characteristics • Connection-Oriented • Bidrectional • Multiply-Connected and Endpoint-Identified • Reliable • Acknowledged • Stream-Oriented • Data-Unstructured • Data-Flow-Managed

  13. TCP Data Handling and Processing • Streams • Increasing the Flexibility of Application Data Handling • Segments • TCP Data Packaging • Sequence Numbers • TCP Data Identification • The Need For Application Data Delimiting • Since applications send data to TCP as a stream of bytes and not prepackaged messages, each application must use its own scheme to determine where one application data element ends and the next begins.

  14. 相關軟體 • dsniff網路監控竊聽 • 在使用dsniff之前需要安裝下列的工具程式 • WinPCap(為執行檔直接安裝,最好安裝4.0版) • 封包擷取程式庫 • http://www.winpcap.org/archive/ • Libnids • IP拆解與TCP封包片段重組的函式庫 • 解壓縮後放在 C:\libnids-1.16 裡面 • http://www.datanerds.net/~mike/libnids.html • Berkeley DB(直接安裝) • 資料庫軟體,dSniff配它產生作用 • http://www.oracle.com/database/berkeley-db/db/index.html • dSniff(檔案為tgz格式,解壓縮四個exe檔案 放在 c:\dsniff 底下) • http://www.datanerds.net/~mike/dsniff.html

  15. dSniff四項工具簡介及使用 • dsniff.exe: • 執行 => cmd • 輸入cd c:\dsniff • 輸入dsniff.exe • 即可馬上捕捉封包訊息,大家最感興趣的部分,如密碼。 • 若出現[Error opening adapter]代表網卡不被支援,請換另一張網卡能捕捉到底下多種格式: • FTP, Telnet, HTTP, POP, NNTP, IMAP, SNMP, LDAP, Rlogin, NFS, SOCKS, X11, IRC, AIM, CVS, ICQ, Napster, Citrix ICA等 • 若想把抓的訊息儲存起來,執行 [dsniff >> message.txt] 即可 • mailsnarf.exe 抓取信件內容: • mailsnarf.exe • 輸入mailsnarf >> getmail.txt • 修改getmail.txt成getmail.eml即可收看 • urlsnarf 監聽網址: • 輸入urlsnarf.exe • 輸入urlsnarf >> getweb.txt • webspy 直接秀出別人觀看的網站: • 輸入webspy IP (要聽監的IP,會show出被監聽人正在觀看的網頁)

  16. IPv6

  17. IP 的演進 • 1981年9月,RFC791制定了Version 4 (IPv4)的版本,從誕生迄今大約經過了20年的時間。在這段期間電腦的技術有很大的進步,出現了各式各樣在當初設計IPv4時所未被設想到的使用型態。網路的急速普及化,也使得現在的網路規模遠超過設計當初的預期。 • 未被設想到的使用型態-可移動的節點 • 網路的急速普及化-網路規模遠超過設計當初的預期 • 1990年代前期,IETF開始檢討以下的3個問題 • 今後網路發展的預測及仰賴IPv4所能維持的極限 • IPv4的延續策略 • 設計新的IP及策定轉移計畫

  18. IPv4的極限 • IP位址數的不足 • 類別基礎的IP位址分配方法,對單位所分配的IP位址以8位元為單位,真正單位所需要的IP位址數跟實際上所分配到的IP位址數會有所差距 • 路由表太大 • 接續上的網路數量增加的話路由表也會跟著變大 • 解決的方法 • CIDR • NAT • IPv6

  19. 朝向IPv6 • IPv4的各式延續策略,讓 IP 的短缺暫時脫離了窘境,然而,這些方法終究會到達極限。 • 新一代的IP協定的考量 • 相符於 IPv4 於目前協定堆疊中的流程 • 基本的動作相同 • 更單純化的Protocol • 解決至目前為止的問題點 • 位址空間的不足 • Multicast、Mobile • 更容易運用 • Plug and Play • Security • 可以因應後續長時間的發展 • 容易擴充新功能 • 容易自IPv4轉移

  20. IPv6 的發展 • 最初被稱為下一代IP(IPng: IP The Next Generation)的協定 • CATNIP、TUBA與SIPP三種協定,是最被任認可的版本 • IETF最後決定採用SIPP  • 1995年SIPP被更名為IPv6 • IPv5? • Internet的版本序號是由IANA管理 • 第五版被RFC1190(Experimental Internet Stream Protocol, Version 2(ST-Ⅱ))歸為實驗型行的Protocol • 新的IP 版本就成了第六版  • 版本序號:7、8、9及15都已被預約了,沒被預約的只有10~14。因此當下一次再有IP的下一版本要提出時,應該是用第十版了

  21. IPv6的特徵 (1) • 可擴充新的通信協定 • 提供新的定址方式,位址空間的擴充 • Why 128-bit? • 考慮到IP 標頭處理所造成的浪費。

  22. IPv6 特徵 (2) • 標頭的簡化 • 刪除了許多IPv4的欄位 • 標頭長度 • 識別子(Identifier) • 分段位移(Fragmentation Offset) • 檢查碼(Checksum) • 服務類別(Type of Service) • 減輕網路中路由器的負擔 • IPv6的基本標頭從可變長度變更成固定長度 • 取消路由器對封包的分割處理 • 刪除Checksum 機制 • 可擴充協定標準 • IPv4使用Option 欄位,但只限於這一個標頭 • IPv6除基本標頭外,可再加上一或多個延伸標頭來形成 • IPv6 Basic 標頭 + Extension 標頭(s) + Data

  23. IETF 公開的標準 • 首先提案:1995年12月 • RFC1883(Internet Protocol, Version6(IPv6) Specification) • 目前的標準規範:1998年12月 • RFC2460(Internet Protocol, Version6(IPv6) Specification) • 位址的分配方式: 2003 年4月 • RFC3513(Internet Protocol Version 6 (IPv6) Addressing Architecture)

  24. Dual Stack Transition Mechanisms Tunneling Translator IPv6/IPv4 轉換技術 • IPv4/IPv6 雙重架構機制(Dual Stack) • 通道機制(Tunnel) • 位址協定轉換機制(Translator) • NGtrans 規劃之轉換機制

  25. Phase I Phase II Phase III Phase IV IPv4 Only IPv4 Ocean IPv4 Island IPv6 Only Experimental IPv6 Network IPv6 Ocean IPv6 Island IPv6/IPv4轉換進程

  26. IPv4 client IPv6 client IPv6 server IPv4-mapped IPv6 address TCP TCP TCP IPv4 IPv6 IPv4 IPv6 Datalink Datalink Datalink IPv4/IPv6雙重架構機制

  27. 簡易雙重架構機制+Tunneling 6over4 • RFC 1933 • RFC 3056 • RFC 3053 IPv4 IPv6 IPv6 6to4 IPv4 IPv6 IPv6 Tunnel Broker IPv4/ IPv6 IPv6

  28. IPv6 IPv4 ? (DHCPv6, DNS) Dual Stack IPv4 only IPv6 only DSTM雙重架構機制 • DSTM雙重架構機制係確保IPv4之應用能於IPv6網路上運作

  29. DSTM雙重架構機制 • 一IPv6 node與一IPv4 node互通時,其先取得一暫用之IPv4位址(DSTM伺服器提供) • 此暫用之IPv4位址係由DNS及DHCPv6協調產生 • 傳送時藉由動態通道技術包裝IPv4封包

  30. DSTM Server Mechanisms and Extensions IPv6 Services IPv6 Network IPv6 Network IPv6 Router SIIT-MIPv6-WLAN-3G Router/Gateway IPv6 Hosts IPv4 Network IPv4 Services IPv4 Router End-2-End Communications DSTM雙重架構機制 3G and WLAN Network

  31. IPv4 packet IPv6 packet IPv6 packet IPv6 packet IPv6 site IPv6 site IPv4 Internet 通道機制

  32. IPv6 HOST IPv4 HOST IPv6 Packet IPv4 Packet Translator 位址協定轉換機制

  33. 無縫IP/ICMP轉換演算法SIIT 演算法

  34. SIIT演算法 IPv4 network Dual network SIIT IPv6 host IPv4 host Using SIIT for an IPv6-only or dual cloud which contains some IPv6-only hosts as well as IPv4 hosts Pool of IPv4 addresses

  35. TCP-UDP中繼機制(TCP-UDP Relay)

  36. TCP-UDP中繼機制運作

  37. BIS機制

  38. BIS機制協定模組

  39. IPv6 與 3G 整合技術 • All-IP與行動通訊 • 由於電信自由化,網際網路的蓬勃發展,資訊與通訊技術的快速進步,通訊網路正在面臨一個巨大的變革,要將原有 Circuit Switching 與 Packet Switching 網路整合成一個單一的全IP 網路。將以一個單一傳輸平台提供固定網路及行動網路上所有服務,包括語音、多媒體、資料等各類服務。 • 電信自由化的浪潮,刺激網路大量建設、新技術的加速引進、與新服務的提供。長途頻寬的供應大幅增加,價格降低。網際網路在全球蓬勃發展,間接使得IP技術變成全球網路的共同標準。 • Network Convergency,企圖將Circuit Switching 與 Packet Switching 分離的傳統網路整合成單一的Packet Switching 網路。為了打破以往各製造商設備不能完全互通的問題,這個整合型網路將採用全球統一開放標準,而IP 通訊協定正因為網際網路在全球蓬勃發展而成為唯一的選擇。 • 傳統的網路服務架構中,舉例而言,當我們用傳統的電話撥接上網,進入某家公司的網頁,若要用網頁上所提供的聯絡電話與該公司聯絡時,必須將電話掛斷,或使用另一部電話,而不能直接在網頁上所顯示的電話號碼直接點下去就由同一個電話線自動接通到該電話,當整合型All-IP 網路建置成之後,此類的服務將變為可能。

  40. 傳輸層與控制層分離 • 使用者對於IP多元化服務的需求與日遽增,IP行動通訊網路架構將會成為未來的主流。電信業者既有的網路架構無法立即轉換成為IP網路,最可行的方法是在不影響目前的網路服務品質前提下,逐步演進至 IP網路。 • 語音與數據的應用整合是未來的趨勢,使用以 IP為主的整合式語音與數據網路,可以極大的彈性來提供服務,並降低網路維運成本。 • 早期封包語音的解決方案是以網路語音 ( VoIP ) 的界面卡或遠端存取平台 ( Remote Access Platform ) 來達成。然而這些方案要不是欠缺電信級的能力,就是缺乏通訊系統 ( Signaling System)的能力,因而未能充分利用PSTN通訊與控制的功能。 • 傳統電路交換網路對於交換、呼叫控制與通訊( Call Control and Signaling ) 以及路由 ( Routing) 之功能,在實現上均為明顯分隔,因此增加網路之複雜度與缺乏彈性。 • 在未來的網路,以IP作為對於上層的網路應用及下層的網路接取技術共同平台,將傳輸層與控制層分開,可降低網路的複雜度及更易導入新的傳輸技術。

  41. IP多媒體服務應用 • H.323是目前最普遍用於 VoIP (Voice Over IP)的標準,由ITU-T於1996年提出,原本是以區域網路(LAN)為基礎做視訊會議的應用,後來被應用於網路電話。 • H.323定義了一個綜合性的規範,使網路上的終端設備遵循這些規範,得以順利進行溝通,包括語音壓縮格式(G.711、G.729、G.723.1)、影像壓縮格式(H.261、H.263)、呼叫通訊(H.225)、控制通訊(H.245)、註冊與認證等(Registeration、 Admission、Status, RAS)。 • VoIP 的應用而言,H.323的子協定相當多, 複雜性高,因於在許多技術上的問題受限,無法完全符合應用。因此,IETF(Internet Engineering Task Force)在1999年3月提出 SIP (Session Initiation Protocol) 新架構 ,試圖簡化 H.323 的複雜性,且在語音傳遞功能提供較高的延展性。

  42. 為何在3G使用IPv6運用 • 為何使用3G? • 容量 • 語音服務仍然是主要的流量 • 服務與軟體 • 行動網路 • EMS/MMS/MIM • 網路服務/3G應用軟體 • VoIP over 3G • IP原本主要是為了在乙太網路下傳遞資料封包所設計的,而在3GPP網路中,IP有兩個主要用途: • 「User-level IP」是用來描述在行動終端(Mobile Terminals)及應用伺服器(Application Hosts)之間的終端對終端通訊 • 「Transport-Level IP」是用來描述在3GPP網路中IP結點的連結

  43. 在3G中的IPv6定址

  44. 在3G中的IPv6定址

  45. B3G異質多接取網路整合系統架構概念圖

  46. QoS in IPv6 • IPv6協定的QoS介紹 • IPv6在設計上,提供了足夠的彈性以支援上述的多種QoS機制。IPv6並不需要加入任何特殊的機制,只需要要下列元件做變更 • IPv6基本標頭 • IPv6延伸標頭 • 優先等級 • 1996年的IPv6原始提案 • 基本標頭中有一個4位元的優先權(Priority)欄位 • 以需不需要回應擁塞被分成兩個範圍: • 0-7 是給固定的優先權。 • 8-15則是給即時訊務丟棄封包的優先權。 • 就是「頻寬浪費」與「可增加的擁塞」而言,開放回路傳輸(open loop transmission)並非最好的模式。 • IPv6標頭被重新設計成包含8個位元的等級(Class)欄位

  47. QoS Issues • QoS仍然是一個研究與爭論的題目,而且相對應的服務與通訊協定的部署也非常的複雜 • IPv6與IPv4的共存問題 • Issues • QoS的機制必須在通道與IPsec環境中正常運行 • 對Mobile IP網路提供QoS仍然是研究中的一項主題 • 某些具備了複雜的Multicast機制的QoS服務將與沒有支援QoS的Internet在互相不妨礙運作的狀況下,還必須要維持Internet之multicast的全面互通性 • QoS的複雜度高,要以小心的設計、標準化、實作以及建置來達到一個平衡點

  48. Security Issues in IPv4 (1) • TCP協定之缺陷 • 序號欺騙 (Sequence Number Spoofing) • TCP SYN Flood 攻擊 • 連接建立時的同步破壞 • 連接中的連接失效 • UDP Flood DoS攻擊 • UDP Flood DoS攻擊 • 透過UDP protocol送出假造來源的UDP Broadcast封包至目標網路,以產生放大的資料流,目標埠號(port)通常為7(Echo,回應服務) • 當目的網域中的眾多主機回應之後,便可造成網路的壅塞 • 即使某些IP位址沒有回應,但產生的ICMP封包(Type Destination Unreachable)仍可達到DoS攻擊的效果

More Related