zl程序教程

您现在的位置是:首页 >  其它

当前栏目

DHCP 的综合实验

实验 综合 DHCP
2023-09-11 14:22:31 时间

DHCP的综合实验

需求

  • PC1、2、3、4,自动获得IP地址
  • 且各个主机之间能互相通信

拓扑图

在这里插入图片描述

配置思路

  • 配置DHCP客户端
  • 配置DHCP服务器
  • 配置DHCP中继
  • 配置DHCP客户端和中继之间的交换网络
  • 配置DHCP中继和服务器之间的路由网络

配置命令

  • AR ——DHCP服务器
 @PC1设置为DHCP客户端
@设置DHCP服务器 
undo terminal monitor
system-view
sysname DHCP

dhcp enable 

ip pool VLAN10
network 192.168.10.0 mask 24 
gateway-list 192.168.10.254
dns-list 8.8.8.8
lease day 10
excluded-ip-address 192.168.10.253
quit

ip pool VLAN20
network 192.168.20.0 mask 24
gateway-list 192.168.20.254
dns-list 8.8.8.8
lease day 20
excluded-ip-address 192.168.20.253
quit

interface gi0/0/0
ip address 192.168.66.1 24
dhcp select global
quit
ip route-static 0.0.0.0 0 192.168.66.254 

注意: 默认路由不能丢,很多人都配置完成,却忘记了默认路由,主机始终获取不到IP地址

  • lsw1
lsw1:
undo terminal monitor
system-view
sysname lsw1
vlan batch 10 20 66

dhcp enable 

interface vlanif 10 
ip address 192.168.10.254 24
dhcp select relay
dhcp relay server-ip 192.168.66.1
quit

interface vlanif 20 
ip address 192.168.20.254 24
dhcp select relay
dhcp relay server-ip 192.168.66.1
quit

interface vlanif 66
ip address 192.168.66.254 24
  • lsw2
 undo terminal monitor
system-view
sysname lsw2
vlan batch 10 20 66
quit

interface Ethernet0/0/1
 port link-type access
 port default vlan 10
quit

interface Ethernet0/0/2
 port link-type access
 port default vlan 10
quit

interface GigabitEthernet0/0/1
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
 quit
 
  • lsw3
undo terminal monitor
system-view
sysname lsw3
vlan batch 10 20 66

interface Ethernet0/0/1
 port link-type access
 port default vlan 20
quit

interface Ethernet0/0/2
 port link-type access
 port default vlan 20
quit

interface GigabitEthernet0/0/2
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094
 quit

验证

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述