Use layer-3 Switch to configure DHCP to assign IP addresses to different VLANs

Source: Internet
Author: User

The principle of layer-3 switching and the principle of DHCP are not explained here. Here we use a case to learn how to use layer-3 switching as a DHCP server and assign IP addresses to different network segments. In the production environment, it is common to use routers or switches as DHCP servers.


Lab requirements:

1. Configure the DHCP service on SW1 to assign IP addresses of different network segments to the following four different departments.

2. Configure The VTP Server on SW1, configure the VTP Client on SW2 and SW3, and add the specified department to the relevant VLAN.

3. Note: A relay link is used between the vswitch and the vswitch, but not between the vro.

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/005J1A60-0.jpg "title =" 1.jpg"/>

The detailed configuration information is as follows:

The R1 configuration is as follows:

# Configure the vro Intranet interface IP address and Internet interface IP Address

R1 (config) # int f0/0

R1 (config-if) # ip add 10.0.0.2 255.0.0.0

R1 (config-if) # no sh

R1 (config-if) # no shutdown

R1 (config-if) # exit

R1 (config) # int f1/0

R1 (config-if) # ip add 202.106.123.1 255.255.255.248

R1 (config-if) # no sh

R1 (config-if) # no shutdown

# Static route entries configured to the Intranet

R1 (config) # ip route 192.168.1.0 255.255.255.0 10.0.0.1

R1 (config) # ip route 192.168.2.0 255.255.255.0 10.0.0.1

R1 (config) # ip route 192.168.3.0 255.255.255.0 10.0.0.1

R1 (config) # ip route 192.168.4.0 255.255.255.0 10.0.0.1


The SW1 configuration is as follows:

# IP address configured to the router interface

SW1 (config) # ip routing

SW1 (config) # int f0/0

SW1 (config-if) # no switchport

SW1 (config-if) # ip add 10.0.0.1 255.0.0.0

SW1 (config-if) # no shutdown

# Configure the interface link between vswitches as a relay link (trunk)

SW1 (config) # int range f0/1-2

SW1 (config-if-range) # switchport mode trunk

SW1 (config-if-range) # no sh

# Configuring VTP Server

SW1 # vlan database

SW1 (vlan) # vtp domain test

SW1 (vlan) # vtp server

SW1 (vlan) # vtp password 123

SW1 (vlan) # vtp pruning

# Create a vlan (create different VLANs for the four departments)

SW1 # vlan database

SW1 (vlan) # vlan 10

SW1 (vlan) # vlan 20

SW1 (vlan) # vlan 30

SW1 (vlan) # vlan 40

# Configuring vlan Virtual Interface addresses

SW1 (config-if) # int vlan 10

SW1 (config-if) # ip add 192.168.1.1 255.255.255.0

SW1 (config-if) # no sh

SW1 (config-if) # exit

SW1 (config-if) # int vlan 20

SW1 (config-if) # ip add 192.168.2.1 255.255.255.0

SW1 (config-if) # no sh

SW1 (config-if) # exit

SW1 (config-if) # int vlan 30

SW1 (config-if) # ip add 192.168.3.1 255.255.255.0

SW1 (config-if) # no sh

SW1 (config-if) # exit

SW1 (config-if) # int vlan 40

SW1 (config-if) # ip add 192.168.4.1 255.255.255.0

SW1 (config-if) # no sh

# Note: to configure the DHCP relay service, you need to add a DHCP server address SW1 (config-if) # ip helper-address [DHCP server address] In the vlan Virtual Interface.

# Configure a default route to enable Internet access

SW1 (config) # ip route 0.0.0.0 0.0.0.0 10.0.0.2

# Configure the DHCP address pool for different network segments (four network segment address pools are required because there are four VLANs)

SW1 (config) # ip dhcp pool vlan10

SW1 (dhcp-config) # network 192.168.1.0 255.255.255.0

SW1 (dhcp-config) # default-router 192.168.1.1

SW1 (dhcp-config) # dns-server 202.106.0.20

SW1 (dhcp-config) # lease 2

SW1 (dhcp-config) # exit

SW1 (config) # ip dhcp pool vlan20

SW1 (dhcp-config) # network 192.168.2.0 255.255.255.0

SW1 (dhcp-config) # default-router 192.168.2.1

SW1 (dhcp-config) # dns-server 202.106.0.20

SW1 (dhcp-config) # lease 2

SW1 (dhcp-config) # exit

SW1 (config) # ip dhcp pool vlan30

SW1 (dhcp-config) # network 192.168.3.0 255.255.255.0

SW1 (dhcp-config) # default-router 192.168.3.1

SW1 (dhcp-config) # dns-server 202.106.0.20

SW1 (dhcp-config) # lease 2

SW1 (dhcp-config) # exit

SW1 (config) # ip dhcp pool vlan40

SW1 (dhcp-config) # network 192.168.4.0 255.255.255.0

SW1 (dhcp-config) # default-router 192.168.4.1

SW1 (dhcp-config) # dns-server 202.106.0.20

SW1 (dhcp-config) # lease 2

# Note: If you want to set a reserved address, you can configure ip dhcp excluded-address low-address [high-address].


The SW2 configuration is as follows:

# Configure the link for layer-3 switching as a relay link (trunk)

SW2 (config) # int f0/0

SW2 (config-if) # switchport mode trunk

SW2 (config-if) # no sh

# Configure the VTP client (After configuring the VTP client, you can learn the vlan created on the layer-3 Switch)

SW2 # vlan database

SW2 (vlan) # vtp domain test

SW2 (vlan) # vtp client

SW2 (vlan) # vtp password 123

SW2 (vlan) # vtp pruning

# Add the specified interface to the corresponding vlan

SW2 (config) # int f0/1

SW2 (config-if) # switchport access vlan 10

SW2 (config-if) # no sh

SW2 (config-if) # exit

SW2 (config-if) # int f0/2

SW2 (config-if) # switchport access vlan 20

SW2 (config-if) # no sh


The SW3 configuration is as follows:

# Configure the link for layer-3 switching as a relay link (trunk)

SW3 (config) # int f0/0

SW3 (config-if) # switchport mode trunk

SW3 (config-if) # no sh

# Configure the VTP client (After configuring the VTP client, you can learn the vlan created on the layer-3 Switch)

SW3 # vlan database

SW3 (vlan) # vtp domain test

SW3 (vlan) # vtp client

SW3 (vlan) # vtp password 123

SW3 (vlan) # vtp pruning

# Add the specified interface to the corresponding vlan

SW3 (config) # int f0/1

SW3 (config-if) # switchport access vlan 30

SW3 (config-if) # no sh

SW3 (config-if) # exit

SW3 (config-if) # int f0/2

SW3 (config-if) # switchport access vlan 40

SW3 (config-if) # no sh


After all the above configurations are configured, the client can automatically obtain the corresponding IP address and access the Internet by setting the IP address to DHCP.


This article is from the "initialize" blog, please be sure to keep this source http://cshbk.blog.51cto.com/5685776/1251038

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.