NSD基础交换-DHCP服务器配置
DHCP-动态主机配置协议
使用路由器作为DHCP服务器的配置
Router 作为 DHCP 服务器:
1、配置 Router 地址:
Router(config)#hostname GateWay
GateWay(config)#interface gi0/0
GateWay(config-if)# no shutdown
GateWay(config-if)# ip address 192.168.1.1 255.255.255.0
2、启动 DHCP 服务 :
GateWay(config)# service dhcp
3、配置 DHCP 地址池:
GateWay(config)# ip dhcp pool CCIE
GateWay(dhcp-config)# network 192.168.1.0 255.255.255.0
GateWay(dhcp-config)# default-router 192.168.1.254
GateWay(dhcp-config)# dns-server 8.8.8.8
4、配置 DHCP 客户端 :
5、验证命令:
在服务器端的验证命令:
GateWay# show ip dhcp binding
GateWay# show running-config
在客户端的验证:
运行--> cmd ---> ipconfig /all
DHCP 地址排除:
GateWay(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.10
排除192.168.1.1到192.168.1.10的IP地址
交换机与路由器命令相同
当交换机为不同网段分配IP地址时应配置网关
网关配置命令为
Switch(config)#ip default-gateway 加网关ip地址
DHCP中继
1、配置 Server 同时为多个网段自动分配IP地址;
2、A网段主机IP地址为 - 192.168.10.0/24
网关地址 - 192.168.10.254
DNS-Server - 8.8.8.8
B网段主机IP地址为- 192.168.20.0/24
网关地址 - 192.168.20.254
DNS-Server - 9.9.9.9
3、为 Server 设置网关 --->因为当不同网段请求DHCP服务时DHCP服务器需要通过网关
向不同网段的主机配送IP地址。
4、需要在其他网段的网关输入指令 ip helper-address 192.168.10.250 --->向DHCP服务器请求DHCP报文