KB0129 2023. 4. 3. 09:54

How to assign an IP address to a host?

1. Manually: hard-coded by system admin in a file

  • Windows: control-panel -> networking -> configuration -> TCP/IP -> properties.
  • UNIX: /etc/rc.config

2. Automatically:

  • DHCP: Dynamic Host Configuration Protocol
    • DHCP is a plug and play protocol: a node can dynamically obtain an IP address when joining the network and release the IP address when leaving the network.
    • Benefits: allow host to dynamically obtain its IP address from network server when it joins network.
      1. Reuse of address
      2. Supports for mobile users who want to join network for a short time.
      3. DHCP has a pool of available IP addresses. It assign the IP address to node, and return it into pool when a node leaves.
      4. Required IP addresses at each moment is less than total number of users.Each subnet has a DHCP-server, so any network has a DHCP server!
      5. DHCP client-server scenario
  •  

DHCP scenario

1. Broadcast: is there a DHCP server out there?

2. I'm a DHCP server! Here's an IP address you can use

3. OK, I wil take that IP address!

4. OK, you've got that IP address!

 

Step 3 and Step 4 are important. 

 

Step 3:

  • Connecting laptop needs its IP address, addr of first-hop router, addr of DNS server: use DHCP.
  • DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in 802.11 WLAN (WiFi).
  • WLAN frame broadcast(dest: FFFFFFFFFFFFFF) on LAN, received at router running DHCP server.
  • WLAN demuxed to IP, demuxed to UDP, demuxed to DHCP.

Step 4:

  • DHCP server formulates DHCP ACK containing client's IP address, IP address of first-hop router for client, name & IP address of DNS server.
  • Encapsulation of DHCP server, frame forwarded to client, demuxing up to DHCP at client.
  • Client now knows its IP address, name and IP address of DNS server, IP address of its first-hop router.

There are 8 DHCP message types:

  1. Discover message (DHCPDiscover).
  2. Offer message (DHCPOffer).
  3. Request message (DHCPRequest).
  4. Decline message (DHCPDecline).
  5. Acknowledgement (DHCPAck).
  6. Negative Acknowledgment message (DHCPNak).
  7. Release message (DHCPRelease).
  8. Informational message (DHCPInform).