Configuring DHCP services on Cisco routers

Source: Internet
Author: User
Tags get ip cisco 2950
A unit uses 3640 as the iOS DHCP Server, and the IP address of the FASTETHERNET0 port connected to the intranet is 192.168.1.4, the second-tier machine uses two 2950, the three-tier machine uses a Cisco 3550.

There are two VLANs throughout the network, for a simplified description, assuming that each VLAN has a 24-bit network address, where the IP address of the VLAN1 is 192.168.1.254,vlan2 192.168.2.254. Implement the iOS DHCP Server feature on Cisco devices so that hosts in each VLAN automatically obtain an IP address, as shown in the following figure.

  

Configure DHCP address pools, additional information, and lease durations

The DHCP database is organized into a tree structure, where the root is the address pool for all network segments that are dynamically allocated, the branch is the subnet address pool, and the leaves are manually bound to the node's address. The following are the steps:

First logged on to the Cisco 3640 device:

Ghq>enable

Password (privileged password for the input)

GHQ #config Terminal (enter configuration mode)

Enter configuration commands one per line. End with cntl/z.

Ghqconfig # IP DHCP pool global (Configure a root address pool, Global is the name of the address pool, you can represent it with a meaningful string)

GHQ dhcp-config #network 192.168.0.0 255.255.0.0 (dynamically assigned address segment)

Ghqdhcp-config #domain-name ghq.com (configure domain suffix for client)

Ghqdhcp-config #dns-server 192.168.1.1 (configuring DNS for clients)

Ghqdhcp-config #netbios-name-server 192.168.1.1 (Configuring a WINS server for clients)

Ghqdhcp-config #netbios-node-type H-node (Configuring H-node mode for clients)

Ghqdhcp-config #lease 30 (address rental period is 30 days)

Ghqdhcp-config #ip DHCP Pool vlan1 (Configure the address pool for VLAN1, this pool is a child pool of the global pool and will inherit domain suffixes, DNS servers, WINS servers, and so on) from global

Ghqdhcp-config #network 192.168.1.0 255.255.255.0 (VLAN1 dynamically assigns 192.168.1 addresses that can be assigned within this network segment, no excluded addresses)

Ghqdhcp-config#default-router 192.168.1.254 (Configure the default gateway for the client, which is the IP address of the VLAN1)

Ghqdhcp-config #ip DHCP pool vlan2 (address pool is configured for VLAN2, this pool is a child pool of the global pool and inherits parameters such as domain suffixes, DNS servers, WINS servers, etc.) from global

Ghqdhcp-config#network 192.168.2.0 255.255.255.0

Ghqdhcp-config #default-router 192.168.2.254

setting an IP address that cannot be used for dynamic assignment

Over the network, some IP addresses need to be statically assigned to specific devices, such as the port of the router, the DNS server, the WINS server, and the address of the VLAN. Obviously, these static IP addresses cannot be used for dynamic allocation, which requires that they be excluded. The steps are as follows:

Ghqconfig #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 used for dynamic allocation)

Ghqconfig # ip DHCP excluded-address 192.168.1.254

(IP address 192.168.1.254 fixed to VLAN1 address, cannot be used for dynamic allocation)

Ghqconfig # ip DHCP excluded-address 192.168.2.254

(IP address 192.168.2.254 fixed to VLAN2 address, cannot be used for dynamic allocation)

setting up the DHCP database proxy

The DHCP database proxy is a host for DHCP binding information, which can be an FTP, TFTP, or RCP server. Of course, you can configure multiple DHCP database proxies if necessary. Similarly, it is permissible to not configure the DHCP database proxy, but this is at the expense of the address conflict log on the DHCP database proxy. If we do not want to configure the database agent, just cancel the address conflict log record function, the Operation command is as follows:

Ghqconfig # No IP dhcp conflict logging (cancellation of address conflict log)

Configure the router's static routing table

To enable a client to automatically obtain an IP address from a router that is used as a DHCP server, the first condition is that the client in each VLAN communicates with the router, so it is necessary to set up a route in the router to enable the router to communicate with each client. We can set it as follows:

Ghqconfig #ip Route 192.168.1.0 255.255.255.0 FastEthernet0

(The FASTETHERNET0 is an Ethernet interface connected to the router and the intranet, which functions as a static route between the Ethernet interface and the VLAN1 192.168.1.254.) )

Ghqconfig #ip Route 192.168.2.0 255.255.255.0 FastEthernet0

(This command establishes a static route between the Ethernet interface and the VLAN2 192.168.2.254)

After Setup, type the exit command in configuration mode to return to privileged mode, ping the IP addresses of VLAN1 and VLAN2 192.168.1.254 and 192.168.2.254, and if you can ping the general rules to indicate that the configuration is correct, you can go directly to the next save process.

Specify DHCP server addresses for different VLANs on the switch

This step can only be done by setting the IP helper-address in a different VLAN, as follows:

Switch>enable (privileged mode of access switch)

Password

Switch #config t (enter configuration mode)

Enter configuration Commandsone per line. End with cntl/z.

Switchconfig #interface vlan1 (configuration VLAN1)

Switchconfig-if #ip helper-address 192.168.1.4 (Specifies the address of the DHCP server, which is the address of the router)

Ghqconfig-if #interface vlan2 (configuration VLAN2)

Ghqconfig-if #ip helper-address 192.168.1.4

Turn on the Portfast feature on all two-tier access ports that are directly connected to the client

For the client to obtain an IP address correctly, the Portfast function of the switch port connected to the client needs to be turned on (Cisco 2950). It is important to note that this feature can only be turned on on a two-tier port connected to a single client, which can cause broadcast storms or "address learning" problems if the work is turned on on a port connected to a switch or hub. The steps to turn on the Portfast feature are as follows:

Switch #configure terminal

Switchconfig #interface Interface-id

Switchconfig-if #spanning-tree portfast (open Portfast function)

Switchconfig-if #end

After the above planning and setup operation, the settings on the router and the switch are all complete, and the rest of the work is as long as the "Get IP Address" function is turned on on the client (Figure 2). For 2000/2003 server systems, you also need to enable the DHCP CLIENT service (as shown in Figure 3 below), otherwise the IP address will not be automatically available in 2000/2003 server.

  

Figure II

  

Might

At this point, by enabling the DHCP server feature of the Cisco router to be used with client DHCP, the host in the LAN VLAN automatically obtains the IP address, which truly realizes the full functionality of the DHCP service. Compared to the DHCP server implemented on the server with the Windows/linux operating system, the router realizes a much superior DHCP server from the perspective of stability and functionality.

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.