In enterprises, routers are used to build DHCP servers. Let's take a look at the relevant content based on the following actual application case. Project requirements: XX enterprise has three departments, which are divided into VLAN for the three departments in layer-3 switching.
IP address planning is as follows:
VLAN10 192.168.10.1 VLAN20 192.168.20.1 VLAN30 192.168.30.1 A cisco2811 router is used as the DCHP server.
The configuration is as follows:
Enable
Configure terminal
No iprouting
Interface f0/0
Ip address 192.168.30.100 255.255.255.0
No shutdown
Exit
Ip default gateway 192.168.30.1
Service dhcp
Ip dhcp pool vlan10 can be changed at Will)
Network 192.168.10.0 255.255.255.0 VLAN10 network segment and subnet mask)
Default-router 192.168.10.1VLAN10 IP address)
Dns-server 61.134.1.4 218.30.19.40 Shaanxi DNS)
Lease 8 is valid for 8 days)
Exit
Service dhcp
Ip dhcp pool vlan20 can be changed at Will)
Network 192.168.20.0 255.255.255.0 VLAN10 network segment and subnet mask)
Default-router 192.168.20.1 IP address of VLAN20)
Dns-server 61.134.1.4 218.30.19.40 Shaanxi DNS)
Lease 8 is valid for 8 days)
Exit
Service dhcp
Ip dhcp pool vlan30 can be changed at Will)
Network 192.168.10.0 255.255.255.0 VLAN10 network segment and subnet mask)
Default-router 192.168.30.1 IP address of VLAN30)
Dns-server 61.134.1.4 218.30.19.40 Shaanxi DNS)
Lease 8 is valid for 8 days)
Exit
The above is the DHCP configuration on the vrodhcp. The enterprise has to make several DHCP pools for several VLANs. the horizontal line can be modified separately according to the IP address of the enterprise.
In addition, DHCP relay must be performed on layer-3 switches. Only the VLAN where DHCP is located can automatically obtain the IP address, but other VLANs cannot!
In the above section, we talked about how to execute DHCP relay commands on layer-3 switches. Here I will write only one relay command as an instance:
Interface vlan10
Ip helper-address 192.168.30.100 ip address of the DHCP server)
Exit
Remember: When performing DHCP relay, it must correspond to the DHCP pool one by one. There are several DCHP pools that need to be used for DHCP relay.