1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > dhcp动态获取ip 详细实验流程

dhcp动态获取ip 详细实验流程

时间:2021-07-09 00:56:25

相关推荐

dhcp动态获取ip 详细实验流程

简介

DHCP(动态主机配置协议)是一个局域网的网络协议。指的是由服务器控制一段IP地址范围,客户机登录服务器时就可以自动获得服务器分配的IP地址和子网掩码。默认情况下,DHCP作为Windows Server的一个服务组件不会被系统自动安装,还需要管理员手动安装并进行必要的配置。

DHCP原理

DHCP协议采用UDP作为传输协议,主机发送请求消息到DHCP服务器的67号端口,DHCP服务器回应应答消息给主机的68号端口

1、DHCP Client以广播的方式发出DHCP Discover报文。

2、所有的DHCP Server都能够接收到DHCP Client发送的DHCP Discover报文,所有的DHCP Server都会给出响应,向DHCP Client发送一个DHCP Offer报文。 DHCP Offer报文中“Your(Client) IP Address”字段就是DHCP Server能够提供给DHCP Client使用的IP地址,且DHCP Server会将自己的IP地址放在“option”字段中以便DHCP Client区分不同的DHCP Server。DHCP Server在发出此报文后会存在一个已分配IP地址的纪录。

3、DHCP Client只能处理其中的一个DHCP Offer报文,一般的原则是DHCP Client处理最先收到的DHCP Offer报文. DHCP Client会发出一个广播的DHCP Request报文,在选项字段中会加入选中的DHCP Server的IP地址和需要的IP地址。

4、DHCP Server收到DHCP Request报文后,判断选项字段中的IP地址是否与自己的地址相同。如果不相同,DHCP Server不做任何处理只清除相应IP地址分配记录;如果相同,DHCP Server就会向DHCP Client响应一个DHCP ACK报文,并在选项字段中增加IP地址的使用租期信息。

5、DHCP Client接收到DHCP ACK报文后,检查DHCP Server分配的IP地址是否能够使用。如果可以使用,则DHCP Client成功获得IP地址并根据IP地址使用租期自动启动续延过程;如果DHCP Client发现分配的IP地址已经被使用,则DHCP Client向DHCPServer发出DHCP Decline报文,通知DHCP Server禁用这个IP地址,然后DHCP Client开始新的地址申请过程。

6、DHCP Client在成功获取IP地址后,随时可以通过发送DHCP Release报文释放自己的IP地址,DHCP Server收到DHCP Release报文后,会回收相应的IP地址并重新分配。 在使用租期超过50%时刻处,DHCP Client会以单播形式向DHCP Server发送DHCPRequest报文来续租IP地址。如果DHCP Client成功收到DHCP Server发送的DHCP ACK报文,则按相应时间延长IP地址租期;如果没有收到DHCP Server发送的DHCP ACK报文,则DHCP Client继续使用这个IP地址 .在使用租期超过87.5%时刻处,DHCP Client会以广播形式向DHCP Server发送DHCPRequest报文来续租IP地址。如果DHCP Client成功收到DHCP Server发送的DHCP ACK报文,则按相应时间延长IP地址租期;如果没有收到DHCP Server发送的DHCP ACK报文,则DHCP Client继续使用这个IP地址,直到IP地址使用租期到期时,DHCP Client才会向DHCP Server发送DHCP Release报文来释放这个IP地址,并开始新的IP地址申请过程。 需要说明的是:DHCP客户端可以接收到多个DHCP服务器的DHCPOFFER数据包,然后可能接受任何一个DHCPOFFER数据包,但客户端通常只接受收到的第一个DHCPOFFER数据包。另外,DHCP服务器DHCPOFFER中指定的地址不一定为最终分配的地址,通常情况下,DHCP服务器会保留该地址直到客户端发出正式请求。 正式请求DHCP服务器分配地址DHCPREQUEST采用广播包,是为了让其它所有发送DHCPOFFER数据包的DHCP服务器也能够接收到该数据包,然后释放已经OFFER(预分配)给客户端的IP地址。

**

实验过程

**

LSW1配置

The device is running!

huawei>u t m /关闭终端监视器

Info: Current terminal monitor is off.

huewei>sys

Enter system view, return user view with Ctrl+Z.

[Huawei]sysn

[Huawei]sysname

[Huawei]sysname sw

[Huawei]sysname sw1

[sw1]v b 10 20

Info: This operation may take a few seconds. Please wait for a moment…done.

[sw1]int e0/0/1

[sw1-Ethernet0/0/1]p l a /接口类型为access

[sw1-Ethernet0/0/1]p d v 10

[sw1-Ethernet0/0/1]un sh

Info: Interface Ethernet0/0/1 is not shutdown.

[sw1-Ethernet0/0/1]int e0/0/2

