1 / 24

組態伺服器

組態伺服器. RARP 、 BOOTP 、 DHCP. 大綱. RARP BOOTP DHCP. DHCP: Dynamic Host Configuration Protocol. Goal: allow host to dynamically obtain its IP address from network server when it joins network Can renew its lease on address in use

kamuzu
Download Presentation

組態伺服器

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. 組態伺服器 RARP、BOOTP、DHCP

  2. 大綱 • RARP • BOOTP • DHCP

  3. DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from network server when it joins network Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an “on” Support for mobile users who want to join network (more shortly) DHCP overview: • host broadcasts “DHCP discover” msg • DHCP server responds with “DHCP offer” msg • host requests IP address: “DHCP request” msg • DHCP server sends address: “DHCP ack” msg

  4. E B A DHCP client-server scenario 223.1.2.1 DHCP 223.1.1.1 server 223.1.1.2 223.1.2.9 223.1.1.4 223.1.2.2 arriving DHCP client needs address in this network 223.1.1.3 223.1.3.27 223.1.3.2 223.1.3.1

  5. DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP client-server scenario arriving client DHCP server: 223.1.2.5 DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs time DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs

  6. MAC header RARP packet RARP • 位址逆解協定(Reverse Address Resolution Protocol,RARP) • RFC 903 • 將 Ethernet 的 MAC 位址轉換成 IP 位址 • 用來設定 Host 的 IP 位址 • 網路存取層的協定: 指認 RARP Frames • 在 Frame 表頭指定為RARP 訊息型態- 0835

  7. RARP 運作方式 • 不知道自己 IP 位址的 Client ,利用硬體的廣播能力送出詢問給所有 Hosts。 • RARP Server 會用詢問封包中的 Ethernet 位址,到 /etc/ethers 查詢其主機名稱 。 • RARP Server 利用主機名稱向 DNS Server 詢問其 IP 位址。 • 將 IP 位址封裝於 RARP 回應封包中,傳回給此 Ethernet 位址的 Client。

  8. FreeBSD 查詢 Ethernet 位址的方式 # ifconfig -a fxp0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST>mtu1500 inet 140.126.155.48 netmask 0xffffff00 broadcast 140.126.155.255 ether 00:e0:18:c2:ce:92 media: autoselect (10baseT/UTP) status: active supported media: autoselect 100baseTX <full-duplex> 100baseTX 10baseT/UP lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500 tun0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500 sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552 ppp0: flags=8010<POINTOPOINT,MULTICAST> mtu 1500 lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 inet 127.0.0.1 netmask 0xff000000

  9. MAC header IP header UDP header BOOTP message BOOTP • Bootstrap Protocol • RFC 951、RFC 1048、RFC1532、RFC 2132 • 提供充足的 TCP/IP 組態給查詢的 Client • BOOTP預留 64 bytes 給廠商做為擴充的空間 • 衍變為 DHCP(Dynamic Host Configuration Protocol) • 使用 UDP 傳輸協定 • Static database (i.e., predefined IP v.s. MAC address.)

  10. BOOTP 運作方式(1) • 要利用 BOOTP 取得組態的 Client 以 255.255.255.255 有限廣播位址,廣播一個 BOOTREQUEST 的封包。 • BOOTP Client 設定為 Port 68。 • Source IP=0.0.0.0。 • BOOTP Server 設定為 Port 67。 • BOOTP Server 會將資料存放在 BOOTREPLY 封包廣播給所有 Hosts 的Port 68,IP=255.255.255.255。

  11. BOOTP 運作方式(2) • 查詢的 Client 收到 BOOTREPLAY,檢查BOOTREPLAY內部資料中硬體位址是否相同,以判斷是否是自己的封包。 • 若一段時間仍未收到回覆,Client 會再送出一次 BOOTREQUEST 。

  12. BOOTP Information • 在 BOOTP 中可取得的資訊:IP address, gateway IP, Boot file name、(以下為 option)subnet mask、DNS name、Time of the day 等。 • BOOTP 不可能在 Booting 時送太多資訊給 Client。因此,Server 通知 Client 所需資料的 Path,Client 再以 TFTP 取得相關訊息。

  13. 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Opcode Hardware type Hardware address length Hop count Transaction ID Number of seconds Unused(BOOTP) Flags(DHCP) Client IP address Your IP address Server IP address Gateway IP address Client hardware address Server host name Boot filename Vender-specific area(BOOTP) Options(DHCP) BOOTP and DHCP Header

  14. Options Magic cookies: 99,130,83,99 (TLV encoding) Code Value Length 1 Subnet Mask 4 13 BOOT file size 2 • END 0 15 Domain name 53 DHCP message type

  15. MAC header IP header UDP header DHCP header Data DHCP • 動態主機組態協定(Dynamic Host Configuration Protocol,DHCP) • RFC 2131、RFC 2132 • 設定的目標是要相容於 BOOTP。 • DHCP 使用與 BOOTP 相同的封包格式與埠號。 • BOOTPREQUEST 和 BOOTPREPLY • Server:UDP 67 • Client:UDP 68

  16. DHCP 的特性 • DHCP 支援 BOOTP 或任何的用戶端。 • DHCP 擴充 BOOTP 的 vendor extension 成 312 bytes,以包含全套 RFC “Requests for Internet Hosts” 中的 TCP/IP 組態參數。 • DHCP 可以用人工、自動、動態配置 IP address。

  17. DHCP 三種配置 IP 位址的方式 • 人工配置 • 管理者手動指定永久 IP address。 • 自動配置 • DHCP Server 指定永久 IP address。 • 動態配置 • DHCP Server 指定暫時 IP address,租期到Client 必須要求延展租期,否則 DHCP Server 會收回此 IP address。

  18. 使用 DHCP 的策略 • 管理者人工配置:適用於 Mail Server、FTP Server ... 等無休且須透過名稱存取的共享式系統。 • 人工配置或自動配置:適用於不知道有租期的 BOOTP Client。 • 動態配置:適用於經常有 Hosts 加入或刪除的機動性網路。

  19. DHCP Operations Client Server DHCP DISCOVER Server 收到 DISCOVER,會提供 IP、Lease Period。Client 若沒收到則會 Retry。 DHCP OFFER Client 選擇一份 DHCP OFFER,提出 REQUEST。Server 收到 DHCP ACK,才會真正 Bind IP和 MAC,Client 開始使用此 IP。 DHCP REQUEST set timer DHCP ACK 50% of the lease period DHCP REQUEST Client 提出 renewal。Server 若同意展期,送 DHCP ACK;若不同意,則送回 DHCP NACK。Client 重新開始。 DHCP ACK DHCP RELEAESE Client 提出終止 IP 的使用。

  20. DHCP Messages Type field DHCP Message Type 1 DHCPDISCOVER 2 DHCPOFFER 3 DHCPREQUEST 4 DHCPDECLINE 5 DHCPACK 6 DHCPNACK 7 DHCPRELEASE

  21. DHCP 對 DNS 的影響 • IP 位址常改變,未通知 DNS,造成 DNS 對應主機名稱與 IP 位址的錯誤。 • Dynamic DNS • 修改 DNS 軟體讓 DHCP Server 能自動更新 DNS 的對映表 • WINS:Microsoft Windows NT 採用 Dynamic DNS 的技術,發展出 Windows Internet Name Service,簡稱 WINS。

  22. ISC 的 DHCP 軟體 • 網際網路軟體聯盟(Internet Software Consortium,ISC)的 dhcpd • http://www.isc.org/products/DHCP/ 可取得相關訊息 • ftp://ftp.isc.org/isc/dhcp/dhcp-2.0.tar.gz 下載 dhcpd • http://www.isc.org/services/support/ 請求協助

More Related