DHCP(動態(tài)主機配置協(xié)議)是一個局域網(wǎng)的網(wǎng)絡(luò)協(xié)議。指的是由服務(wù)器控制一段lP地址范圍,客戶機登錄服務(wù)器時就可以自動獲得服務(wù)器分配的lP地址和子網(wǎng)掩碼。默認情況下,DHCP作為Windows Server的一個服" />

国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

18143453325 在線咨詢 在線咨詢
18143453325 在線咨詢
所在位置: 首頁 > 營銷資訊 > 建站知識 > DHCP協(xié)議

DHCP協(xié)議

時間:2023-02-22 14:51:01 | 來源:建站知識

時間:2023-02-22 14:51:01 來源:建站知識

DHCP協(xié)議:一、基礎(chǔ)概念

DHCP(動態(tài)主機配置協(xié)議)是一個局域網(wǎng)的網(wǎng)絡(luò)協(xié)議。指的是由服務(wù)器控制一段lP地址范圍,客戶機登錄服務(wù)器時就可以自動獲得服務(wù)器分配的lP地址和子網(wǎng)掩碼。默認情況下,DHCP作為Windows Server的一個服務(wù)組件不會被系統(tǒng)自動安裝,還需要管理員手動安裝并進行必要的配置。

通俗來講就是,通過該協(xié)議給內(nèi)部網(wǎng)絡(luò)自動分配IP地址及一些配置信息(集中分發(fā)和管理IP地址)

它是基于Client/Server(CS)結(jié)構(gòu)的。

二、DHCP Server

自動分配IP地址

1、成為DHCP server的條件:

(1)該設(shè)備必須擁有所要下放地址廣播域內(nèi)的直接接口或網(wǎng)卡

(2)該接口或網(wǎng)卡必須自身已經(jīng)擁有合法IP地址。

2、工作原理

DHCP Server(服務(wù)器)<------------->DHCP Client(客戶端)

<-------------DHCP Discover(廣播發(fā)送)------------(當剛開始客戶端沒有地址時,它就會以廣播的方式發(fā)出DHCP Discover報文,在這個網(wǎng)絡(luò)范圍內(nèi)問誰能夠給我提供地址?)

--------------DHCP Offer(廣播發(fā)送)------------->(所有的DHCP Server都能夠接收到DHCP Client發(fā)送的DHCP Discover報文,所有的DHCP Server都會給出響應,向DHCP Client發(fā)送一個DHCP Offer報文。DHCP Offer報文中“Your(Client) IP Address”字段就是DHCP Server能夠提供給DHCP Client使用的IP地址,且DHCP Server會將自己的IP地址放在“option”字段中以便DHCP Client區(qū)分不同的DHCP Server。DHCP Server在發(fā)出此報文后會存在一個已分配IP地址的紀錄。)

<-------------DHCP Request(廣播發(fā)送)-----------(DHCP Client只能處理其中的一個DHCP Offer報文,一般的原則是DHCP Client處理最先收到的DHCP Offer報文。DHCP Client會發(fā)出一個廣播的DHCP Request報文,在選項字段中會加入選中的DHCP Server的IP地址和需要的IP地址。)

--------------DHCP Ack------------------------->(DHCP Server收到DHCP Request報文后,判斷選項字段中的IP地址是否與自己的地址相同。如果不相同,DHCP Server不做任何處理只清除相應IP地址分配記錄;如果相同,DHCP Server就會向DHCP Client響應一個DHCP ACK報文,并在選項字段中增加IP地址的使用租期信息。)

總結(jié):

1. Discovery DHCP 發(fā)現(xiàn)包

2. Offer DHCP 提供包

3. Request DHCP 請求包

4. Ack DHCP 確認包

三、DHCP配置

在配置之前首先得明確一點,就是PC上網(wǎng)必備條件:

1、IP地址

2、網(wǎng)絡(luò)掩碼

3、網(wǎng)關(guān):是一個網(wǎng)絡(luò)范圍內(nèi)的一個接口的IP地址。

4、DNS:域名系統(tǒng)(服務(wù))協(xié)議(DNS)是一種分布式網(wǎng)絡(luò)目錄,主要用于域名與 IP 地址的相互轉(zhuǎn)換,以及控制因特網(wǎng)的電子郵件的發(fā)送。

