Understanding DHCP

노션으로 옮김·2023년 12월 30일
0

DHCP

Dynamic Host Configuration Protocol(DHCP) is used for assigning an IP address dynamically.

Taking a brief look at its communication process, it consists of four types of UDP traffic, which uses port numbers 67 and 68.

DHCP Discover

A client that hopes to be assigned an IP address sends this packet to the DCHP Server. Since a client has no IP address, the source IP is set to 0.0.0.0 and destination IP is set to the broadcast address:

DHCP Offer

Upon receiving DHCP discover packet from a client, a DHCP server sends this packet that contains an IP address as Your client Address to be used by the client:

DHCP Request

A DHCP Request is a notification message indicating that a client will use the IP address received from a DHCP server.

DHCP Ack

It is an acknowledgment message to the DHCP Request.

Network Diagram

DHCP Configuration

At Router0, you just need to configure the network address for DHCP assignment:


Router(config)#int gigabitEthernet 0/0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shut
Router(config-if)#exit
Router(config)#ip dhcp pool LAN1
Router(dhcp-config)#network 192.168.1.0 255.255.255.0
Router(dhcp-config)#exit

You can also configure a default gateway, a DNS server, and so on:


Router(dhcp-config)#default-router 192.168.1.1
Router(dhcp-config)#?
  default-router  Default routers
  dns-server      Set name server
  domain-name     Domain name
  exit            Exit from DHCP pool configuration mode
  network         Network number and mask
  no              Negate a command or set its defaults
  option          Raw DHCP options

Check it out

On PC0, you can see that the Ethernet interface has been automatically configured:

References

#1


0개의 댓글