1 / 16

Lab3-ARP (Address Resolution Protocol)

Lab3-ARP (Address Resolution Protocol). Date:2007.11.02. Address. MAC address or Ethernet address 硬體或介面卡的位址,出廠時唯一,燒錄在介面卡的 ROM 中 以 aa.bb.cc.dd.ee.ff 六個位元組表示 IP address TCP/IP 協定所訂位址,經申請後唯一 以 aaa.bbb.ccc.ddd 四位十進位數值表示. OSI 分層資料交換. Ethernet 框架. Ethernet 標頭. ARP 內容. Ethernet 標尾.

lois
Télécharger la présentation

Lab3-ARP (Address Resolution Protocol)

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. Lab3-ARP(Address Resolution Protocol) Date:2007.11.02

  2. Address • MAC address or Ethernet address • 硬體或介面卡的位址,出廠時唯一,燒錄在介面卡的ROM中 • 以aa.bb.cc.dd.ee.ff六個位元組表示 • IP address • TCP/IP協定所訂位址,經申請後唯一 • 以aaa.bbb.ccc.ddd四位十進位數值表示

  3. OSI分層資料交換

  4. Ethernet框架 Ethernet 標頭 ARP 內容 Ethernet 標尾 Preamable and SFD 目的位址 來源位址 type Data CRC 8 Bytes 6 Bytes 6 Bytes 2 Bytes 46~1500 Bytes 4 Bytes ARP type:0x0806

  5. ARP (Address Resolution Protocol) • 位址解析協定 • RFC-826 • Mapping between IP address and the physical address (MAC address).

  6. MAC與IP位址的轉換 ARP Request 1A-23-F9-CD-06-9B IP:140.125.33.1 Host A 88-B2-2F-54-1A-0F IP:140.125.33.254 5C-66-AB-90-75-B1 IP:140.125.33.2 Host B 49-BD-D2-C7-56-2A IP:140.125.33.3 ARP Reply Host C

  7. MS-DOS and Ethereal • MS-DOS ipconfig /all • MS-DOS arp –a顯示arp table • MS-DOS arp –d清除arp table • Filter:arp && eth.addr == 00:14:85:f9:e6:6e

  8. ARP Packet format • 硬體種類(Hardware type):2個位元組,使用Ethernet時,填入0x0001。 • 協定種類(Protocol type):2個位元組,使用IPv4協定時,填入0x0800。 • 硬體長度(Hardware length):1個位元組,定義實體位址的長度,使用Ethernet時,填入0x06。 • 協定長度(Protocol length):1個位元組,定義邏輯位址的長度,使用IPv4時,填入0x04。 • 運作(Operation):2個位元組,定義封包種類,ARP Request填入0x0001,ARP Replay填入0x0002。 硬體種類 協定種類 硬體長度 協定長度 運作 來源端MAC位址(6個位元組) 來源端IP位址(4個位元組) 目的端MAC位址(6個位元組) 目的端IP位址(4個位元組)

  9. ARP Request (Boradcast) Host A Host C 49-BD-D2-C7-56-2A 1A-23-F9-CD-06-9B IP:140.125.33.3 IP:140.125.33.1 0x0001 0x0800 0x06 0x04 0x0001 0x1A23F9CD069B 0x8C7D2101 0x000000000000 0x8C7D2103 Preamable and SFD 0xFFFFFFFFFFFF 0x1A23F9CD069B 0x0806 Data CRC

  10. ARP Repay(Host C  Host A) Host A Host C 49-BD-D2-C7-56-2A 1A-23-F9-CD-06-9B IP:140.125.33.3 IP:140.125.33.1 0x0001 0x0800 0x06 0x04 0x0002 0x49BDD2C7562A 0x8C7D2103 0x1A23F9CD069B 0x8C7D2101 Preamable and SFD 0x1A23F9CD069B 0x49BDD2C7562A 0x0806 Data CRC

  11. function • Interrupt_Initialize(); • WanInitialize(); • LanInitialize();

  12. function • int SendPacket(U8* Data, int Size, int M_channel) • * Function : SendPacket • * Description : Send ethernet frame function • * Input : frame data pointer, frame length • * Output : transmit ok(Size) or error(0)

  13. function • int mac_get_packet(U8 *buf, int rx_length, int M_channel) • * Function : ReceivePacket • * Description : Receive ethernet frame function • * Input : frame data pointer, frame length • * Output : transmit ok(len) or error(0)

  14. 實習 • 撰寫ARP協定網路程式,送出ARP Request到目的端電腦,當目的端電腦回傳ARP Reply時,將目的端電腦的MAC address顯示出來。 • 基本功能:顯示MAC address。 • 擴充功能:介面愈友善,分數愈高。

  15. 報告內容 • 報告的格式自由發揮,但至少要有底下幾部分: • 題目講解及實作原理 • 程式流程圖 • 部份程式碼及註解說明 • 問題與討論 • 心得感想

More Related