Cisco router configuration DHCP service and relay

Cisco router configuration DHCP service and relay

topology

The network segment on the LAN side of R1 is and 192.168.10.0/24the default gateway is192.168.10.1

The network segment on the R2 LAN side is and 192.168.20.0/24the default gateway is192.168.20.1

The DNS server address is192.168.10.2

The address of G0/0 of R0 is10.1.1.1

The G0/1 address of R0 is10.1.1.2

configuration

Exclude addresses from the pool

The purpose of excluding IP addresses is to reserve some fixed IPs to prevent conflicts caused by the allocation of the IPs.

For example, exclude the first 10 IPs of R1 and 192.168.10.254(note that the configuration is on R0)

R0(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.10
R0(config)#ip dhcp excluded-address 192.168.10.254

This process is the same for R2.

Create and configure a DHCP address pool

Create an address pool on R0 for the R1 LAN side

R0(config)#ip dhcp pool R1-LAN

set network address

R0(dhcp-config)#network 192.168.10.0 255.255.255.0

Specify the default gateway for this network

R0(dhcp-config)#Default-router 192.168.10.1

specify DNS server

R0(dhcp-config)#dns-server 192.168.10.2

Configure the domain name (you can not match it if there is no requirement)

R0(dhcp-config)#domain-server example.com

relay

Enter the G0/0 interface configuration mode of R1

R1(config)#interface g0/0

Set helper-address (the configured address is the interface of R0 closest to R1)

R1(config-if)#ip helper-address 10.1.1.1

Note: If a single DHCP provides DHCP service, the helper-address address is the DHCP server address (as shown in the figure below)

At this time, the command in the R1 G0/0 interface configuration mode in the above figure is

R1(config-if)#ip helper-address 192.168.11.6

Precautions

Cisco routers enable DHCP service by default. To disable it, execute the following command

Router(config)#no service dhcp

Guess you like

Origin blog.csdn.net/qq_42759112/article/details/129731321