DHCP_server
Win7&XP下实现DHCP Server功能
Win7&XP下实现DHCP Server功能
首先如果使用Win7或者XP的无线网做热点分享的话,那么本身就具备DHCP Sever功能,一般是192.168.137.XXX网段
下面介绍的是有线网实现DHCP Server功能
(Windows Server系列操作系统都带有该功能)
1、安装DHCP SeverV2.4.4
官方地址:http://www.dhcpserver.de/cms/
2、将电脑的网口连接到一个设备或者交换机上,然后将本地连接属性中IPV4设置为手动配
置IP地址(关闭DHCP Client功能)
比如
IP地址:192.168.2.1
子网掩码:255.255.255.0
默认网关可不写
(注意:如果你同时使用了网线网,该网段要和无线网的网段不同)
3、打开dhcpwiz.exe
点击下一步
选择本地连接点击下一步
勾选DNS,实例填写8.8.8.8(google)根据需要自行填写点击下一步
根据需要填写IP分配范围以及租约时间(范围排除本地连接IP)点击下一步
点击Advanced按钮,将Subnet(子网掩码)、DNS Server、Gateway(网关)填写好之后点击OK,回到之前的界面点击下一步
按照下图进行操作,之后点击下一步
点击Start,然后点击Exit
4、组合键Win+R,输入Services.msc
其中DHCP Server 为启动状态,大功告成
这时候该电脑有线网络具备DHCO Server功能,下面链接的设备都可以自动获取IP地址。
Cisco dhcp server 配置文档
Configuring DHCPThis chapter describes how to configure Dynamic Host Configuration Protocol(DHCP).For a completedescription of the DHCP commands listed in this chapter, refer to the “DHCP Commands” chapter ofthe Cisco IOS IP and IP Routing Command Reference publication. To locate documentation of othercommands that appear in this chapter, use the command reference master index or search online.As explained in RFC2131,Dynamic Host Configuration Protocol, DHCP provides configurationparameters to Internet hosts.DHCP consists of two components:a protocol for delivering host-specificconfiguration parameters from a DHCP server to a host and a mechanism for allocating networkaddresses to hosts.DHCP is built on a client/server model,where designated DHCP server hosts allocatenetwork addresses and deliver configuration parameters to dynamically configured hosts.DHCP supports three mechanisms for IP address allocation:•Automatic allocation—DHCP assigns a permanent IP address to a client.•Dynamic allocation—DHCP assigns an IP address to a client for a limited period of time (or until the client explicitly relinquishes the address).•Manual allocation—The network administrator assigns an IP address to a client and DHCP is used simply to convey the assigned address to the client.The format of DHCP messages is based on the format of Bootstrap Protocol(BOOTP)messages,whichensures support for BOOTP relay agent functionality and interoperability between BOOTP clients andDHCP servers. BOOTP relay agents eliminate the need for deploying a DHCP server on each physicalnetwork segment. BOOTP is explained in RFC951,Bootstrap Protocol (BOOTP), and RFC1542,Clarifications and Extensions for the Bootstrap Protocol.DHCP Server OverviewThe Cisco IOS DHCP server feature is a full DHCP server implementation that assigns and manages IPaddresses from specified address pools within the router to DHCP clients.If the Cisco IOS DHCP servercannot satisfy a DHCP request from its own database, it can forward the request to one or moresecondary DHCP servers defined by the network administrator.Figure14 shows the basic steps that occur when a DHCP client requests an IP address from a DHCPserver. The client, Host A, sends a DHCPDISCOVER broadcast message to locate a Cisco IOS DHCPserver.A DHCP server offers configuration parameters(such as an IP address,a MAC address,a domainname, and a lease for the IP address) to the client in a DHCPOFFER unicast message.Configuring DHCPDHCP Server Overview Figure 14DHCP Request for an IP Address from a DHCP Server Note A DHCP client may receive offers from multiple DHCP servers and can accept any one ofthe offers; however, the client usually accepts the first offer it receives. Additionally, theoffer from the DHCP server is not a guarantee that the IP address will be allocated to theclient;however,the server usually reserves the address until the client has had a chance toformally request the address.The client returns a formal request for the offered IP address to the DHCP server in a DHCPREQUESTbroadcast message. The DHCP server confirms that the IP address has been allocated to the client byreturning a DHCPACK unicast message to the client.Note The formal request for the offered IP address (the DHCPREQUEST message) that is sentby the client is broadcast so that all other DHCP servers that received theDHCPDISCOVER broadcast message from the client can reclaim the IP addresses that theyoffered to the client.If the configuration parameters sent to the client in the DHCPOFFER unicast message bythe DHCP server are invalid (a misconfiguration error exists), the client returns aDHCPDECLINE broadcast message to the DHCP server.The DHCP server will send to the client a DHCPNAK denial broadcast message, whichmeans the offered configuration parameters have not been assigned,if an error has occurredduring the negotiation of the parameters or the client has been slow in responding to theDHCPOFFER message (the DHCP server assigned the parameters to another client)of theDHCP server.The Cisco IOS DHCP server feature offers the following benefits:•Reduced Internet access costsUsing automatic IP address assignment at each remote site substantially reduces Internet accesscosts. Static IP addresses are considerably more expensive to purchase than are automaticallyallocated IP addresses.•Reduced client configuration tasks and cost sBecause DHCP is easy to configure, it minimizes operational overhead and costs associated withdevice configuration tasks and eases deployment by nontechnical users.•Centralized managementBecause the DHCP server maintains configurations for several subnets,an administrator only needsto update a single, central server when configuration parameters change.Host A DHCP ACK (unicast)DHCPREQUEST (broadcast)DHCPOFFER (unicast)DHCPDISCOVER (broadcast)Cisco IOS DHCP server 32369Configuring DHCPDHCP Configuration Task ListBefore you configure the Cisco IOS DHCP server feature, complete the following tasks:•Identify an external File Transport Protocol(FTP),Trivial File Transfer Protocol(TFTP),or remote copy protocol (rcp) server that you will use to store the DHCP bindings database.•Identify the IP addresses that you will enable the DHCP server to assign,and the IP addresses that you will exclude.•Identify DHCP options for devices where necessary, including:–Default boot image name–Default router(s)–Domain Name System (DNS) server(s)–NetBIOS name server•Decide on a NetBIOS node type (b, p, m, or h).•Decide on a DNS domain name.DHCP Configuration Task ListThe DHCP server database is organized as a tree. The root of the tree is the address pool for naturalnetworks, branches are subnetwork address pools, and leaves are manual bindings to clients.Subnetworks inherit network parameters and clients inherit subnetwork parameters.Therefore,commonparameters,for example the domain name,should be configured at the highest(network or subnetwork)level of the tree.Note Inherited parameters can be overridden.For example,if a parameter is defined in both thenatural network and a subnetwork, the definition of the subnetwork is used.Address leases are not inherited.If a lease is not specified for an IP address,by default,theDHCP server assigns a one-day lease for the address.To configure the Cisco IOS DHCP server feature, first configure a database agent or disable conflictlogging, then configure IP addresses that the DHCP server should not assign (excluded addresses) andshould assign (a pool of available IP addresses) to requesting clients. These configuration tasks areexplained in the following sections. Each task in the following list is identified as required or optional.•Configuring a DHCP Database Agent or Disabling DHCP Conflict Logging (Required)•Excluding IP Addresses (Required)•Configuring a DHCP Address Pool (Required)•Configuring Manual Bindings (Optional)•Configuring a DHCP Server Boot File (Optional)•Configuring the Number of Ping Packets (Optional)•Configuring the Timeout Value for Ping Packets (Optional)•Enabling the Cisco IOS DHCP Server and Relay Agent Features (Optional)Configuring DHCPDHCP Configuration Task List Configuring a DHCP Database Agent or Disabling DHCP Conflict LoggingA DHCP database agent is any host, for example, an FTP, TFTP, or RCP server that stores the DHCPbindings database.You can configure multiple DHCP database agents and you can configure the intervalbetween database updates and transfers for each agent.To configure a database agent and database agentparameters, use the following command in global configuration mode:If you choose not to configure a DHCP database agent,disable the recording of DHCP address conflictson the DHCP server. To disable DHCP address conflict logging, use the following command in globalconfiguration mode:Excluding IP AddressesThe DHCP server assumes that all IP addresses in a DHCP address pool subnet are available forassigning to DHCP clients. You must specify the IP address that the DHCP server should not assign toclients. To do so, use the following command in global configuration mode:Configuring a DHCP Address PoolYou can configure a DHCP address pool with a name that is a symbolic string (such as “engineering”)or an integer (such as 0).Configuring a DHCP address pool also places you in DHCP pool configurationmode—identified by the (config-dhcp)# prompt—from which you can configure pool parameters (forexample,the IP subnet number and default router list).To configure a DHCP address pool,complete therequired tasks in the following sections.Configuring the DHCP Address Pool Name and Entering DHCP Pool Configuration ModeTo configure the DHCP address pool name and enter DHCP pool configuration mode,use the followingcommand in global configuration mode:CommandPurpose Router(config)#ip dhcp database url[timeout seconds | write-delay seconds ]Configures the database agent and the interval between database updates and database transfers.CommandPurpose Router(config)#no ip dhcp conflict logging Disables DHCP address conflict logging.CommandPurpose Router(config)#ip dhcp excluded-addresslow-address [high-address ]Specifies the IP addresses that the DHCP server should not assign to DHCP clients.CommandPurpose Router(config)# ip dhcp pool name Creates a name for the DHCP server address pool and places you in DHCPpool configuration mode (identified by the config-dhcp# prompt).Configuring DHCPDHCP Configuration Task List Configuring the DHCP Address Pool Subnet and MaskTo configure a subnet and mask for the newly created DHCP address pool,which contains the range of available IP addresses that the DHCP server may assign to clients,use the following command in DHCP pool configuration mode:Note You can not configure manual bindings within the same pool that is configured with thenetwork command.To configure manual bindings,see the “Configuring Manual Bindings”section.Configuring the Domain Name for the ClientThe domain name for a DHCP client places the client in the general grouping of networks that make up the domain.To configure a domain name string for the client,use the following command in DHCP pool configuration mode:Configuring the Domain Name System IP Servers for the ClientDHCP clients query DNS IP servers when they need to correlate host names to IP addresses. Toconfigure the DNS IP servers that are available to a DHCP client,use the following command in DHCP pool configuration mode:Configuring the NetBIOS Windows Internet Naming Service IP Servers for the ClientWindows Internet Naming Service (WINS)is a name resolution service that Microsoft DHCP clients use to correlate host names to IP addresses within a general grouping of networks.To configure the NetBIOS WINS servers that are available to a Microsoft DHCP client,use the following command in DHCP pool configuration mode:CommandPurpose Router(config-dhcp)#network network-number[mask |/prefix-length ]Specifies the subnet network number and mask of the DHCP address pool.The prefix length specifies the number of bits that comprise theaddress prefix. The prefix is an alternative way of specifying thenetwork mask of the client.The prefix length must be preceded bya forward slash (/).CommandPurpose Router(config-dhcp)#domain-name domain Specifies the domain name for the client.CommandPurpose Router(config-dhcp)#dns-server address[address2...address8]Specifies the IP address of a DNS server that is available to a DHCP client.One IP address is required; however, you can specify up to eight IPaddresses in one command line.Configuring DHCPDHCP Configuration Task List Configuring the NetBIOS Node Type for the ClientThe NetBIOS node type for Microsoft DHCP clients can be one of four settings:broadcast,peer-to-peer,mixed, or hybrid. To configure the NetBIOS node type for a Microsoft DHCP, use the followingcommand in DHCP pool configuration mode:Configuring the Default Router for the ClientAfter a DHCP client has booted, the client begins sending packets to its default router. The IP address of the default router should be on the same subnet as the client.To configure a default router for a DHCP client, use the following command in DHCP pool configuration mode:Configuring the Address Lease TimeBy default,each IP address assigned by a DHCP server comes with a one-day lease,which is the amount of time that the address is valid.To change the lease value for an IP address,use the following command in DHCP pool configuration mode:Configuring Manual BindingsAn address binding is a mapping between the IP address and MAC address of a client. The IP address of a client can be assigned manually by an administrator or assigned automatically from a pool by aDHCP server.Manual bindings are IP addresses that have been manually mapped to the MAC addresses of hosts that are found in the DHCP database.Manual bindings are stored in NVRAM on the DHCP server.Manual bindings are just special address pools.There is no limit on the number of manual bindings but you can only configure one manual binding per host pool.CommandPurpose Router(config-dhcp)#netbios-name-serveraddress [address2...address8]Specifies the NetBIOS WINS server that is available to a Microsoft DHCP client. One address is required; however, you can specify up toeight addresses in one command line.CommandPurpose Router(config-dhcp)#netbios-node-type type Specifies the NetBIOS node type for a Microsoft DHCP mandPurpose Router(config-dhcp)#default-routeraddress [address2... address8]Specifies the IP address of the default router for a DHCP client. One IP address is required,although you can specify up to eight addresses in onecommand line.CommandPurpose Router(config-dhcp)# lease {days[hours ][minutes ]| infinite }Specifies the duration of the lease. The default is a one-day lease.Configuring DHCPDHCP Configuration Task List Automatic bindings are IP addresses that have been automatically mapped to the MAC addresses of hoststhat are found in the DHCP database.Automatic bindings are stored on a remote host called a databaseagent. The bindings are saved as text records for easy maintenance.To configure a manual binding, first create a host pool, then specify the IP address of the client andhardware address or client identifier. The hardware address is the MAC address. The client identifier,which is required for Microsoft clients(instead of hardware addresses),is formed by concatenating themedia type and the MAC address of the client. Refer to the “Address Resolution Protocol Parameters”section of RFC1700,Assigned Numbers, for a list of media type codes.To configure manual bindings, use the following commands beginning in global configuration mode:Command PurposeStep1Router(config)# ip dhcp pool name Creates a name for the a DHCP server address pool and places youin DHCP pool configuration mode—identified by the(config-dhcp)# prompt.Step2Router(config-dhcp)#host address [mask| /prefix-length]Specifies the IP address and subnet mask of the client.The prefix length specifies the number of bits that comprise the address prefix. The prefix is an alternative way of specifying the network mask of the client.The prefix length must be preceded by a forward slash(/).Step3Router(config-dhcp)# hardware-address hardware-address typeorRouter(config-dhcp)#client-identifierunique-identifier Specifies a hardware address for the client.The type value:•Indicates the protocol of the hardware platform. Strings and values are acceptable. The string options are:–ethernet–ieee802•The value options are:– 1 10Mb Ethernet– 6 IEEE 802If no type is specified, the default protocol is Ethernet.orSpecifies the distinct identification of the client in dotted hexadecimal notation, for example, 01b7.0813.8811.66, where 01 represents the Ethernet media type.Step4Router(config-dhcp)# client-name name(Optional) Specifies the name of the client using any standardASCII character. The client name should not include the domainname. For example, the name mars should not be specified as.Configuring DHCP DHCP Configuration Task ListConfiguring a DHCP Server Boot FileThe boot file is used to store the boot image for the client. The boot image is generally the operatingsystem the client uses to load.To specify a boot file for the DHCP client,use the following command inDHCP pool configuration mode:Command PurposeRouter(config-dhcp)# bootfile filename Specifies the name of the file that is used as a boot image. Configuring the Number of Ping PacketsBy default, the DHCP server pings a pool address twice before assigning the address to a requestingclient.If the ping is unanswered,the DHCP server assumes(with a high probability)that the address isnot in use and assigns the address to the requesting client. To change the number of ping packets theDHCP server should send to the pool address before assigning the address,use the following commandin global configuration mode:Command PurposeRouter(config)#ip dhcp ping packets number Specifies the number of ping packets the DHCP server sends to a pooladdress before assigning the address to a requesting client.The defaultis two packets.Configuring the Timeout Value for Ping PacketsBy default, the DHCP server waits 500milliseconds before timing out a ping packet. To change theamount of time the server waits, use the following command in global configuration mode:Command PurposeRouter(config)# ip dhcp ping timeout milliseconds Specifies the amount of time the DHCP server must wait beforetiming out a ping packet. The default 500 milliseconds. Enabling the Cisco IOS DHCP Server and Relay Agent FeaturesBy default,the Cisco IOS DHCP server and relay agent features are enabled on your router.To reenablethese features if they are disabled, use the following command in global configuration mode:Command PurposeRouter(config)#service dhcp Enables the Cisco IOS DHCP server and relay features on your router.Use the no form of this command to disable the Cisco IOS DHCP server and relayfeatures.Configuring DHCPMonitoring and Maintaining the DHCP ServerMonitoring and Maintaining the DHCP ServerTo clear DHCP server variables, use the following commands in privileged EXEC mode, as needed:Command PurposeRouter#clear ip dhcp binding address |*Deletes an automatic address binding from the DHCP database.Specifying address clears the automatic binding for a specific(client)IPaddress, whereas specifying asterisk (*) clears all automatic bindings. Router#clear ip dhcp conflict address |*Clears an address conflict from the DHCP database.Specifying addressclears the conflict for a specific IP address whereas specifying an asterisk(*) clears conflicts for all addresses.Router#clear ip dhcp server statistics Resets all DHCP server counters to 0.To enable DHCP server debugging, use the following command in privileged EXEC mode:Command PurposeRouter# debug ip dhcp server{events | packets | linkage}Enables debugging on the DHCP server.To display DHCP server information, use the following commands in EXEC mode, as needed:Command PurposeRouter> show ip dhcp binding[address]Displays a list of all bindings created on a specific DHCP server. Router> show ip dhcp conflict[address]Displays a list of all address conflicts recorded by a specific DHCP server. Router#show ip dhcp database[url]Displays recent activity on the DHCP database.Note Use this command in privileged EXEC mode.Router> show ip dhcp server statistics Displays count information about server statistics and messages sent andreceived.Configuration ExamplesThis section provides the following configuration examples:•DHCP Database Agent Configuration Example•DHCP Address Pool Configuration Example•Manual Bindings Configuration ExampleConfiguring DHCPConfiguration Examples DHCP Database Agent Configuration ExampleThe following example stores bindings on host 172.16.4.253. The file transfer protocol is FTP. Theserver should wait 2 minutes (120 seconds) before writing database changes.ip dhcp database ftp://user:password@172.16.4.253/router-dhcp write-delay 120DHCP Address Pool Configuration ExampleIn the following example, three DHCP address pools are created: one in network 172.16.0.0, one insubnetwork 172.16.1.0,and one in subnetwork 172.16.2.0.Attributes from network 172.16.0.0,such as the domain name, DNS server, NetBIOS name server, and NetBIOS node type, are inherited insubnetworks 172.16.1.0and 172.16.2.0.In each pool,clients are granted 30-day leases and all addresses in each subnetwork, except the excluded addresses, are available to the DHCP server for assigning toclients. Table 5 lists the IP addresses for the devices in three DHCP address pools.ip dhcp database ftp://user:password@172.16.4.253/router-dhcp write-delay 120ip dhcp excluded-address 172.16.1.100 172.16.1.103ip dhcp excluded-address 172.16.2.100 172.16.2.103!ip dhcp pool 0network 172.16.0.0 /16domain-name dns-server 172.16.1.102 172.16.2.102netbios-name-server 172.16.1.103 172.16.2.103netbios-node-type h-node!ip dhcp pool 1network 172.16.1.0 /24default-router 172.16.1.100 172.16.1.101lease 30!ip dhcp pool 2network 172.16.2.0 /24default-router 172.16.2.100 172.16.2.101lease 30T able 5DHCP Address Pool DevicesPool 0 (Network 172.16.0.0)Pool 1 (Subnetwork 172.16.1.0)Pool 2 (Subnetwork 172.16.2.0)DeviceIP Address Device IP Address Device IP Address Default routers–Default routers 172.16.1.100172.16.1.101Default routers 172.16.2.100172.16.2.101DNS server 172.16.1.102—172.16.2.102————NetBIOS name server 172.16.1.103—172.16.2.103————NetBIOS node type h-node ————Configuring DHCPConfiguration ExamplesManual Bindings Configuration ExampleThe following example creates a manual binding for a client named .The MAC addressof the client is 02c7.f800.0422 and the IP address of the client is 172.16.2.254.ip dhcp pool Marshost 172.16.2.254hardware-address 02c7.f800.0422 ieee802client-name MarsBecause attributes are inherited, the previous configuration is equivalent to the following:ip dhcp pool Marshost 172.16.2.254 mask 255.255.255.0hardware-address 02c7.f800.0422 ieee802client-name Marsdefault-router 172.16.2.100 172.16.2.101domain-name dns-server 172.16.1.102 172.16.2.102netbios-name-server 172.16.1.103 172.16.2.103netbios-node-type h-nodeCisco IOS IP and IP Routing Configuration GuideP1C-73Configuring DHCP Configuration ExamplesCisco IOS IP and IP Routing Configuration GuideP1C-74。
DHCP工作过程详解
DHCP动态主机配置协议的作用我想作为网管的兄弟们都应该知道了,这里我就不多废话了,今天我要谈的是DHCP的工作过程,了解了工作过程,要排除故障就容易了。
一、DHCP客户机初始化:1. 寻找DHCP Server。
当DHCP客户机第一次登录网络的时候(也就是客户机上没有任何IP地址数据时),它会通过UDP 67端口向网络上发出一个DHCPDISCOVER数据包(包中包含客户机的MAC地址和计算机名等信息)。
因为客户机还不知道自己属于哪一个网络,所以封包的源地址为0.0.0.0,目标地址为255.255.255.255,然后再附上DHCP discover的信息,向网络进行广播。
DHCP discover的等待时间预设为1秒,也就是当客户机将第一个DHCP discover 封包送出去之后,在1秒之内没有得到回应的话,就会进行第二次DHCP discover 广播。
若一直没有得到回应,客户机会将这一广播包重新发送四次(以2,4,8,16秒为间隔,加上1-1000毫秒之间随机长度的时间)。
如果都没有得到DHCP Server 的回应,客户机会从169.254.0.0/16这个自动保留的私有IP地址中选用一个IP地址。
并且每隔5分钟重新广播一次,如果收到某个服务器的响应,则继续IP租用过程。
2. 提供IP地址租用当DHCP Server监听到客户机发出的DHCP discover广播后,它会从那些还没有租出去的地址中,选择最前面的空置IP,连同其它TCP/IP设定,通过UDP 68端口响应给客户机一个DHCP OFFER数据包(包中包含IP地址、子网掩码、地址租期等信息)。
此时还是使用广播进行通讯,源IP地址为DHCP Server的IP地址,目标地址为255.255.255.255。
同时,DHCP Server为此客户保留它提供的IP地址,从而不会为其他DHCP客户分配此IP地址。
由于客户机在开始的时候还没有IP地址,所以在其DHCP discover封包内会带有其MAC地址信息,并且有一个XID编号来辨别该封包,DHCP Server响应的DHCP OFFER 封包则会根据这些资料传递给要求租约的客户。
DHCP Server问题排查
版权所有:杭州华三通信技术有限公司DHCPServer问题排查一、开始DHCPServer定位故障的思路是:先查DHCP的配置,再查看是否存在可用IP 地址,然后查看内部网络是否正常。
1、检查DHCP Server配置查看当前DHCP Server配置,主要包括使能DHCP,地址池配置。
命令:查看DHCP Server使能状态[H3C] display current-configuration查看DHCP Server地址池配置[H3C] display dhcp server tree all例如:通过命令查看,可以确认已使能DHCP;并配置了DHCP地址池vla n30,可分配的地址段为30.30.30.3-30.30.30.30.30,掩码为255.255.255.0,网关为30.30.30.1。
版权所有:杭州华三通信技术有限公司2、查看可用地址查看DHCP Server地址池是否有可用地址命令:display dhcp server free-ip例如:通过命令查看,可以确认30.30.30.5至30.30.30.30地址还未使用。
3、增加可用IP地址数量版权所有:杭州华三通信技术有限公司如DHCPServer地址池无可用地址,则可增加DHCP地址池的IP地址范围,以此增加该DHCP地址池的可用地址数量。
命令:network ip range min-address max-address注意配置的IP地址范围必须在指定的可分配网段范围内,否则该地址池无法分配IP地址。
network network-address [ mask-length | mask mask ]例如:通过命令查看,可以确认增加的IP网段30.30.30.3至30.30.30. 70地址还未使用。
4、查看内部网络如内部网络不存在DHCP中继,则可参考如下方法排查:确认PC与DHCP服务器之间是否可达PC配置一个与DHCP服务器同网段的IP地址(注意不要和其他地址冲突),然后使用PC来ping DHCP服务器,确认是否能够ping通。
DHCP Server
DHCP Server中文名DHCP服务器外文名DHCP Server职责当工作站登录进来时分配IP地址性质网络中管理DHCP标准的一台计算机概述DHCP Server :指在一个特定的网络中管理DHCP标准的一台计算机。
DHCP服务器的职责是当工作站登录进来时分配IP地址,并且确保分配给每个工作站的IP 地址不同,DHCP服务器极大地简化了以前需要用手工来完成的一些网络管理任务。
安装DHCP Server组件以Windows Server 2003系统为例介绍安装DHCP Server[1]服务组件的方法:第1步,在“控制面板”窗口中双击“添加或删除程序”图标,打开“添加或删除程序”窗口。
单击“添加/删除Windows组件”按钮。
第2步,打开“Windows组件向导”对话框,在“组件”列表中双击“网络服务”选项。
第3步,打开“网络服务”对话框,在“网络服务的子组件”列表中选中“动态主机配置协议(DHCP)”复选框。
依次单击“确定”→“下一步”按钮。
第4步,系统开始安装和配置DHCP服务组件,完成安装后单击“完成”按钮。
DHCP-IP定位方式DHCP 可以说是BOOTP 的增强版本,它分为两个部份:一个是服务器端,而另一个是客户端。
所有的IP 网络设定数据都由DHCP 服务器集中管理,并负责处理客户端的DHCP 要求;而客户端则会使用从服务器分配下来的IP环境数据。
比较起BOOTP ,DHCP 透过"租约" 的概念,有效且动态的分配客户端的TCP/IP 设定,而且,作为兼容考虑,DHCP 也完全照顾了BOOTP Client 的需求。
DHCP 的分配形式首先,必须至少有一台DHCP 工作在网络上面,它会监听网络的DHCP 请求,并与客户端搓商TCP/IP 的设定环境。
它提供三种IP 定位方式:Manual Allocation网络管理员为某些少数特定的Host绑定固定IP地址,且地址不会过期Automatic Allocation自动分配,其情形是:一旦DHCP 客户端第一次成功的从DHCP 服务器端租用到IP 地址之后,就永远使用这个地址。
配置DHCP服务器
配置DHCP服务器DHCP服务器的配置DHCP服务器(Dynamic Host Configuration Protocol server)是一种能够自动分配IP地址、子网掩码、默认网关等网络参数的设备或软件。
它可以减轻网络管理员的工作压力,提高网络管理效率。
本文将介绍如何配置DHCP服务器。
一、了解DHCP服务器在开始配置DHCP服务器之前,首先需要了解DHCP服务器的基本原理和作用。
DHCP服务器通过DHCP协议向客户端分配网络地址,从而实现自动化的网络配置。
DHCP服务器可以在局域网或广域网上提供IP地址的分配服务,以管理分配的IP地址、子网掩码、默认网关和DNS服务器的信息。
二、配置DHCP服务器1. 准备工作在配置DHCP服务器之前,需要先确认服务器本身是否获得了IP地址。
通常情况下,DHCP服务器需要手动配置一个静态IP地址以便其他设备能够与其通信。
2. 安装DHCP服务器软件在Linux服务器上,可以使用dhcpd软件来实现DHCP服务器的功能。
在Windows服务器上,可以使用Windows自带的DHCP管理工具来实现DHCP服务器的配置。
3. 配置DHCP服务器在Linux服务器上,可以通过修改/etc/dhcp/dhcpd.conf文件来实现DHCP服务器的配置。
在Windows服务器上,可以通过Windows自带的管理工具来配置DHCP服务器。
以下是一份样例配置文件:subnet 192.168.1.0 netmask 255.255.255.0 {range 192.168.1.100 192.168.1.200;option subnet-mask 255.255.255.0;option routers 192.168.1.1;option domain-name-servers 8.8.8.8, 8.8.4.4;default-lease-time 600;max-lease-time 7200;}以上配置文件中,subnet指定了子网地址,range指定了分配的IP 地址范围,option列出了分配的参数选项,default-lease-time表示默认租约时间(以秒为单位),max-lease-time表示最大租约时间(以秒为单位)。
DHCP SERVER与CLIENT的标准交互过程
DHCP SERVER与CLIENT的标准交互过程1、CLIENT首先发出广播的DHCPDISCOVER报文,广播的目的是让DHCP SERVER 能够收到这个请求报文。
在这个报文中,CLIENT可以在“选项”字段中加入“request paramter list”选项,表明自己想要获得的各种参数,而且四个IP 地址字段都必须为0。
2、由于DHCPDISCOVER报文是广播,那么所有的DHCP SERVER都能够收到,所有的DHCP SERVER都会响应一个DHCPOFFER报文,其中“你的IP地址”字段就是DHCP SERVER能够提供给CLIENT使用的IP地址,而且DHCP SERVER会把自己的IP地址放在“选项”字段中以便CLIENT区分不同的DHCP SERVER,发出此报文后,在DHCP SERVER上就会存在一个已分配IP地址的记录。
3、CLIENT能够收到所有的DHCPOFFER报文,但CLIEN只能处理其中的一个,一般的原则是CLIENT接收、处理最先收到的那个DHCPOFFER报文。
CLIENT会再发出一个广播的DHCPREQUEST报文,在“选项”字段中会加入选中的DHCP SERVER 的IP地址和用户想要的IP地址,之所以广播是因为要通知所有的DHCP SERVER 进行相应的处理。
4、DHCP SERVER收到DHCPREQUEST报文,判断“选项”字段中的DHCP SERVER 的IP地址是否与自己的地址相同,不相同,则不做任何处理,如果自己发出过DHCPOFFER报文,则清除相应IP地址记录;当“选项”字段中的DHCP SERVER 的IP地址是与自己的IP地址相同时,DHCP SERVER就会响应一个DHCPACK报文,其内容同DHCPOFFER类似,并在“选项”字段中增加了IP地址使用租期选项。
5、CLIENT收到DHCPACK报文后(经过上面的处理后,有且只有一个DHCPACK报文),会检查DHCP SERVER分配给自己的IP地址是否能够使用,如在以太网类型的网络中,CLIENT会发出免费的ARP请求来确定DHCP SERVER分配的IP地址是否已经被别人使用,如果可以使用,则CLIENT成功获得IP地址,并根据IP地址使用租期自动启动续延过程。
简述dhcp的工作流程。
简述dhcp的工作流程DHCP 的工作流程一共分为4个过程:发现阶段就是DHCP Client 寻找DHCP Server 的阶段,客户端广播一个DHCP Discover 消息,消息内包含着自身的MAC地址,以及想要请求的参数列表项、广播标志位等信息;而二层广播域中运行了DHCP Server服务的设备或者服务器,接收到该客户端发送的消息,会对DHCP Discover消息进行回复。
提供阶段DHCP Server向DHCP Client提供IP地址,每一个接收到DHCP Discover消息的DHCP Server都会从自己维护的地址池中选择一个合适的IP地址(DHCP服务ip地址分配顺序:MAC地址绑定的IP 地址>已使用的IP地址>空闲状态的IP地址>超过租期的IP地址>产生冲突的IP地址),并通过DHCP Offer消息将这个地址发送给对端DHCP Client。
选择阶段在网络中,客户自动获取地址,往往是“就近原则”,最快收到的哪台服务器的回复,哪台服务器将成为我们客户端的服务器;实现客户端对服务器一对一。
假设DHCP Client会在收到的若干个Offer消息,那么会根据“就近原则”来选择接受哪一个Offer。
通常情况下,会接受最先收到的那一个Offer。
假设客户端最先收到的消息来自于路由器R,客户端则会广播一个DHCP Request消息,目的是为了向路由器R(DHCP Server)发送请求,请求获取到发送给自己的DHCP Offer 中的IP地址,同时这个消息中带有“R”的标识,表示PC只愿意接受路由器R 下发的IP地址。
路由器R收到之后后,知道PC愿意接受自己的Offer,而其他DHCP Server收到这个带有R标记的消息后,就好比客户端有了自己的归属,其他人就应该学会放手。
其实很简单,当客户端有服务器给分配地址了,如果其他服务器还依旧给客户端分地址,很大程度很造成客户端频繁更换地址,地址出问题了,客户端不知道找谁好。
DHCP Server的地址分配与释放遵循着四个原则
DHCP Server的地址分配与释放遵循着四个原则。
通过这几个原则,对于分析DHCP Server地址分配问题大有裨益。
如下:
1、对于动态分配地址的情况,当一个MAC地址获取到DHCP Server分配的地址时,此分配的IP地址就会放到ip-in-use的表项中,默认情况下1天时间内,若此MAC下线或者没有及时续约,则此地址在MAC下线后就被放入过期池中,成为过期表项。
当此MAC再次上线申请时,若expired表中还有此MAC的记录,就会将这个地址再分给这个MAC;
2、对于一个新上线申请的MAC,设备会检查是地址池中是否还有可分配的地址,若有,则将IP地址最小的地址分配给此MAC,若没有则将过期池中的过期地址释放给此MAC,原则是将过期地址时间最长的那个地址分给此MAC;
3、对于一个新上线申请的MAC,若地址池中ip-in-used、expired、conflict、forbidden的总数已经达到DHCP Server的最大规格时,会将过期池中的过期地址释放给此MAC;
4、在地址池中仍有地址可分的情况下,过期池里的过期地址永远不会老化,只有一种情况会老化,即在当过期地址达到最大规格的4/5时,这时才会将过期池中时间最长的地址释放,即过期池中的过期表项数量不会超过最大规格的4/5。
DHCPServer软件使用教程
DHCPServer软件使⽤教程DHCP Server软件使⽤教程
前提⽹络环境配置
1. 电脑连接上wifi
2. ⽹络和共享中⼼中更改适配器,共享⽆线⽹卡给以太⽹⽹卡
3. ⼿动设置以太⽹⽹卡ipv4地址为192.168.1.1,⼦⽹掩码为255.255.255.0
正⽂(基本为图⽚)
⾸先以管理员权限打开 dhcpwiz.exe 这个软件
这⾥以太⽹的IP-Adress应显⽰为上⾯配置的192.168.1.1
这⾥点击⼀下Write INI file再下⼀步
这⾥依次点击Configure->Install-> Start,勾选Run DHCP server immediatly,如下图显⽰,点击完成
这是选择Continue as tray app,然后DHCP服务启动,右下⾓任务栏有图标显⽰
接着树莓派上电开机进⼊系统(耐⼼等⼀会⼉,开机要时间),然后⽤⽹线连接树莓派和电脑(多试⼏次,知道为什么要完全开机了没)
然后你会看到这个显⽰(这是Win10界⾯,不同的系统不同,就是⼀个系统通知
上图就是ip地址了
然后⽤Putty软件进⼊即可
后记
不使⽤DHCP Server之前记得关掉,然后恢复适配器的修改,不然作⼤死喔(笑脸。
Linux dhcp server
Page 13/20
常用选项介绍
ip地址 1:option routes ip地址 作用: 作用:为客户机指定默认网关 例如: 192.168.9.1; 例如:option routes 192.168.9.1; subnet2: option subnet-mask 子网掩码 作用: 作用:设定客户机的子网掩码 例如: subnet255.255.255.0; 例如:option subnet-mask 255.255.255.0; 3:option domain-name-servers ip地址 domain-nameip地址 作用:为客户端指定DNS DNS服务器地址 作用:为客户端指定DNS服务器地址 例如: domain-anme202.98.1.11; 例如:option domain-anme-servies 202.98.1.11;
Page 17/20
dhcp的启动与停止 的启动与停止
1:dhcp服务的启动 1:dhcp服务的启动 service dhcpd start /etc/rc.d/init.d/dhcpd start 2:dhcp服务的停止 2:dhcp服务的停止 service dhcp stop /etc/rc.d/init.d/dhcpd stop 3:dhcp服务的重新启动 3:dhcp服务的重新启动 service dhcpd restart /etc/rc.d/init.d/dhcpd restart
Page 19/20
应用案例
产品研发部有200台计算机,准备采用192.168.20.0/24网 产品研发部有200台计算机,准备采用192.168.20.0/24网 200台计算机 192.168.20.0/24 段给该部门使用,由于手动配置工和量较大, 段给该部门使用,由于手动配置工和量较大,所以管理员 准备使用一台Linux系统搭建DHCP服务器。其中路由器IP Linux系统搭建DHCP服务器 准备使用一台Linux系统搭建DHCP服务器。其中路由器IP 地址为192.168.20.1, 地址为192.168.20.1, DNS服务器IP地址为 服务器IP地址为192.168.20.2, DNS服务器IP地址为192.168.20.2, DHCP服务器为192.168.20.3, 服务器为192.168.20.3 DHCP服务器为192.168.20.3, 其它人使用192.168.20.30 192.168.254,子网掩码均为 192.168.20.30其它人使用192.168.20.30-192.168.254,子网掩码均为 255.255.255.0。 255.255.255.0。 部门经理所使用的IP地址固定IP192.168.20.88 IP地址固定IP192.168.20.88, 部门经理所使用的IP地址固定IP192.168.20.88,副经理 也使用固定IP地址192.168.20.66 IP地址192.168.20.66。 也使用固定IP地址192.168.20.66。
DHCP-server地址冲突的解决方法
DHCP-server地址冲突的解决方法现在的宾馆、酒店,在客户上网的时候,都会弹出一个对话框,显示一些提示,如上网的注意事项和消费标准等信息;并且有自己的电影和歌曲服务器,DHCP-server也是其中的一台服务器,宾馆、酒店就是用这台机器,为客户分配IP地址提供上网功能,即客户把自己的计算机连上网线,网卡配置自动获取IP 地址,就会从动态主机配置协议(DHCP)服务器分配到一个IP地址;采用DHCP server可以自动为用户设置网络IP地址、掩码、网关、DNS、Wins 等网络参数,简化了用户网络设置,提高了管理效率。
那么我们的问题也出现了:常见的,很多用户抱怨用这种方法上不了网,但不是所有客户都上不了网。
经过调查发现,住宾馆、酒店的人绝大多数是商务人员和工程师,他们携带的手提电脑一般安装的是Windows server版本,server 版本默认启动了DHCP server功能,当一台这样的计算机连入网络,在他之后的计算机就会把他当成DHCP服务器,并被分配了不正确的IP地址,从而上不了网。
DHCP服务器地址分配方式DHCP是一种用于简化主机IP配置管理的协议标准。
通过采用DHCP标准,可以使用DHCP服务器为网络上所有启用了DHCP的客户端分配、配置、跟踪和更改(必要时)所有TCP/IP设置。
此外,DHCP还可以确保不使用重复地址、重新分配未使用的地址,并且可以自动为主机连接的子网分配适当的IP地址。
当一个网络中,有2个或2个以上的DHCP服务器时,提醒切勿将DHCP地址池定义的过大,以免多个地址池之间出现“包含于”的关系,或者是部分客户端手工指定的IP地址包含于DHCP服务器的地址池中,从而造成DHCP的一些异常故障。
针对不同的需求,DHCP服务器有三种机制分配IP地址:自动分配 DHCP服务器给首次连接到网络的某些客户端分配固定IP地址,该地址由用户长期使用;动态分配DHCP服务器给客户端分配有时间限制的IP地址,使用期限到期后,客户端需要重新申请地址,客户端也可以主动释放该地址。
IPV6 DHCP server
作为服务器操作系统(网络操作系统)它的最大价值在于所提供的服务功能,DHCP服务器是服务器操作系统最基本的功能之一。
Windows Server 2008已经正式发布一段时间,在测试版时,我已经体验了IIS7。
从今天开始,我们要认真体验、感受微软的新一力作Windows server 2008。
需要注意的是:在Windows Server 2008中配置DHCP服务器角色,需要DNS服务器支持,如果网络中只有一台服务器,应该先把该服务器定义为DNS服务器角色。
“服务器管理器”工具是Windows Server 2008专为管理服务器功能而增加的。
Windows Server 2008用“角色”和“功能”来完成服务器的管理与配置,共有17个角色与35个功能。
可以从任务栏的“快速启动”栏、控制面版或者输入命令启动“服务器管理器”。
图一Windows Server 2008的服务器管理器一、定义DHCP服务器角色①在“服务器管理器”——“角色”中,单击“添加角色”命令。
图二②运行“添加角色向导”,在向导中选择“DHCP服务器”图三③对DHCP服务作一些简单介绍及配置DHCP服务器注意事项图四④网络连接绑定。
Windows Server 2008完全支持IPV6,其DHCP服务器可以提供IPV6IP地址的分配。
图五⑤指定DNS服务器设置图六⑥是否使用Wins服务器图七⑦建立DHCP作用域图八⑧配置DHCPv2的无状态模式图九由我们没有使用IPv6,因此要禁用DHCPv6的无状态模式⑨所有配置已经完成,开开始安装。
图十⑩安装进度与安装完成图十一图十二成功安装DHCP二、配置、管理DHCP服务器角色“开始”——“运行”中输入命令dhcpmgmt.msc,单独运行DHCP管理工具:图十三在“服务器管理器”中管理DHCP服务器图十四Windows Server 2008DHCP服务已经完全支持IPV6了。
找出局域网DHCPserver
最近工作中遇到一个IP冲突的事,同事的机器都是使用固定IP的形式使用局域网内IP,路
由器的DHCP也被禁用了。
,但经常有
同事早晨来上班,发现系统IP冲突了。
到底怎么回事呢,鉴于公司的业务关系,经常需要搭建一些虚拟机环境,说不定是哪台机器开启了DHCP server,充当了局域网内的DHCP服务。
如何找出开启了DHCP server服务的机器呢,详解如下:
看了下DHCP通讯的原理,大概知道这三点:使用的是UDP协议,端口是67(S)和68(C),没获取IP之前,广播地址用255.255.255.255.
先记住这几个知识点
下载个抓包工具,我使用的iptool
启动抓包,设置下过滤规则,
可以用协议过滤,只使用上面提到的UDP,还可以使用端口,68(因为你现在是在你的电脑抓包,即客户端),这样过滤就好找了。
过滤规则设置好,启动抓包,接着在局域网内找一台机器,windows,然后使用
自动获取IP来获取IP,(不行可以先禁用再启用网卡)这时就可以抓到如图所以的包了。
找了IP 172.18.2.0这台机器了,果真是开启了DHCP server 服务,而且还是windows系统的。
dhcp配置文件解释
4 DHCP高级服务器配置4.1 DHCP规划(1)小型网络DHCP服务器1)DHCP服务器硬件设备选择2)计算机IP获取方式规划(静态、动态)(2)大型网络DHCP服务器1)DHCP服务器位置:核心交换机2)DHCP服务器作用域设置:租约,台式和笔记本(3)跨路由网络DHCP服务器可以搭建一台DHCP服务器,同时在连接多个子网的路由器上设置DHCP中继代理就可以利用路由器转发DHCP消息,所有计算机能够通过DHCP服务器获取TCP/IP信息(4)80/20规则Failover peer “my” {Primary;Address4.2 DHCP多作用域设置(1)简单实现DHCP多作用域(2)DHCP超级作用域功能及实现关于超级作用域的配置,在dhcpd.conf配置文件中有固定格式shared-network 超级作用域名称{ #作用域名称,标示超级作用域[参数] #该参数对所有子作用域有效,可以不配置subnet 子网编号netmask 子网掩码{[参数][声明]}}修改dhcpd.conf配置文件,建立超级作用域并添加新作用域。
Ddns-update-style interim;Ignore client-updates;Shared-network super {Option domain-name-servers 192.168.1.1Option subnet-mask 255.255.255.0;Default-lease-time 21600;Max-lease-time 43200;Subnet 192.168.2.0 netmask 255.255.255.0 {Option router 192.168.2.1;Range dynamic-bootp 192.168.2.10 192.168.2.254; }Subnet 192.168.3.0 netmask 255.255.255.0 {Option router 192.168.3.1;Range dynamic-bootp 192.168.3.10 192.168.3.254; }}交换机配置:System-viewDhcp enableDhcp-server 1 ip a.b.c.dInterface vlan-interface 100Dhcp-server 1QuitInterface vlan-interface 200Dhcp-server 1QuitSave名称dhcpd.conf - dhcpd 配置文件描述dhcpd.conf 文件包括ISC DHCP的dhcpd的配置信息。
WinServer中DHCP服务的妙用
对于DHCP服务,大家都比较熟悉。
DHCP服务主要提供了地址分配功能,能够为加入网络的主机自动分配IP地址。
此外,DHCP服务还拥有一些特殊的功能。
例如在很多内部网络中,常常面临对非法接入进行管控的情况,一些外来的人员会将自己的笔记本等移动设备随意连入公司内网,利用DHCP服务器轻松地获取各种IP等网络参数,来非法访问内网资源或者连接Internet。
这样,很容易对网络安全造成威胁。
利用DHCP的管控功能,可以很轻松地化解以上问题。
使用DHCP策略,管控网络接入出于安全考虑,在企业内部是不允许员工私自将个人电脑接入内网的,管理员必须做到即使客户端非法接入,也要让其无法正常访问网络资源。
因此很多企业采用的都是三层网络架构,同时划分了不同的VLAN。
DHCP服务器一般单独部署,核心交换机都会开启DHCP中继服务,让每个VLAN中的主机都可以通过DHCP服务器来获取所需的网络参数。
当然,每个VLAN都必须设置默认的网关,其默认网关一般指向核心交换机的特定端口地址。
从这个角度考虑,如果VLAN中的客户端无法得到正确的网关地址,自然也就无法访问内网和外网资源了。
按照一般的处理方法,管理员会将合法主机的MAC地址和接入交换机的特定端口绑定。
这样,如果是来历不明的主机,自然无法接入网络。
但是该方法存在一定的弊端,例如有些员工工作部门不固定,会经常调动到其他部门,管理员必须根据情况随时调整交换机配置才可以应对。
其实,简单有效的方法是对DHCP服务器的部署策略进行调整,来灵活管控非法接入的情况。
在一般情况下,DHCP服务器是将默认用户类别作为管理标准,但是对默认用户类别并没有进行任何设置,当客户机利用DHCP服务自动获取网络参数时,用户类别标识项也没有进行任何设置。
当DHCP服务器和客户机进行通信时,DHCP服务器默认的用户类别的值和客户机分配得到的用户类别标识项是一致的。
之后DHCP服务器就可以为客户机分配合适的网络配置参数。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
DHCP server 实验文档
注意事项:首先为该服务器设定静态ip地址
前几步和搭建DNS _server差不多所以这边就不再做过多介绍,我们直接进入配置界面在下面界面中我们点击新建作用域
接下来我们要写一个名称来命名这个作用域,我这边就用sina来做model
写一个地址池的范围,配置一下长度和掩码,然后点击下一步
下面这个界面我们要注意了,因为这个是我们要保留的ip地址
一般默认是8天这边我们也不用去修改他,直接点击下一步
下面这个界面我们也可以点是,也可以点否,
作用域新建好了,但是我们需要激活这个作用域
激活以后,我们在客户端看一下是否可以获取到我们在这个地址池内的ip地址
我们发现这个地址不是在我们地址池范围内的ip地址,我们接下来释放一下ip重新获取一下ip地址,看看是否成功
这个ip地址是在我们的ip地址池内,但是我们也不能确定就是我们的地址池发放的我们需要在地址池内查找一下是否相符合
经过核对我们已经成功搭建了一个dhcp server。