DHCP Server configuration

Source: Internet
Author: User

For the DHCP Server, what we are most exposed to is the content of the vswitch and vro. Here we will introduce in detail the content of the vswitch as a DHCP Server.

"Configure Environment Parameters 』
1. NICs of PC1 and PC2 use dynamic IP address acquisition
2. the Ethernet port 0/1 connecting PC1 to the vswitch belongs to VLAN10; the Ethernet port 0/2 connecting PC2 to the vswitch belongs to VLAN20
3. the VLAN 10 Address of layer-3 Switch SwitchA is 10.1.1.1/24, and the VLAN 20 address is 10.1.2.1/24.

"Networking requirements 』
1. PC1 can dynamically obtain the IP address range 10.1.1.0/24 and the gateway address is 10.1.1.1. PC2 can dynamically obtain the IP address range 10.1.2.0/24 and the gateway address is 10.1.2.1.

"DHCP Server configuration process 』
You can assign an IP address to a PC directly connected to a layer-3 switch, or assign an IP address to a PC that is connected to a layer-3 Switch through a DHCP relay device 。
You can use an interface or a global address pool to allocate addresses 。

SwitchA allocates address-related configurations through interfaces]
1. Create (enter) VLAN10
[SwitchA] vlan 10
2. Add E0/1 to VLAN10
A [SwitchA-vlan10] port Ethernet 0/1
3. Create (enter) VLAN Interface 10
[SwitchA] interface Vlan-interface 10
4. Configure IP addresses for VLAN 10
[SwitchA-Vlan-interface10] ip address 10.1.1.1 255.255.255.0
5. Select the interface method to assign an IP address on VLAN Interface 10.
[SwitchA-Vlan-interface10] dhcp select interface
6. Do not assign the gateway address of the PC to the user.
[SwitchA] dhcp server forbidden-ip 10.1.1.1

SwitchA uses a global address pool to allocate address-related configurations]
1. Create (enter) VLAN10
[SwitchA] vlan 10
2. Add E0/1 to VLAN10
A [SwitchA-vlan10] port Ethernet 0/1
3. Create (enter) VLAN Interface 10
[SwitchA] interface Vlan-interface 10
4. Configure IP addresses for VLAN 10
[SwitchA-Vlan-interface10] ip address 10.1.1.1 255.255.255.0
5. Select the global address pool mode to assign IP addresses on VLAN Interface 10.
[SwitchA-Vlan-interface10] dhcp select global
6. Create a global address pool and name it "vlan10"
[SwitchA] dhcp server ip-pool vlan10
7. Configure the address range and gateway address allocated to the user by the vlan10 address pool.
[SwitchA-dhcp-vlan10] network 10.1.1.0 mask 255.255.255.0
[SwitchA-dhcp-vlan10] gateway-list 10.1.1.1
8. Do not assign the gateway address of the PC to the user.
[SwitchA] dhcp server forbidden-ip 10.1.1.1

Additional description]
The preceding configuration takes VLAN10 as an example. For VLAN20 configuration, refer to VLAN10 configuration. When using the global address pool method, you must create a global address pool with different names than "vlan10 。
After the preceding configuration, the IP address assigned to PC1 is 10.1.1.0/24, the gateway address of PC1 is 10.1.1.1, And the IP address assigned to PC2 is 10.1.2.0/24, at the same time, the gateway address of PC2 is 10.1.2.1 。
By default, VLAN interfaces use a global address pool to allocate addresses. Therefore, when a VLAN interface is configured with a global address pool for Address Allocation, DHCP configuration cannot be seen under the corresponding VLAN interface 。
The global address pool can be used to allocate IP addresses of different CIDR blocks to users from VLAN interface addresses of layer-3 switches 。

2. DHCP Relay Configuration

"Configure Environment Parameters 』
1. the IP address of DHCPServer is 192.168.0.10/24.
2. The DHCPServer is connected to port G1/1 of the vswitch and belongs to vlan100. The Gateway is the IP address 192.168.0.1/24 of vlan Interface 100 of the vswitch.
3. E0/1-E0/10 belongs to vlan10, And the CIDR block address is 10.10.1.1/24.
4. E0/11-E0/20 belongs to vlan20 and its cidr block address is 10.10.2.1/24.