R1(config)#ip dhcp pool ccna //給設(shè)備創(chuàng)建一個DHCP服務(wù)器的地址池,CCNA為name。

R1(dhcp-config)#network 10.1.1.0 255.255.255.0 //告訴該pool我發(fā)的是10.1.1.0/24整個網(wǎng)絡(luò)范圍的地址。

R1(dhcp-config)#default-router 10.1.1.1 //配網(wǎng)關(guān)

R1(dhcp-config)#dns-server 8.8.8.8 //配DNS服務(wù)

詳細操作:

R2#config terminal

Enter configuration commands, one per line. End with CNTL/Z.

R2(config)#hostname serve

serve(config)#end

serve#

*Feb 1 22:13:48.599: %SYS-5-CONFIG_I: Configured from console by console

serve#show ip interface brief

Interface IP-Address OK? Method Status Protocol

FastEthernet0/0 unassigned YES unset administratively down down

FastEthernet0/1 unassigned YES unset administratively down down

SSLVPN-VIF0 unassigned NO unset up up

serve#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

serve(config)#interface fastEthernet 0/0

serve(config-if)#no shutdown

serve#show ip interface brief

Interface IP-Address OK? Method Status Protocol

FastEthernet0/0 unassigned YES unset up up

FastEthernet0/1 unassigned YES unset administratively down down

SSLVPN-VIF0 unassigned NO unset up up

serve#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

serve(config)#interface fastEthernet 0/0

serve(config-if)#ip address 10.1.1.1 255.255.255.0

serve(config-if)#end

serve#

*Feb 1 22:21:22.879: %SYS-5-CONFIG_I: Configured from console by console

serve#show ip interface brief

Interface IP-Address OK? Method Status Protocol

FastEthernet0/0 10.1.1.1 YES manual up up

FastEthernet0/1 unassigned YES unset administratively down down

SSLVPN-VIF0 unassigned NO unset up up

serve#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

serve(config)#ip dhcp pool ?

WORD Pool name

serve(config)#ip dhcp pool ccna

serve(dhcp-config)#network 10.1.1.0 255.255.255.0

serve(dhcp-config)#dns-server 114.114.114.114

serve(dhcp-config)#default-router 10.1.1.1

serve(dhcp-config)#end

serve#show running-config

Building configuration...

Current configuration : 1171 bytes

!

upgrade fpd auto

version 12.4

service timestamps debug datetime msec

service timestamps log datetime msec

no service password-encryption

!

hostname serve

!

boot-start-marker

boot-end-marker

!

logging message-counter syslog

!

no aaa new-model

ip source-route

no ip icmp rate-limit unreachable

ip cef

!

!

!

ip dhcp pool ccna

network 10.1.1.0 255.255.255.0

dns-server 114.114.114.114

default-router 10.1.1.1

!

!

no ip domain lookup

no ipv6 cef

!

multilink bundle-name authenticated

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

!

memory-size iomem 0

archive

log config

hidekeys

!

!

!

!

!

ip tcp synwait-time 5

ip ssh version 1

!

!

!

!

interface FastEthernet0/0

ip address 10.1.1.1 255.255.255.0

duplex auto

speed auto

!

interface FastEthernet0/1

no ip address

shutdown

duplex auto

speed auto

!

ip forward-protocol nd

no ip http server

no ip http secure-server

!

!

!

no cdp log mismatch duplex

!

!

!

!

!

!

control-plane

!

!

!

mgcp fax t38 ecm

!

--More--

R1#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

R1(config)#hostname PC

PC(config)#interface fastEthernet 0/0

PC(config-if)#no shutdown

PC(config-if)#

*Feb 1 22:42:59.947: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up

*Feb 1 22:43:00.947: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up

PC(config-if)#ip address dhcp

PC(config-if)#

*Feb 1 23:49:06.499: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 10.1.1.2, mask 255.255.255.0, hostname PC

PC#show ip interface brief

Interface IP-Address OK? Method Status Protocol

FastEthernet0/0 10.1.1.2 YES DHCP up up

FastEthernet0/1 unassigned YES unset administratively down down

SSLVPN-VIF0 unassigned NO unset up up

PC#

關(guān)鍵詞:協(xié)議

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關(guān)閉