Skip to main content

 路由器设置 > 新闻资讯 >

DHCP配置

2014-04-10 23:38 浏览:

1、要求


现有一台DHCP服务器两台PC机给一网段为192.168.2.0/24要求两台PC能够自动获取DHCP服务器分配的IP地址网关为192.168.2.1排除192.168.2.10--------192.168.2.20网段并且让某一台PC绑定192.168.2.20


2、网络拓扑图

wKioL1NGpn2gMa8XAAEXCBHzxqM232.jpg

  3、DHCP的配置和验证

  1路由器作为DHCP Server的配置

  [Router]dhcp enable

  [Router]dhcp server ip-pool net-pool

  [Router-dhcpnet-pool]network 192.168.2.0 mask ?

  X.X.X.X Network mask

  [Router-dhcpnet-pool]network 192.168.2.0 mask 255.255.255.0

  [Router-dhcpnet-pool]gateway-list 192.168.2.1 ?

  

  X.X.X.X Router IP address

  [Router-dhcpnet-pool]gateway-list 192.168.2.1

  [Router-dhcpnet-pool]dns ?

  X.X.X.X Server IP address

  [Router-dhcpnet-pool]dns 1.1.1.1 ?

  

  X.X.X.X Server IP address

  [Router-dhcpnet-pool]dns 1.1.1.1 2.2.2.2

  [Router-dhcpftp-pool]static ip-add 192.168.2.20 //绑定IP地址

  [Router-dhcpftp-bind]static-bind mac-address 3c-e5-a6-7f-37-4b//绑定MAC

  [Router]dhcp server forbidden-ip ?

  X.X.X.X Low IP address

  [Router]dhcp server forbidden-ip 192.168.2.10 ?

  

  X.X.X.X High IP address

  [Router]dhcp server forbidden-ip 192.168.2.10 192.168.2.20 //排除的网段

2、配置PC-A

将本地主机作为PC-A打开本地主机的网络设备点击属性把IP地和DNS改为自动获取如图1所示

  

wKiom1NGp0LCpP2_AAEh9M31Oio130.jpg

图1IP地址设为自动获取


验证本机是否获取到IP地址和DNS点击网络状态再点击详细信息可以看到获取的IP地址和DNS如图2所示

  

wKioL1NGpzHSztf3AAFW9TUDyBU282.jpg

        图2IP地址和DNS自动获取的信息

  3PC-B的配置

  用一台防火墙作为PC-B使其作如下配置

  [PC-B]interface Ethernet0/0

  [PC-B-Ethernet0/0]ip ad

  [PC-B-Ethernet0/0]ip address d

  [PC-B-Ethernet0/0]ip address dhcp-alloc

  然后查看是否获得IP地址如下所示

  dis interface Ethernet0/0

  Ethernet0/0 current state :UP

  Line protocol current state :UP

  Description : Ethernet0/0 Interface

  The Maximum Transmit Unit is 1500, Hold timer is 10(sec)

  Internet Address is 192.168.2.2/24, acquired via DHCP

  查看DNS是否自动获取到

  display dns server ?

  dynamic DNS Server ip address dynamic allocated

  

  display dns server dynamic

  Domain-server IpAddress

  0 1.1.1.1

  1 2.2.2.2

  4DHCP的绑定验证

  把192.168.2.20绑定给PC-B进行验证如下

  PC-B-Ethernet0/0]undo ip address dhcp-alloc

  [PC-B-Ethernet0/0]ip address dhcp-alloc

  [PC-B-Ethernet0/0]

  %Apr 10 12:52:32:998 2014 PC-B IFNET/4/UPDOWN:Line protocol on the interface Ethernet0/0 is UP

  [PC-B-Ethernet0/0]dis interface Ethernet0/0

  Ethernet0/0 current state :UP

  Line protocol current state :UP

  Description : Ethernet0/0 Interface

  The Maximum Transmit Unit is 1500, Hold timer is 10(sec)

  Internet Address is 192.168.2.20/24, acquired via DHCP