[sw1-Ethernet0/0/2]p l a

[sw1-Ethernet0/0/2]p d v 20

[sw1-Ethernet0/0/2]un sh

Info: Interface Ethernet0/0/2 is not shutdown.

[sw1-Ethernet0/0/2]q

[sw1]int e0/0/3

[sw1-Ethernet0/0/3]p l a

[sw1-Ethernet0/0/3]p d v 10

[sw1-Ethernet0/0/3]un sh

Info: Interface Ethernet0/0/3 is not shutdown.

[sw1-Ethernet0/0/3]int e0/0/4

[sw1-Ethernet0/0/4]p l a

[sw1-Ethernet0/0/4]p d v 20

[sw1-Ethernet0/0/4]un sh

Info: Interface Ethernet0/0/4 is not shutdown.

[sw1-Ethernet0/0/4]q

[sw1]q

p l t

^

Error:Ambiguous command found at ‘^’ position.

sys

Enter system view, return user view with Ctrl+Z.

[sw1]int g0/0/1

[sw1-GigabitEthernet0/0/1]p l t /接口类型为trunk

[sw1-GigabitEthernet0/0/1]p t a v 10 20

[sw1-GigabitEthernet0/0/1]un sh

Info: Interface GigabitEthernet0/0/1 is not shutdown.

[sw1-GigabitEthernet0/0/1] User interface con0 is available

Please Press ENTER.

sa

save

The current configuration will be written to the device.

Are you sure to continue?[Y/N]y

Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:

Jun 24 11:54:09-08:00 sw1 %%01CFM/4/SAVE(l)[0]:The user chose Y when decidi

ng whether to save the configuration to the device.

Now saving the current configuration to the slot 0.

Save the configuration successfully.

AR1配置

The device is running!

u t m

Info: Current terminal monitor is off.

sys

Enter system view, return user view with Ctrl+Z.

[Huawei]sysn

[Huawei]sysname AR1

[AR1]int g0/0/0

[AR1-GigabitEthernet0/0/0]ip add 12.0.0.1 24

[AR1-GigabitEthernet0/0/0]un sh

Info: Interface GigabitEthernet0/0/0 is not shutdown.

[AR1-GigabitEthernet0/0/0]q

[AR1]int g0/0/1.10

[AR1-GigabitEthernet0/0/1.10]q

[AR1]dhcp e

[AR1]dhcp enable /启动dhcp

Info: The operation may take a few seconds. Please wait for a moment.done.

[AR1]int g0/0/1.10

[AR1-GigabitEthernet0/0/1.10]dhcp t

[AR1-GigabitEthernet0/0/1.10]dhcp te

[AR1-GigabitEthernet0/0/1.10]dhcp d

[AR1-GigabitEthernet0/0/1.10]dhcp do

[AR1-GigabitEthernet0/0/1.10]ddo

[AR1-GigabitEthernet0/0/1.10]do

[AR1-GigabitEthernet0/0/1.10]dot1q t

[AR1-GigabitEthernet0/0/1.10]dot1q termination v

[AR1-GigabitEthernet0/0/1.10]dot1q termination vid 10

[AR1-GigabitEthernet0/0/1.10]d

[AR1-GigabitEthernet0/0/1.10]dh

[AR1-GigabitEthernet0/0/1.10]dhcp s

[AR1-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24

[AR1-GigabitEthernet0/0/1.10]un sh

Info: Interface GigabitEthernet0/0/1.10 is not shutdown.

[AR1-GigabitEthernet0/0/1.10]dhcp s

GigabitEthernet0/0/1.10]d

[AR1-GigabitEthernet0/0/1.10]dh

[AR1-GigabitEthernet0/0/1.10]dhcp s

[AR1-GigabitEthernet0/0/1.10]dhcp sr

[AR1-GigabitEthernet0/0/1.10]dhcp sev

[AR1-GigabitEthernet0/0/1.10]dhcp ser

[AR1-GigabitEthernet0/0/1.10]dhcp server d

[AR1-GigabitEthernet0/0/1.10]dhcp server dns-list 2.2.2.2 8.8.8.8

[AR1-GigabitEthernet0/0/1.10]dh

[AR1-GigabitEthernet0/0/1.10]dhcp s

[AR1-GigabitEthernet0/0/1.10]dhcp ser

[AR1-GigabitEthernet0/0/1.10]dhcp server l

[AR1-GigabitEthernet0/0/1.10]dhcp server lease d

[AR1-GigabitEthernet0/0/1.10]dhcp server lease day 5

[AR1-GigabitEthernet0/0/1.10]dis th

[AR1-GigabitEthernet0/0/1.10]dis this

[AR1-GigabitEthernet0/0/1.10]dis this

[V200R003C00]

interface GigabitEthernet0/0/1.10

dot1q termination vid 10

