DHCP server applications are embodied in many vswitches and routers. 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. Implement the ios dhcp Server function on a Cisco device to automatically obtain IP addresses from hosts in each VLAN, as shown in.
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. The procedure is as follows:
First, log on to the Cisco 3640 vro:
- Ghq> enable
-
- Password
- (Enter the vro's privileged password)
-
- 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, which can be expressed using meaningful strings)
-
- Ghq dhcp-config # network 192.168.0.0 255.255.0.0
- Dynamically assigned CIDR blocks)
-
- Ghq dhcp-config # domain-name ghq.com
- Configure the domain suffix for the client)
-
- 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
- Configure the wins server for the client)
-
- Ghq dhcp-config # netbios-node-type h-node
- Configure the h node mode for the client)
-
- Ghq dhcp-config # lease 30
- Address lease period: 30 days)
-
- Ghq dhcp-config # ip dhcp pool vlan1
- Configure an 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)
-
- Ghq dhcp-config # network 192.168.1.0 255.255.255.0
- VLAN1 dynamically allocates IP addresses that can be allocated in the network segment 192.168.1, which are not excluded)
-
- Ghq dhcp-config # default-router 192.168.1.254
- Configure the default gateway for the client, that is, the IP address of VLAN1)
-
- Ghq dhcp-config # ip dhcp pool vlan2
- Configure an address pool for VLAN2. This pool is a sub-pool of the global pool and inherits the domain suffix, DNS server, wins server, and other parameters from global)
-
- 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.5
- IP addresses 192.168.1.1 to 192.168.1.5 cannot be dynamically allocated)
-
- Ghq config # ip dhcp excluded-address 192.168.1.254
The IP address 192.168.1.254 is fixed to VLAN1 and cannot be dynamically allocated)
- ghq config # ip dhcp excluded-address 192.168.2.254
The IP address 192.168.2.254 is fixed to VLAN2 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. 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:
- Ghq config # no ip dhcp conflict logging cancels the address conflict log)
Configure the static route table of the 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
FastEthernet0 is the Ethernet interface connected to the vro and the Intranet. This command is used to create a static route between the Ethernet interface and 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 VLAN2 192.168.2.254)
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.
Specify the DHCP server address for different VLANs on the vswitch.
This step can only be done by setting 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 the 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 Portfast for all L2 access ports directly connected to the client
To make the client obtain the correct IP address, you need to 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