Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 36

DHCP

Dynamic Host
Configuration Protocol

NGUYỄN HỮU TRUNG


CNTT - SPKT
NỘI DUNG
I. Giới thiệu dịch vụ DHCP.
II. Hoạt động của giao thức DHCP.
III. Cài đặt dịch vụ DHCP.
IV. Chứng thực dịch vụ DHCP trong AD
V. Cấu hình dịch vụ DHCP
VI. Cấu hình dành riêng địa chỉ
VII. DHCP Relay Agent

NGUYỄN HỮU TRUNG 2


I. Giới thiệu
Mỗi thiết bị trên mạng có dùng bộ giao thức TCP/IP đều phải có một
địa chỉ IP hợp lệ, phân biệt.
Để hỗ trợ cho vấn đề theo dõi và cấp phát các địa chỉ IP được chính
xác, tổ chức IETF (Internet Engineering Task Force) đã phát triển ra giao
thức DHCP (Dynamic Host Configuration Protocol).
Giao thức này được mô tả trong các RFC 1533, 1534, 1541 và 1542.

NGUYỄN HỮU TRUNG 3


Lịch sử phát triển của DHCP
Giao thức BOOTP(Bootstrap Protocol) lần đầu tiên được định nghĩa trong RFC 951
thay thê cho RARP, lí do là RARP hoạt động ở tầng data link, điều này làm cho việc
thực hiện trên nhiều máy server trở nên khó khăn, và đòi hỏi một server xử lý riêng
trên từng network.
BOOTP có đổi mới relay agent, cho phép forwarding đến gói BOOTP trong mạng cục
bộ=>BOOTP server có thể phục vụ cho nhiều IP subnet.
Bootstrap Protocol - BOOTP là một internet protocol cho phép một workstation khởi
động mà không cần đĩa cứng hay đĩa mềm
Thi hành các công việc sau:
◦ 1 - tìm kiếm địa chỉ IP cho chính nó
◦ 2 - tìm IP của BOOTP server
◦ 3 - nạp một file khởi động từ server vào bộ nhớ
◦ 4 - và khởi động

NGUYỄN HỮU TRUNG 4


Lịch sử phát triển của DHCP
DHCP đầu tiên được định nghĩa trong RFC 1531 vào tháng 10/1993, là phần mở
rộng của BOOTP
Động cơ để cải tiến BOOTP là BOOTP đòi hỏi phải cấu hình thủ công để thêm thông
tin cho từng máy client, và không cung cấp cơ chế tái sử dụng lại địa chỉ IP.

NGUYỄN HỮU TRUNG 5


I. Giới thiệu
DHCP - giao thức cấu hình tự động địa chỉ IP.
◦ Máy tính được cấu hình một cách tự động vì thế sẽ giảm việc can thiệp vào
hệ thống mạng.
◦ Nó cung cấp một database trung tâm để theo dõi tất cả các máy tính trong
hệ thống mạng.
◦ Tránh trường hợp 2 máy tính khác nhau lại có cùngIP
◦ Hoạt động theo mô hình server/client

DHCP còn cung cấp thông tin cấu hình khác: như DNS.
Hiện nay DHCP có 2 version: cho IPv4 và IPv6.

NGUYỄN HỮU TRUNG 6


Mô hình DHCP server/client

NGUYỄN HỮU TRUNG 7


I. Giới thiệu
Ưu điểm:
◦ Khắc phục được tình trạng đụng địa chỉ IP
◦ Giảm chi phí quản trị cho hệ thống mạng.
◦ Giúp cho các nhà cung cấp dịch vụ (ISP) tiết kiệm được số
lượng địa chỉ IP thật (Public IP).
◦ Phù hợp cho các máy tính thường xuyên di chuyển qua lại
giữa các mạng.
◦ Kết hợp với hệ thống mạng không dây (Wireless) cung
cấp các điểm Hotspot như: nhà ga, sân bay, trường học…

NGUYỄN HỮU TRUNG 8


II. Hoạt động của DHCP
Quá trình cấp IP cho Client
Quá trình gia hạn IP
Chứng thực

NGUYỄN HỮU TRUNG 9


