DHCP配置命令简易

一、第一部分为DHCP的全局地址池的配置

根据图片显示内容设置Pc1、Pc2为dhcp中的全局地址池,并将Pc1与网段10.0.1.100进行绑定,Pc2与10.0.2.1进行绑定

  Step1: 在LSW5上创建VLAN 10 20,并将e1、e2口设置为对应的access;

interface Ethernet0/0/1
  port link-type access
  port default vlan 10
interface Ethernet0/0/2
  port link-type access
  port default vlan 20
interface Ethernet0/0/5
    port link-type trunk
    port trunk allow-pass vlan 10 20

 

 Step2:在SW3上设置PC1、PC2的网关、开启DHCP服务并设置地址池、Pc1的地址池为pool-market、Pc2的地址池为pool-finance;如果有需要可配置dhcp服务的时间、保留的ip段...

ip pool pool-finance
 gateway-list 10.0.2.254 //声明该网段的网关地址
 network 10.0.2.0 mask 255.255.255.0
 static-bind ip-address 10.0.2.1 mac-address 5489-98a0-06bb//将Pc2的mac地址与ip地址进行绑定
 dns-list 8.8.8.8
ip pool pool-market
 gateway-list 10.0.1.254
 network 10.0.1.0 mask 255.255.255.0
 static-bind ip-address 10.0.1.100 mac-address 5489-9826-76f6
 excluded-ip-address 10.0.1.250 10.0.1.253
 dns-list 8.8.8.8

#设置PC1与PC2的网关
interface Vlanif10
ip address 10.0.1.254 255.255.255.0
interface Vlanif20
ip address 10.0.2.254 255.255.255.0

 Step3:最后在Vlanif10、20接口上配置

dhcp select global

用来开启接口采用全局地址池的DHCP Server功能

注:要在两台交换机的系统视图下上开启DHCP enable

若要修改PC的绑定地址首先要释放与PC绑定的ip地址,在终端上输入

ipconfig /release

将Pc获取到的ip地址进行释放,然后再ip pool name XXX中更改绑定的ip地址。

如果不进行释放直接进行绑定,会报错mac地址,如:

Error:The static-MAC is exist in this IP-pool.

二、接口地址池

 Step1:SW2等接口配置与全局地址池同理;在SW4上开启DHCP服务后进入vlanif 30接口配置

interface Vlanif30
 ip address 10.0.3.254 255.255.255.0
 dhcp select interface
 dhcp server dns-list 8.8.8.8

注:与全局地址池不同的是接口不用设置地址池同时 dhcp select interface 命令也不同,也可以配置租期、绑定等

posted @ 2023-07-10 21:00  汉堡00  阅读(402)  评论(0)    收藏  举报