ip address 192.168.10.1 255.255.255.0

dhcp select interface

dhcp server lease day 5 hour 0 minute 0

dhcp server dns-list 2.2.2.2 8.8.8.8

return

[AR1-GigabitEthernet0/0/1.10]int g0/0/1.20

[AR1-GigabitEthernet0/0/1.20]d

[AR1-GigabitEthernet0/0/1.20]o

[AR1-GigabitEthernet0/0/1.20]do

[AR1-GigabitEthernet0/0/1.20]dot1q t

[AR1-GigabitEthernet0/0/1.20]dot1q termination v

[AR1-GigabitEthernet0/0/1.20]dot1q termination vid 20

[AR1-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24

[AR1-GigabitEthernet0/0/1.20]se

[AR1-GigabitEthernet0/0/1.20]sel

[AR1-GigabitEthernet0/0/1.20]sel

[AR1-GigabitEthernet0/0/1.20]sele

[AR1-GigabitEthernet0/0/1.20]dh

[AR1-GigabitEthernet0/0/1.20]dhcp i

[AR1-GigabitEthernet0/0/1.20]dhcp im

[AR1-GigabitEthernet0/0/1.20]dhcp in

[AR1-GigabitEthernet0/0/1.20]dhcp int

[AR1-GigabitEthernet0/0/1.20]dhcp s

[AR1-GigabitEthernet0/0/1.20]dhcp select i

[AR1-GigabitEthernet0/0/1.20]dhcp select interface

[AR1-GigabitEthernet0/0/1.20]dh

[AR1-GigabitEthernet0/0/1.20]dhcp se

[AR1-GigabitEthernet0/0/1.20]dhcp ser

[AR1-GigabitEthernet0/0/1.20]dhcp server dn

[AR1-GigabitEthernet0/0/1.20]dhcp server dns-list 2.2.2.2 8.8.8.8

[AR1-GigabitEthernet0/0/1.20]dhcp s

[AR1-GigabitEthernet0/0/1.20]dhcp ser

[AR1-GigabitEthernet0/0/1.20]dhcp server 1

^

Error: Unrecognized command found at ‘^’ position.

[AR1-GigabitEthernet0/0/1.20]dhcp ser

[AR1-GigabitEthernet0/0/1.20]dhcp server l

[AR1-GigabitEthernet0/0/1.20]dhcp server lease d

[AR1-GigabitEthernet0/0/1.20]dhcp server lease day 6

[AR1-GigabitEthernet0/0/1.20]un sh

Info: Interface GigabitEthernet0/0/1.20 is not shutdown.

[AR1-GigabitEthernet0/0/1.20]dis this

[V200R003C00]

interface GigabitEthernet0/0/1.20

dot1q termination vid 20

ip address 192.168.20.1 255.255.255.0

dhcp select interface

dhcp server lease day 6 hour 0 minute 0

dhcp server dns-list 2.2.2.2 8.8.8.8

return

[AR1-GigabitEthernet0/0/1.20]q

[AR1]int g0/0/1.10

[AR1-GigabitEthernet0/0/1.10]a

[AR1-GigabitEthernet0/0/1.10]arp b

[AR1-GigabitEthernet0/0/1.10]arp broadcast en

[AR1-GigabitEthernet0/0/1.10]arp broadcast enable

[AR1-GigabitEthernet0/0/1.10]un sh

Info: Interface GigabitEthernet0/0/1.10 is not shutdown.

[AR1-GigabitEthernet0/0/1.10]int g0/0/1.20

[AR1-GigabitEthernet0/0/1.20]a

[AR1-GigabitEthernet0/0/1.20]arp b

[AR1-GigabitEthernet0/0/1.20]arp broadcast e

[AR1-GigabitEthernet0/0/1.20]arp broadcast enable

[AR1-GigabitEthernet0/0/1.20]un sh

Info: Interface GigabitEthernet0/0/1.20 is not shutdown.

[AR1-GigabitEthernet0/0/1.20]q

[AR1]ip ro

[AR1]ip route-

[AR1]ip route-static 15.0.0.0 24 12.0.0.2

[AR1]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

sa

save

The current configuration will be written to the device.

Are you sure to continue? (y/n)[n]:u

Error: Input error

sa

save

The current configuration will be written to the device.

Are you sure to continue? (y/n)[n]:y

It will take several minutes to save configuration file, please wait…

Configuration file had been saved successfully

AR2配置

The device is running!

u t m

Info: Current terminal monitor is off.

sys

Enter system view, return user view with Ctrl+Z.

[Huawei]sysn

[Huawei]sysname AR2

[AR2]dh

[AR2]dhcp en

[AR2]dhcp enable

Info: The operation may take a few seconds. Please wait for a moment.done.

[AR2]int g0/0/0

[AR2-GigabitEthernet0/0/0]ip add 12.0.0.2 24

[AR2-GigabitEthernet0/0/0]int g0/0/1

[AR2-GigabitEthernet0/0/1]ip add 12.0.0.1 24

Error: The specified address conflicts with another address.

[AR2-GigabitEthernet0/0/1]ip add 15.0.0.1 24

[AR2-GigabitEthernet0/0/1]int g0/0/0

[AR2-GigabitEthernet0/0/0]dis th

[AR2-GigabitEthernet0/0/0]dis thIS

[V200R003C00]

interface GigabitEthernet0/0/0

ip address 12.0.0.2 255.255.255.0

return

[AR2-GigabitEthernet0/0/0]

[AR2-GigabitEthernet0/0/0]INT

[AR2-GigabitEthernet0/0/0]int g0/0/1

[AR2-GigabitEthernet0/0/1]dh

[AR2-GigabitEthernet0/0/1]dhcp en

[AR2-GigabitEthernet0/0/1]dhcp ena

[AR2-GigabitEthernet0/0/1]dhcp se

[AR2-GigabitEthernet0/0/1]dhcp select g

[AR2-GigabitEthernet0/0/1]dhcp select global

[AR2-GigabitEthernet0/0/1]q

[AR2]ip pool dhcp 15

^

Error:Too many parameters found at ‘^’ position.

[AR2]ip pool dhcp15

Info: It’s successful to create an IP address pool.

[AR2-ip-pool-dhcp15]n

[AR2-ip-pool-dhcp15]ne

[AR2-ip-pool-dhcp15]network 15.0.0.0 mask 24

[AR2-ip-pool-dhcp15]ga

[AR2-ip-pool-dhcp15]gateway-list 15.0.0.1

[AR2-ip-pool-dhcp15]dn

[AR2-ip-pool-dhcp15]dns-list 8.8.8.8 2.2.2.2

[AR2-ip-pool-dhcp15]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

sys

Enter system view, return user view with Ctrl+Z.

[AR2]ip p

[AR2]ip poo

[AR2]ip pool d

[AR2]ip pool dhcp15

[AR2-ip-pool-dhcp15]st

[AR2-ip-pool-dhcp15]static-bind ip-

[AR2-ip-pool-dhcp15]static-bind ip-address 15.0.0.188 mac

[AR2-ip-pool-dhcp15]static-bind ip-address 15.0.0.188 mac-address 54-89-98-

sys

Enter system view, return user view with Ctrl+Z.

[AR2]ip pool dhcp15

[AR2-ip-pool-dhcp15]static-bind ip-address 15.0.0.188 mac-address 5489-9849-4E

44

[AR2-ip-pool-dhcp15]ip ro

[AR2-ip-pool-dhcp15]q

[AR2]ip ro

[AR2]ip route-

[AR2]ip route-static 0.0.0.0 0.0.0.0

^

Error:Incomplete command found at ‘^’ position.

[AR2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

[AR2]dis this

[V200R003C00]

sysname AR2

snmp-agent local-engineid 800007DB03000000000000

snmp-agent

clock timezone China-Standard-Time minus 08:00:00

portal local-server load portalpage.zip

drop illegal-mac alarm

set cpu-usage threshold 80 restore 75

dhcp enable

ip route-static 0.0.0.0 0.0.0.0 12.0.0.1

return

[AR2]dis ip int b

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

The number of interface that is UP in Physical is 3

The number of interface that is DOWN in Physical is 1

The number of interface that is UP in Protocol is 3

The number of interface that is DOWN in Protocol is 1

Interface IP Address/Mask Physical Protocol

GigabitEthernet0/0/0 12.0.0.2/24 up up

GigabitEthernet0/0/1 15.0.0.1/24 up up

GigabitEthernet0/0/2 unassigned down down

NULL0 unassigned up up(s)

[AR2]dis ip ro

[AR2]dis ip routing-table

Route Flags: R - relay, D - download to fib

Routing Tables: Public

Destinations : 11 Routes : 11

Destination/Mask Proto Pre Cost Flags NextHop Interface

0.0.0.0/0 Static 60 0RD 12.0.0.1 GigabitEthernet

0/0/0

12.0.0.0/24 Direct 0 0 D 12.0.0.2 GigabitEthernet

0/0/0

12.0.0.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet

0/0/0

12.0.0.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet

0/0/0

15.0.0.0/24 Direct 0 0 D 15.0.0.1 GigabitEthernet

0/0/1

15.0.0.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet

0/0/1

15.0.0.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet

0/0/1

127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0

127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0

127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

[AR2]

Please check whether system data has been changed, and save data in time

Configuration console time out, please press any key to log on

sa

save

The current configuration will be written to the device.

Are you sure to continue? (y/n)[n]:y

It will take several minutes to save configuration file, please wait…

Configuration file had been saved successfully

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。