Quá trình cấp ip cho client.
-.+
+S MAC
Địa
: 0.0.0.0
Lựa chỉ
của
IPclient.
client
Hoạtchọnđộngoffer
của DHCP
DHCP
DHCP -.+D:255.255.255.255
+ Một
Các IP
thông
cấp cho
tin
Thông tin về DHCP cấu
client
hình
.
Server2
Server2 -.server
khácĐa
Subnet
chỉ
(DNSMAC
cấpmask
server,
địa và
chỉ WINS
-.+Chấp
server,
computer
Thời gianGateway;...
name
thuê
nhận ip(8của
ngày)
được).
client.
+
+Chấp
IP client
nhận
được
chocấpclient
cấp.
thuê ip.
+Kết thúc quá trình xin
DHCP
DHCP
DHCP
DHCP cấp phát DHCPđịa chỉ IP.
DHCP
DHCP
Server1
Server1
Server1 Client
Client

11 DHCPclient
DHCP clientbroadcasts
broadcastsaaDHCPDISCOVER
DHCPDISCOVERpacket
packet

22 DHCPservers
DHCP serversbroadcast
servers broadcast
broadcastaaaDHCPOFFER
broadcast DHCPOFFERpacket
DHCPOFFER packet
packet
33 DHCPclient
DHCP clientbroadcasts
broadcastsaaDHCPREQUEST
DHCPREQUESTpacket
packet

44 DHCPServer1
DHCP Server1broadcasts
broadcastsaaaDHCPACK
broadcasts DHCPACK packet
DHCPACKpacket
DHCPACK packet
packet

NGUYỄN HỮU TRUNG 10


Quá trình gia hạn IP được cấp.
DHCP
DHCP
Server2
Server2

DHCP
DHCP Client
Client
DHCP
DHCP
Server1
Server1

50%
100%
50% of
87.5%
50%
87.5%
50% lease
of
ofoflease
of
of lease
oflease
lease
lease
lease
duration
duration
duration
duration
duration has
has
durationhas
duration has
has
has
has
expired
expired
expired
expired
expired
expired

DHCP Client
client
Client sends
sends
sends aaits
DHCPREQUEST
DHCPREQUEST packet
packet
1the
IfIf the DHCPfails
1 client
client client
fails to renewait’s
to renew DHCPREQUEST
its lease,
lease,after packet
after50%
87.5%
50% of
ofof
the
the
the lease
lease
lease duration
has
duration
has
expired,
has expired, thenthen
expired, the DHCP
then the
the DHCP
leaselease
DHCP generation
lease renewal
renewalprocess
process
processstarts
will
will begin
over again
begin again
again
after
with
after DHCP
22 a87.5%
DHCPof
87.5% Server1
client
the
Server1
of sends
the lease
sends
lease aa DHCPACK
broadcasting
duration
duration ahas packet
DHCPDISCOVER
DHCPACK
has expired
packet
expired

NGUYỄN HỮU TRUNG 11


How a DHCP Server Service Is Authorized
If
DHCP
If DHCP
DHCP
DHCP Server1
Server1
Server1
Server1 finds
checks
checks its
its IP
finds with
with address
IPthe
the on
on the
domain
address
domain the
list,
list, the
controller service
to
the service
controller starts
to obtain
starts
obtain and
aa list
and supports
list of DHCP
authorized
supports
of DHCP
authorized DHCP
DHCP
clients
servers
clients
servers
Domain
Domain DHCP
Controller DHCP Server1
Server1
Controller
Authorized
Active
Active Services DHCP
Directory
Directory requests

DHCP
DHCP Server2
Server2
DHCP
DHCP Client
Client Unauthorized

Does not service DHCP


DHCP
IfDHCP
If DHCP
DHCP Server2
Server2
Server2 checks
does
checks
Server2 doesIPwith
not
with
not the
find
theits
find its IP
IP address
address on
on the
the requests
DHCP
DHCP
domain client
client receives
receives
controller to IP address
address
obtain aa list
list,
list, the
domain
from the service
service
authorized
does
controller to not
does
DHCP
start
obtain
not start
Server1 andof
and
list ofsupport
support DHCP
DHCP
from
clients authorized
authorized
authorized
clients DHCP DHCP
servers
DHCP servers Server1

DHCP
DHCP authorization
authorization isis the
the process
process of
of registering
registering the
the DHCP
DHCP Server
Server service
service in
in the
the Active
Active Directory
Directory domain
domain to
to
support
support DHCP
DHCP clients
clients