"Networking requirements 』
1. Configure DHCP Relay on SwitchA so that the following users can dynamically obtain the IP address of the specified CIDR block.
2. Both PC1 and PC2 can ping their own gateways, while PC1 and PC2 can communicate with each other.

"Vswitch DHCP Relay configuration process 』
DHCP Relay is used to adapt to situations where the client and Server are not in the same network segment. Through Relay, users of different subnets can apply for an IP address from the same DHCP Server, this facilitates the management and maintenance of the address pool 。

SwitchA configurations]
1. Global Enabling DHCP (DHCP is enabled by default)
[SwitchA] dhcp enable
2. Create (enter) VLAN100
[SwitchA] vlan 100
3. Add G1/1 to VLAN100
[SwitchA-vlan100] port GigabitEthernet 1/1
4. Create (enter) VLAN Interface 100
[SwitchA] interface Vlan-interface 100
5. Configure IP addresses for VLAN Interface 100
[SwitchA-Vlan-interface100] ip address 192.168.0.1 255.255.255.0
6. Create (enter) VLAN10
[SwitchA] vlan 10
7. Add E0/1-E0/10 to VLAN10
[SwitchA-vlan10] port Ethernet 0/1 to Ethernet 0/10
8. Create (enter) VLAN Interface 10
[SwitchA] interface Vlan-interface 10
9. Configure IP addresses for VLAN 10
[SwitchA-Vlan-interface10] ip address 10.10.1.1 255.255.255.0
10. enable DHCP relay for VLAN Interface 10
[SwitchA-Vlan-interface10] dhcp select relay
11. Configure the IP address of the DHCP server for VLAN 10.
[SwitchA-Vlan-interface10] ip relay address 192.168.0.10
12. Create (enter) VLAN20
[SwitchA-vlan10] vlan 20
13. Add E0/11-E0/20 to VLAN20
[SwitchA-vlan20] port Ethernet 0/11 to Ethernet 0/20
14. Create (enter) VLAN Interface 20
[SwitchA] interface Vlan-interface 20
15. Configure IP addresses for VLAN Interface 20
[SwitchA-Vlan-interface20] ip address 10.10.2.1 255.255.255.0
16. DHCP relay function enabling VLAN Interface 20
[SwitchA-Vlan-interface20] dhcp select relay
17. Configure the IP address of the DHCP server for VLAN 20
[SwitchA-Vlan-interface20] ip relay address 192.168.0.10
Additional description]
You can also enable the DHCP relay function on one or more VLAN interfaces in global configuration mode. For example, [SwitchA] dhcp select relay interface Vlan-interface 10

3. DHCP Snooping

"Configure Environment Parameters 』
1. The DHCPServer is connected to port G1/1 of the SwitchA vswitch. It belongs to vlan10 and its IP address is 10.10.1.253/24.
2. Ports E0/1 and E0/2 belong to vlan10.

"Networking requirements 』
1. PC1 and PC2 can both obtain IP addresses from the specified DHCP Server.
2. prevent other illegal DHCP servers from affecting hosts on the network

"Switch DHCP-Snooping configuration process 』
When DHCP-Snooping is enabled, the switch listens to the DHCP packet and can extract and record IP address and MAC address information from the received DHCP Request or DHCP Ack message, DHCP-Snooping allows you to set a physical port to a trusted port or a untrusted port. A trusted port can receive and forward DHCP Offer packets normally, the untrusted port discards the received DHCP Offer packets. In this way, the switch can shield the counterfeit DHCP Server and ensure that the client obtains the IP address from the valid DHCP Server 。

SwitchA configurations]
1. Create (enter) VLAN10
[SwitchA] vlan 10
2. Add ports E0/1, E0/2, and G1/1 to VLAN10.
[SwitchA-vlan10] port Ethernet 0/1 Ethernet 0/2 GigabitEthernet 1/1
3. Global enable dhcp-snooping
[SwitchA] dhcp-snooping
4. Configure port G1/1 as the trust port,
[SwitchA-GigabitEthernet1/1] dhcp-snooping trust

Additional description]
The DHCP server provides you with the "dhcp offer" packet, which is sent from Port G1/1 to SwitchA for forwarding, therefore, you must set port G1/1 to "trust". If the upstream interface of SwitchA is configured as the Trunk port and is connected to the DHCP relay device, you also need to configure the upstream port as the "trust" port 。

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.