NA West Seventh difficult: DHCP

DHCP

DHCP (Dynamic Host Configuration Protocol) Dynamic Host Configuration Protocol, using a client / server mode, DHCP client dynamically requests the network configuration information to the DHCP server, the DHCP server returns the corresponding configuration information (IP address, subnet mask according to the policy, default gateway and other network parameters)

The basic architecture

NA West Seventh difficult: DHCP

The basic architecture of the three roles

DHCP Client

DHCP client, through exchange messages with a DHCP server to obtain IP addresses and other network configuration information to complete its own address configuration. Disposed on DHCP Client interface functions, such as DHCP Client interface, use DHCP to obtain parameters such as IP address from the DHCP Server, user configuration, also facilitates centralized management.

DHCP Relay

DHCP relay forwards DHCP messages from a client or server direction direction, assist DHCP client and the DHCP server to complete the address configuration. If the DHCP server and the DHCP client is not within the same network segment, the DHCP relay agent forwards packets, to avoid the need to deploy DHCP server on each network segment, saving costs, and facilitates centralized management.
The basic architecture in the DHCP protocol, DHCP relay is not required role. Only when the DHCP client and DHCP server are not on the same network segment, only it needs DHCP relay for packet forwarding.

DHCP Server

DHCP server or from the client is responsible for processing relay address allocation, address renewal, address release request, etc., allocation of IP address and other network configuration information to the client.

Configuring DHCP server based on the interface address pool

, User interfaces connected to the subnet can obtain an IP address from the address pool interfaces based on the interface address pool DHCP server configuration information
NA West Seventh difficult: DHCP

Configuring DHCP Server function-based interface

R1
dhcp enable
interface GigabitEthernet0/0/0
ip address 192.168.1.254 255.255.255.0
dhcp select interface
interface GigabitEthernet0/0/1
ip address 192.168.2.254 255.255.255.0
dhcp select interface

配置基于接口的DHCP Server租期/DNS服务器地址

在r1的GE0/0/0接口配置ip租用有效期限为2天(默认为1天),超过租期后该地址将会重新分配
interface GigabitEthernet0/0/0
dhcp server lease day 2 hour 0 minute 0

在r1的GE0/0/0接口配置不参与自动分配的ip地址范围为192.168.1.1到192.168.1.10
interface GigabitEthernet0/0/0
dhcp server excluded-ip-address 192.168.1.1 192.168.1.10

在r1的GE0/0/0接口配置接口地址池下的DNS服务器
interface GigabitEthernet0/0/0
dhcp server dns-list 8.8.8.8

pc配置及检查

NA West Seventh difficult: DHCP
NA West Seventh difficult: DHCP

在r1上查看地址分配情况

NA West Seventh difficult: DHCP

配置基于全局地址池的DHCP服务器

配置基于全局地址池的DHCP服务器,从所有接口上连接的用户都可以选择该地址池中的地址,也就是说全局地址池是一个公共地址池。在DHCP服务器上创建地址池并配置相关属性,再配置接口工作在全局地址池模式。路由器支持工作在全局地址池模式的接口有三层接口及其子接口、三层Ethernet接口及其子接口、三层Eth-Trunk接口及其子接口和VLANIF接口。

基本配置

R1
interface GigabitEthernet0/0/0
undo dhcp select interface
interface GigabitEthernet0/0/1
undo dhcp select interface

在R1创建全局地址池,名称为huawei1,配置网段,网关,dns,租期等

ip pool huawei1
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
excluded-ip-address 192.168.1.250 192.168.1.253
lease day 2 hour 0 minute 0
dns-list 8.8.8.8

在R1的GE0/0/0接口配置使用DHCP全局地址池

interface GigabitEthernet0/0/0
dhcp select global

pc检查

NA West Seventh difficult: DHCP

配置DHCP中继

DHCP客户端可以通过DHCP中继与其他网段的DHCP服务器通信,获取IP地址等配置信息
NA West Seventh difficult: DHCP

pc通过r1中继到r3,来获取ip地址

基本配置

R1
interface GigabitEthernet0/0/0
ip address 200.1.1.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 10.1.1.254 255.255.255.0
ospf 1
area 0.0.0.0
network 200.1.1.0 0.0.0.255
network 10.1.1.0 0.0.0.255

R2
interface GigabitEthernet0/0/0
ip address 200.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 100.1.1.2 255.255.255.0
ospf 1
area 0.0.0.0
network 200.1.1.0 0.0.0.255
network 100.1.1.0 0.0.0.255

R3
interface GigabitEthernet0/0/1
ip address 100.1.1.1 255.255.255.0
ospf 1
area 0.0.0.0
network 100.1.1.0 0.0.0.255

配置DHCP服务器

R3
dhcp enable
ip pool dhcp-pool
gateway-list 10.1.1.254
network 10.1.1.0 mask 255.255.255.0
dns-list 8.8.8.8
interface GigabitEthernet0/0/1
dhcp select global

Configuring DHCP Relay

DHCP relay device configured to R1, R3 is designated DHCP server; when R1 pc sent dhcp receives broadcast request packet, R1 will forward the request packet to R3, R3 receives a request packet in a unicast, will assign the IP address information via unicast to R1, R1 to the address information and then pc.
The first configuration: pc interface directly facing the dhcp server address (for small-scale scenes)
Rl
dhcp enable
interface the GigabitEthernet0 / 0 /. 1
dhcp SELECT Relay
dhcp Relay-Server IP 100.1.1.1
second configuration: for pc call the global interface defined in dhcp server group (for larger scene)
dhcp dhcp-server group group
dhcp 100.1.1.1 0-server
interface the GigabitEthernet0 / 0 /. 1
dhcp SELECT Relay
dhcp dhcp-SELECT-Relay server group

pc check

NA West Seventh difficult: DHCP

Guess you like

Origin blog.51cto.com/jiayimeng/2452519