NGUYỄN HỮU TRUNG 12


III. Cài đặt DHCP server.
Add/Remove Windows Components.
Windows Components Wizard \ Networking Services\ Detail\ DHCP

NGUYỄN HỮU TRUNG 13


IV. Chứng thực DHCP trong
AD
Nếu DHCP server nằm trong domain (chạy trên Server là member or
Domain Controler) cần phải được chứng thực bằng Active Directory.
(Nếu ko thì không cần Chứng thực)
Tránh các server DHCP khác (không được chứng thực) làm ảnh hưởng
tới mạng.
Thực hiện: Action \ Authorize.
-> Biểu tượng một mũi tên màu xanh hướng lên

NGUYỄN HỮU TRUNG 14


V. Cấu hình DHCP
AA scope
scope is
is aa range
range of
of IP
IP addresses
addresses that
that are
are available
available to
to be
be leased
leased

DHCP
DHCP Server
Server

LAN A LAN B
Scope
Scope AA Scope
Scope BB

Scope
Scope Properties
Properties

Network ID Lease duration Scope name


Subnet mask Network IP address Exclusion range
range

NGUYỄN HỮU TRUNG 15


V. Cấu hình DHCP
Tạo scope: các thông số
◦ Name: tên scope
◦ Range IP: dải IP sẽ cấp
◦ Add Exclusions: loại IP khỏi range
◦ Lease duration: time máy client dùng IP
◦ Router (Default Gateway): của máy client
◦ Domain Name and DNS Server: nt
◦ WINS Server: phân giải các tên NetBIOS thành IP
◦ Active scope

NGUYỄN HỮU TRUNG 16


Cấu hình

Chọn menu Start  Programs  Administrative Tools DHCP.


Trong cửa sổ DHCP, nhấp phải chuột lên biểu tượng Server của bạn và
chọn mục New Scope trong popup menu.

NGUYỄN HỮU TRUNG 17


Scope name

NGUYỄN HỮU TRUNG 18


IP Address Range

NGUYỄN HỮU TRUNG 19


Add Exclusions

NGUYỄN HỮU TRUNG 20


Lease Duration

NGUYỄN HỮU TRUNG 21


Configure DHCP Option

NGUYỄN HỮU TRUNG 22


Default Gateway
địa chỉ IP của default gateway mà các máy DHCP Client sẽ sử
dụng

NGUYỄN HỮU TRUNG 23


Domain Name and DNS
Server
tên domain mà các máy DHCP client sẽ sử dụng, đồng thời
cũng cho biết địa chỉ IP của DNS Server dùng phân giải tên

NGUYỄN HỮU TRUNG 24


Finish

NGUYỄN HỮU TRUNG 25


VI. Cấu hình dành riêng địa
chỉ
AA reservation
reservation isis aa specific
specific IP
IP address,
address, within
within aa scope,
scope, that
that isis permanently
permanently reserved
reserved for
for lease
lease to
to aa specific
specific
What Is a DHCP Reservation?
DHCP client
DHCP client

Workstation
Workstation 11 File
File and
and Print
Print
Server
Server

Subnet
Subnet AA Subnet
Subnet BB

DHCP
DHCP Server
Server
Workstation
Workstation 22

IP
IP Address1:
Address1: Leased
Leased to
to Workstation
Workstation 11
IP
IP Address2:
Address2: Leased
Leased to
to Workstation
Workstation 22
IP
IP Address3:
Address3: Reserved
Reserved for
for File
File and
and Print
Print Server
Server

NGUYỄN HỮU TRUNG 26


VI. Cấu hình dành riêng địa
chỉ
Có thể dành một số địa chỉ IP cố định cho riêng một số máy.
Việc cấu hình này được thực hiện trên từng scope riêng biệt.

Chọn scope\ Reservation, Action\ New Reservation


◦ Name: tên
◦ IP Address: IP gán cho máy client
◦ MAC: Của client

NGUYỄN HỮU TRUNG 27


VI. Cấu hình dành riêng địa
chỉ

NGUYỄN HỮU TRUNG 28


VII. DHCP Relay Agent
What Is a DHCP Relay Agent?
◦ Cho phép forwarding gói tin trong mạng cục bộ, vì vậy
DHCP server có thể phục vụ cho nhiều IP subnet.
How a DHCP Relay Agent Works

