Full explanation of DHCP configuration on a Cisco Router

Source: Internet
Author: User
Tags cisco 2950


A Cisco router uses Cisco 3620 as the ios dhcp Server. the IP address of the fastethernet0 port connected to the Intranet is 192.168.1.4, And the L2 Switch uses two Cisco 2950, A layer-3 Switch uses a Cisco 3550. There are two VLANs in the network. To simplify the description, assume that each VLAN uses a 24-bit network address. The IP address of VLAN1 is 192.168.1.254, And the IP address of VLAN2 is 192.168.2.254. Implement the ios dhcp Server function on a Cisco device to automatically obtain IP addresses from hosts in each VLAN, as shown in.
The database that configures the DHCP address pool, additional information, and lease term DHCP server is organized into a tree structure. The root is the address pool of all network segments for dynamic allocation, and the branches are subnet address pools, leaf is the address manually bound to the node. The procedure is as follows: first log on to the Cisco 3640 vro: ghq> enable Password (Enter the privileged Password of the vro) ghq # config terminal (Enter the configuration mode) Enter configuration commands one per line. end with CNTL/Z. ghqconfig # ip dhcp pool global (configure a root address pool. global is the name of the address pool, which can be expressed using meaningful strings) www.2cto.com ghq dhcp-config # network 192.168.0.0 255.255.0.0 (dynamically allocated address segment) ghqdhcp-config # domain-name ghq.com (configure the domain suffix for the client) ghqdhcp-config # dns-server 192.168.1.1 (configure the DNS server for the client) ghqdhcp-config # netbios-name-server 192.168.1.1 (configure the wins server for the client) ghqdhcp-config # netbios-node-type h-node (configure the h node mode for the client) ghqdhcp-config # lease 30 (the address lease period is 30 days) ghqdhcp-config # ip dhcp pool vlan1 (configure the address pool for VLAN1. This pool is a sub-pool of the global pool and inherits the domain suffix, DNS server, wins server, and other parameters from global) ghqdhcp-config # network 192.168.1.0 255.255.255.0 (VLAN1 dynamically allocates addresses that can be allocated within the network segment 192.168.1, but not excluded addresses) ghqdhcp-config # default-router 192.168.1.254 (configure the default gateway for the client, that is, the ip address of VLAN1) ghqdhcp-config # ip dhcp pool vlan2 (configure the address pool for VLAN2, this pool is a sub-pool of the global pool. It inherits the domain suffix, DNS server, wins server, and other parameters from global)
Ghqdhcp-config # network 192.168.2.0 255.255.255.0 ghqdhcp-config # default-router 192.168.2.254 setting cannot be used for dynamically assigned IP addresses www.2cto.com in the entire network. Some IP addresses need to be statically specified to some specific devices, for example, the router port, DNS server, wins server, and VLAN address. Obviously, these static IP addresses cannot be dynamically allocated, so they need to be excluded. The procedure is as follows: ghqconfig # ip dhcp excluded-address 192.168.1.1 192.168.1.5 (ip address 192.168.1.1 to 192.168.1.5 cannot be dynamically allocated) ghqconfig # ip dhcp excluded-address 192.168.1.254 (ip address 192.168.1.254 is fixed as VLAN1 address, cannot be used for Dynamic Allocation) ghqconfig # ip dhcp excluded-address 192.168.2.254 (ip address 192.168.2.254 is fixed to VLAN2 and cannot be used for Dynamic Allocation) DHCP database proxy is a host used to store DHCP binding information. It can be an FTP, TFTP, or RCP server. You can configure multiple DHCP database proxies if necessary. Likewise, it is allowed not to configure the DHCP database proxy, but this is at the cost of not storing address conflict logs on the DHCP database proxy. If you do not want to configure the database proxy, you only need to cancel the record function of the address conflict log. The operation command is as follows: ghqconfig # no ip dhcp conflict logging (cancel the address conflict log) to configure the static route table of a vrodhcp, you must enable the client to automatically obtain the IP address from the vrodhcp used as the DHCP Server. The first condition is that the client in each VLAN can communicate with the vro, therefore, you must first set a route in the router to enable the router to communicate with each client. We can set www.2cto.com ghqconfig # ip route 192.168.1.0 255.255.255.0 FastEthernet0 (FastEthernet0 is the Ethernet interface connecting the vro and the Intranet, this command is used to create a static route between the Ethernet interface and VLAN1 192.168.1.254 .) Ghqconfig # ip route 192.168.2.0 255.255.255.0 FastEthernet0 (this command establishes a static route between the Ethernet interface and VLAN2 192.168.2.254), and then type the EXIT command in the configuration mode to return to the privileged mode, ping the IP addresses 192.168.1.254 and 192.168.2.254 of VLAN1 and VLAN2. If you can Ping the general rules, the configuration is correct and you can directly go to the next saving process. To specify DHCP server addresses for different VLANs on a vswitch, you only need to set ip helper-ADDRESS in different VLANs. The command is as follows: switch> enable (Enter the privileged mode of the switch) Password switch # config t (Enter the configuration mode) Enter configuration commandsone per line. end with CNTL/Z. switch config # interface vlan1 (configure VLAN1) switch config-if # ip helper-address 192.168.1.4 (specify the ip address of the DHCP server, that is, the ip address of the router) ghqconfig-if # interface vlan2 (configure VLAN2) ghqconfig-if # ip helper-address 192.168.1.4
Enable the Portfast function for all L2 access ports directly connected to the client. To correctly obtain the IP address of the client, you need to enable the Portfast function of the switch port connected to the client (Cisco 2950 ). Note that this function can only be enabled on the Layer 2 port connecting to a single client, enabling this function on a port connected to a vswitch or hub may cause a broadcast storm or address learning problem. To enable Portfast, follow these steps: www.2cto.com switch # configure terminal switch config # interface-id switch config-if # spanning-tree portfast (enable portfast) switchconfig-if # After the above planning and setting operations, all the settings on the vro and vswitch are completed, for the rest of the work, you only need to enable the "automatically obtain IP Address" function on the client (2 ). For Windows 2000/2003 Server, you also need to enable the "dhcp client" service (as shown in Figure 3). Otherwise, the IP address cannot be automatically obtained on Windows 2000/2003 Server.

Figure 2
Figure 3 now, by enabling the DHCP Server function of the Cisco router and using DHCP on the client, the host in the lan vlan can automatically obtain the IP address, truly realizing all the functions of the DHCP service. Compared with the DHCP server implemented by the windows/Linux operating system on the server, the DHCP server implemented by the router is much superior in terms of stability and function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.