DHCP Service Configuration - Cisco Simulator

DHCP (Dynamic Host Configuration Protocol, Dynamic Host Configuration Protocol) is a LAN network protocol. It refers to a range of IP addresses controlled by the server. When the client logs in to the server, it can automatically obtain the IP address and subnet mask assigned by the server. DHCP is usually used in large-scale local area network environments. Its main function is to centralize management and assign IP addresses, so that hosts in the network environment can dynamically obtain information such as IP addresses, Gateway addresses, and DNS server addresses, and can improve the use of addresses. Rate.

Method 1. Configure DHCP service using a layer 3 switch

1. Topology planning

Perform the following network topology planning in the Cisco simulator.
insert image description here
The topology diagram consists of a Layer 3 switch, two Layer 2 switches and four hosts.

2. Configure Layer 2 switch vlan

Perform the following operations on the Switch0 command line:

Switch>enable 										//进入特权模式
Switch#configure t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#
Switch(config)#vlan 10								//创建vlan 10
Switch(config-vlan)#exit
Switch(config)#int
Switch(config)#interface r
Switch(config)#interface range f0/1-20				//批量选择端口1-20
Switch(config-if-range)#sw
Switch(config-if-range)#switchport m
Switch(config-if-range)#switchport mode a
Switch(config-if-range)#switchport mode access 		//设置端口为access类型
Switch(config-if-range)#sw
Switch(config-if-range)#switchport a
Switch(config-if-range)#switchport access vlan 10	//将端口加入到vlan 10中
Switch(config-if-range)#no shutdown					//开启端口

Perform the above operations on Switch1 as well.

3. Configure Layer 3 switch vlan

Execute the following operations on the command line of the Layer 3 switch:

Switch>enable 
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#inte
Switch(config)#interface vlan 10
Switch(config-if)#ip ad
Switch(config-if)#ip address 192.168.1.254 255.255.255.0
Switch(config-if)#exit
Switch(config)#int f0/1
Switch(config-if)#sw
Switch(config-if)#switchport mo
Switch(config-if)#switchport mode a
Switch(config-if)#switchport mode access 
Switch(config-if)#sw
Switch(config-if)#switchport a
Switch(config-if)#switchport access vlan 10

4. Configure DHCP service

Execute the following operations on the command line of the Layer 3 switch:

Switch(dhcp-config)#exit
Switch(config)#ip dh
Switch(config)#ip dhcp ?
  excluded-address  Prevent DHCP from assigning certain addresses
  pool              Configure DHCP address pools
  relay             DHCP relay agent parameters
  snooping          DHCP Snooping
Switch(config)#ip dhcp p
Switch(config)#ip dhcp pool vlan10						//配置DHCP地址池
Switch(dhcp-config)#network 192.168.1.1 255.255.255.0	//配置DHCP网络
Switch(dhcp-config)#def
Switch(dhcp-config)#default-router 192.168.1.254		//默认网关地址
Switch(dhcp-config)#exit
Switch(config)#se
Switch(config)#service dh
Switch(config)#service dhcp								//启动DHCP服务

5. Test

insert image description here
Dynamic request successful! !

Method 2. Configure DHCP service directly on the router

1. Topology map

insert image description here

2. Configure router Router0

Router>en
Router#conf t
Router(config)#ip dh
Router(config)#ip dhcp pool pool1						//配置地址池
Router(dhcp-config)#network 192.168.1.0 255.255.255.0	//地址池玩过范围

Router(dhcp-config)#de
Router(dhcp-config)#default-router 192.168.1.1			//默认网关

Router(dhcp-config)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console

3. Test

insert image description here

Router#show ip d
Router#show ip dhcp b
Router#show ip dhcp binding 							//查询ip地址使用情况
IP address       Client-ID/              Lease expiration        Type
                 Hardware address
192.168.1.2      000D.BDC0.795E           --                     Automatic

Method 3. Use the server to configure the DHCP service

1. Topology map

insert image description here

2. Configure the server

Configure IP and gateway
insert image description here
Configure DHCP service
insert image description here
Configure g0/2 port of Router1, specify DHCP server address:

Router#configure t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#interface GigabitEthernet0/2
Router(config-if)#ip help
Router(config-if)#ip helper-address 192.168.3.12	//指定DHCP服务器地址

3. Test

insert image description here

Guess you like

Origin blog.csdn.net/py_123456/article/details/117163914