How to configure DHCP for a Cisco Router

Source: Internet
Author: User
Tags cisco 2950

It is helpful to know about the configuration of a Cisco router. Here we mainly explain the detailed configuration of the DHCP service in the configuration of a Cisco router. A company uses Cisco 3620 as the ios dhcp Server. the IP address of the fastethernet0 port connected to the Intranet is 192.168.1.4. The L2 Switch uses two Cisco 2950 and the L3 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. Enable the ios dhcp Server function on a Cisco device so that hosts in each VLAN can automatically obtain the IP address, configure the DHCP address pool, additional information, and lease term, the database of the DHCP server is organized into a tree structure. The root of the tree is the address pool of all network segments for dynamic allocation, the branches are the subnet address pool, and the leaves are the addresses manually bound to the nodes. Follow these steps to log on to the Cisco 3640 vro:

Password (enter the vro's privileged Password)
Ghq # config terminal (entering the Cisco router configuration mode)
Enter configuration commands one per line. End with CNTL/Z
Ghq config # ip dhcp pool global
Ghq dhcp-config # network 192.168.0.0 255.255.0.0 dynamically allocated address segment)
Ghq dhcp-config # domain-name ghq. comCisco vro configuration domain suffix)
Ghq dhcp-config # dns-server 192.168.1.1 configure the DNS server for the client)
Ghq dhcp-config # netbios-name-server 192.168.1.1
Ghq dhcp-config # netbios-node-type h-node
Ghq dhcp-config # lease 30
Ghq dhcp-config # ip dhcp pool vlan1
Ghq dhcp-config # network 192.168.1.0 255.255.255.0
Ghq dhcp-config # default-router 192.168.1.254
Ghq dhcp-config # ip dhcp pool vlan2
Ghq dhcp-config # network 192.168.2.0 255.255.255.0
Ghq dhcp-config # default-router 192.168.2.254

Set IP addresses that cannot be dynamically allocated

In the entire network, some IP addresses need to be statically specified to some specific devices, such as 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:

Ghq config # ip dhcp excluded-address 192.168.1.1 192.168.1.5IP address 192.168.1.1 to 192.168.1.5 cannot be dynamically allocated)
Ghq config # ip dhcp excluded-address 192.168.1.254IP address 192.168.1.254 is a fixed VLAN1 address and cannot be dynamically allocated)
Ghq config # ip dhcp excluded-address 192.168.2.254IP address 192.168.2.254 is fixed as VLAN2 address and cannot be dynamically allocated)

Set DHCP database proxy

The DHCP database proxy is a host used to store DHCP binding information. It can be an FTP, TFTP, or RCP server. Of course, if necessary, you can configure multiple DHCP database proxies on the Cisco router. 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:

Configure a static route table for a Cisco Router

To enable the client to automatically obtain the IP address from the router used as the DHCP Server, the first condition is that the client in each VLAN can communicate with the router, therefore, you must first set a route in the router to enable the router to communicate with each client. You can set it as follows:

Ghq config # ip route 192.168.1.0 255.255.255.0 FastEthernet0
Ghq config # ip route 192.168.2.0 255.255.255.0 FastEthernet0

After the configuration is complete, 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 the Ping Rules are available, the configuration is correct, you can directly go to the next save 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 to enter the privileged mode of the switch)
Password switch # config t enters configuration mode)
Enter configuration commands one per line. End with CNTL/Z.
Switch config # interface vlan1 configure VLAN1)
Switch config-if # ip helper-address 192.168.1.4 specifies the ip address of the DHCP server, that is, the ip address of the router)
Ghq config-if # interface vlan2 configure VLAN2)
Ghq config-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, enable the Portfast function of the switch port connected to the client to 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 the Portfast function, follow these steps:

Switch # configure terminal
Switch config # interface-id
Switch config-if # enable portfast for spanning-tree portfast)
Switch config-if # end

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.