NGUYỄN HỮU TRUNG 29


What Is a DHCP Relay
Agent?
AA DHCP
DHCP relay
relay agent
agent is
is aa computer
computer oror router
router that
that listens
listens for
for DHCP/BOOTP
DHCP/BOOTP broadcasts
broadcasts from
from
DHCP
DHCP clients
clients and
and then
then relays
relays those
those messages
messages

DHCP
DHCP Relay
Relay Agent
Agent DHCP
DHCP Server
Server

Unicast

Broadcast Broadcast
Subnet A Subnet B

Routers
Routers
(Non–RFC
(Non–RFC 1542
1542
Compliant)
Compliant)

Client
Client Client
Client Client
Client Client
Client

NGUYỄN HỮU TRUNG 30


How a DHCP Relay Agent Works
DHCP
DHCP
DHCP Relay
DHCP Relay
Relay Agent
Relay Agent
Agent
Agent DHCP
DHCP Server
ServerDHCP
DHCP Server
Server

Client2
Client2
Client2 Router
Router
Router
Router Client3
Client3 Client3
Client3
Client1
Client1
Client1
Client1 Non-RFC 1542
(Non–RFC Compliant
Non-RFC 15421542
(Non–RFC Compliant)
Compliant
1542 Compliant)

11 Client1
Client1 broadcasts
broadcasts aa DHCPDISCOVER
DHCPDISCOVER packet
packet
22 Relay
Relay agent
agent forwards
forwards the
the DHCPDISCOVER
DHCPDISCOVER message
message to
to the
the DHCP
DHCP server
server
33 Server
Server sends
sends aa DHCPOFFER
DHCPOFFER message
message to
to the
the DHCP
DHCP relay
relay agent
agent
44 Relay
Relay agent
agent broadcasts
broadcasts the
the DHCPOFFER
DHCPOFFER packet
packet
55 Client1
Client1 broadcasts
broadcasts aa DHCPREQUEST
DHCPREQUEST packet
packet
66 Relay
Relay agent
agent forwards
forwards the
the DHCPREQUEST
DHCPREQUEST message
message to
to the
the DHCP
DHCP server
server
77 Server
Server sends
sends aa DHCPACK
DHCPACK message
message to
to the
the DHCP
DHCP relay
relay agent
agent
88 Relay
Relay agent
agent broadcasts
broadcasts the
the DHCPACK
DHCPACK packet
packet
NGUYỄN HỮU TRUNG 31
VII. DHCP Relay Agent
Cho phép forwarding gói tin trong mạng cục bộ, vì vậy DHCP server có thể phục vụ cho
nhiều IP subnet.

Ví Dụ:
Có 2 NETID khác nhau, nối với nhau thông qua Router
DHCP client muốn nhận IP động từ DHCP sever thì phải truyền bằng tín hiệu Broadcast,
nhưng Router là 1 thiết bị có chức năng "CHẶN TÍN HIỆU BROADCAST" cho nên DHCP
client ko thể nhận IP từ DHCP được, do đó mới cần đến DHCP relay agent
DHCP client gừi tín hiệu cho DHCP replay agent, DHCPrelay agent gừi tiếp sang cho DHCP
sever, DHCP server nhận được gửi trả lại kết quả cho DHCP relay agent, DHCP relay agent
trả kết quả lại cho DHCP Client
DHCP sever và DHCP replay agent liên lạc với nhau bằng tín hiệu Unicast(1 máy tới 1 máy)
Tóm lại: DHCP RELAY AGENT là điểm 1 trung gian

NGUYỄN HỮU TRUNG 33


Relay agent configurations
Non-Microsoft router

NGUYỄN HỮU TRUNG 34


Relay agent configurations
The Routing and Remote Access service

NGUYỄN HỮU TRUNG 35


Relay agent configurations
The Windows Server 2003 family

NGUYỄN HỮU TRUNG 36


How a DHCP Relay Agent Uses Hop Count
The hop count threshold is the number of routers through which
the packet can be transmitted before it is discarded

DHCP
DHCP Relay
Relay Agent
Agent 22
Hop Count = 2

DHCP
DHCP Relay
Relay Agent
Agent 11

DHCP
DHCP Server
Server

NGUYỄN HỮU TRUNG 37

You might also like