Open DHCP Server for Windows
-- 2015-08-29 Saturday
#From 2) to 6), requests from diffent Interfaces look for matching DHCP ranges。
ツイート
#From 2) to 6), requests from diffent Interfaces look for matching DHCP ranges。
ツイート
先程も書いたように、自宅サーバーが壊れてしまい、色々と不都合が続いています。
その中でも一番困っているのは、DHCPサーバー。
極一般家庭では、あまり気にしないところです。
たいていは、ルーターが自動割り当てしています。
我が家でも来客がネットをする為に、50個払い出すように設定しています。
それ以外は、固定IPアドレスを割り当てています。
でも、いちいち、ここのマシンや機器にネットワーク設定をするのは面倒くさいので、Macアドレスだけ取得して、それを元に固定IPアドレスを割り当てています。
そうしないと、ファイル共有やネットワークプリンタがコロコロIPアドレスが変わると何かと不自由だからです。
こうすれば、どのIPアドレスが何を使っているか追跡調査できます。(普通そこまでやっていませんが。)
で、Linuxの時はDHCPサーバーをインストールして、「○○のMacアドレスが来たら、このIPアドレスを割り当てる。」定義ファイルを作っていました。
ここ数年は、自宅サーバー更改しても定義ファイルをコピーしておしまいでした。
で、前置きが長かったのですが、どっぷりLinuxでDHCPサーバーを構築していたので、Windows版については完全に疎いのです。
たいてい、Windows Serverがその役割をしていますので、開発も殆ど無かったのでしょう。
Windows 7や8、8.1、10についてのソフトウェアをさがしたのが、この「Open DHCP Server」というソフトウェアです。
このサイトは、完全英語サイトですがコツさえ掴めば、設定は殆ど難しくありません。
それを紹介したいと思います。
日本語の紹介サイトはこちら。
でも、設定は完全英語です。と言うかシンプルです。
インストールは画面はシンプル。



さて、問題は設定・・・
と、その前に、自身のIPアドレスを固定にしておこう。
そうしておかないと、矛盾が起きてしまうからだ。DHCPサーバーのIPアドレスがコロコロ変わってしまっては、色々と問題があるのだ。
現実世界を例えるならば、自分の家の番地が一定周期で変わる理屈である。これでは、郵便物や宅配物が届かなくなってしまう。
ここでは、
デフォルトゲートウェイ(LANからWANへ行くためのIPアドレス)を192.168.0.1
DHCPサーバーを192.168.0.254
にしています。
例のごとく、設定すべき点を赤字で示します。
これで完了。あとは、起動するだけだ。その前に、他にDHCPサーバーがあれば止めておこう。

上記の画面はWindows10である。①が上記の設定画面。②がDHCPサーバー開始である。
②は、コマンドプロンプトが立ち上がる。終了させるときは、そのまま×ボタンを押せば良い。
Windowsの場合、定期的にアップデートがあり再起動を要求される。
その為、絶対に固定IPアドレスにする機器やサーバーがあれば、それは、IPアドレス自動取得の設定するのでは無く、最初から固定に設定することは言うまでも無い。
記事を評価してください(★1つ=悪い、★5つ=良い) この記事の平均評価:



(7人)
その中でも一番困っているのは、DHCPサーバー。
極一般家庭では、あまり気にしないところです。
たいていは、ルーターが自動割り当てしています。
我が家でも来客がネットをする為に、50個払い出すように設定しています。
それ以外は、固定IPアドレスを割り当てています。
でも、いちいち、ここのマシンや機器にネットワーク設定をするのは面倒くさいので、Macアドレスだけ取得して、それを元に固定IPアドレスを割り当てています。
そうしないと、ファイル共有やネットワークプリンタがコロコロIPアドレスが変わると何かと不自由だからです。
こうすれば、どのIPアドレスが何を使っているか追跡調査できます。(普通そこまでやっていませんが。)
で、Linuxの時はDHCPサーバーをインストールして、「○○のMacアドレスが来たら、このIPアドレスを割り当てる。」定義ファイルを作っていました。
ここ数年は、自宅サーバー更改しても定義ファイルをコピーしておしまいでした。
で、前置きが長かったのですが、どっぷりLinuxでDHCPサーバーを構築していたので、Windows版については完全に疎いのです。
たいてい、Windows Serverがその役割をしていますので、開発も殆ど無かったのでしょう。
Windows 7や8、8.1、10についてのソフトウェアをさがしたのが、この「Open DHCP Server」というソフトウェアです。
このサイトは、完全英語サイトですがコツさえ掴めば、設定は殆ど難しくありません。
それを紹介したいと思います。
日本語の紹介サイトはこちら。
でも、設定は完全英語です。と言うかシンプルです。
インストールは画面はシンプル。



さて、問題は設定・・・
と、その前に、自身のIPアドレスを固定にしておこう。
そうしておかないと、矛盾が起きてしまうからだ。DHCPサーバーのIPアドレスがコロコロ変わってしまっては、色々と問題があるのだ。
現実世界を例えるならば、自分の家の番地が一定周期で変わる理屈である。これでは、郵便物や宅配物が届かなくなってしまう。
ここでは、
デフォルトゲートウェイ(LANからWANへ行くためのIPアドレス)を192.168.0.1
DHCPサーバーを192.168.0.254
にしています。
例のごとく、設定すべき点を赤字で示します。
#This is configuration file.
#Any entry starting with a punctuation character will be a comment
#This file should be in the same folder where exe file is.
#You need to remove ; from begining of sample values and replace with
#your own values below if you need change settings
[LISTEN_ON] ⇒特に設定項目なし
#Specify the Interfaces you would like Server to listen
#if you have more than one NIC card on your server
#always specify which cards will listen DHCP/DNS requests
#Requests from diffent Interfaces look for matching DHCP ranges.
#Requests from relay agents look for matching range to relay agent IP.
#upto 125 interfaces can be specified
#Default is All static Interfaces
;192.168.0.1
[LOGGING] ⇒ログの取得レベル
#LogLevel can be set as None, Errors or All
#It is advisable to keep logging to Normal, Normal include errors
#and DHCP renewal messages. Normal is defaul logging also.
;LogLevel=None
;LogLevel=Normal
LogLevel=All ⇒これにした方がベター。何か起きたときの調査に役立つため。特に不正アクセスの場合はね。
;LogLevel=Debug
[REPLICATION_SERVERS] ⇒特に設定する項目無し
#You can have 2 instances of Open DHCP Servers in a network. Open DHCP Server
#will send replication inform messages to other instance of Open DHCP
#server and leases will be replicated. The IP address alloted by one server
#will not be realotted by other server to another host. Also when one server
#goes down, other can will renew the leases, without NAK and DISCOVER. You need
#to specify Primary and secondary servers for replication to work.
#Make sure that Primary & Secondary Server entries are identical on both
#servers. You may copy the entire ini file on both servers and change the
#LISTEN_ON on individual servers, if needed.
;Primary=192.168.0.253
;Secondary=192.168.0.254
[HTTP_INTERFACE] ⇒動作状況やIP払出状況を確認するためのhttpサーバ設定
#This is http inerface for viewing lease status,
#Default is first interface, port 6789
#You can change it here to any network interface.
HTTPServer=192.168.0.254:6789 ⇒インストールしたPCに6789ポート設定
#Also to limit the clients access, you can specify upto 8
#HTTP client IPs Here. If no Client IP is specified then All
#Clients can access the HTTP Interface
;HTTPClient=192.168.0.11 ⇒ 特定のPCのみ許可するための設定
;HTTPClient=192.168.23.123 ⇒ 複数ある場合はこの様に増やしていく
#You can also change the title of html page
;HTTPTitle=This is Custom Title
#Sections below are other DHCP Sections. Clients can be alotted addresses in
#two ways, dynamically from DHCP Range or statically. For static addresses,
#client section needs to be created for each static client
#against its MAC Address. BOOTP clients are allways static.
#The DHCP Ranges are grouped into [RANGE_SET]s, so that range specific options
#can be specified for a group of ranges at one place. The total ranges together
#in all [RANGE_SET]s is also 125 and there can also be 125 [RANGE_SET]s max.
#You can specify one or more ranges in each [RANGE_SET] section, in format
#specified. Open DHCP Server will alot addresses from these ranges. Static Hosts
#and BootP clients do not need ranges. No need to specify any [RANGE_SET]
#or DHCP_Range if all clients are Static.
#The Policy for alloting dynamic address is:-
#1)First Look if MacAddress is specified as Static DHCP Client and use that IP
#2)If not found look for old expired/active address of same host
#3)If not,look at requested IP Address and it is free
#4)If not, allot virgin IP Adress, if any available
#5)If no virgin IP address exists, allot expired IP address of other host.
#From 2) to 6), requests from diffent Interfaces look for matching DHCP ranges
#of Interface IP and requests from relay agents look for matching range to
#relay agent IP.
#All the ranges in a [RANGE_SET] section can be further restricted
#by Filter_Mac_Range, Filter_Vender_Class and Filter_User_Class
#If for example Mac Range is specified, then this section's ranges
#will only be available to hosts, whoes Mac Address
#Falls in this range. Also if any host has matching Filter_Mac_Range in
#any DHCP_RANGE section then other DHCP Range sections
#without Filter_Mac_Range or not having matching Mac Range will
#not be available to it. Each Manufacturer has a fixed Mac Range.
#Same Mac ranges can repeat in many DHCP_RANGE sections.
#For Filter_Vendor_Class (option 60) and Filter_User_Class filter (option 77),
#the range would only be available to matching value of Filter_Vender_Class
#and Filter_User_Class sent in client request. If Filter_Vender_Class and
#Filter_User_Class do match in one or more ranges, other ranges with missing
#or not matching values would not be available to such clients.
#You can specify upto 32 Filter_Mac_Range, Filter_Vender_Class and
#Filter_User_Class in each [RANGE_SET].
#Generally you dont have to specify any filters for relay agent. The range is
#automatically selected based on relay agent IP and range's subnetmask. Relay agent
#always sends it's subnet side IP. This server would only use the DHCP Range, which
#matches this IP. This would ensure that correct range is used. This feature
#eliminate the need of additional configuration. For matching purpose, range is
#recalculated using Subnet Mask of range and Relay Agent IP. However if you want
#to manually configure the subnet selection, you can use FilterSubnetSelection in
#a RANGE_SET. If this fitler is specified it will be first matched with SubnetSelection
#Option 118 sent by client. If client sends no such option, it will be matched
#with relay Agent IP. If not relay agent IP is sent, Listening Interface's IP
#will be matched. You can also override the Target Relay Agent using TargetRelayAgent option.
[RANGE_SET] ⇒ 自動で与える設定エリア
#This is first and simple DHCP range section example,
#This example may be good enough for simple/home use.
#If you need range filters, look at example below
DHCPRange=192.168.0.51-192.168.0.100 ⇒ こうすれば、192.168.0.51から50個払い出される。設定した方が良い。
;DHCPRange=192.168.5.1-192.168.5.254
#Following are range specific DHCP options.
#You can copy more options names from [GLOBAL_OPTIONS]
;SubnetMask=255.255.255.0
;DomainServer=192.168.55.252
Router=192.168.0.1
#Lease Time can be different for this Range
;AddressTime=360
[RANGE_SET] ⇒ 複数ある場合は同じようにセットしていく
#This section is also simple [RANGE_SET] section
#Here the options are specified as flat options.
;DHCPRange=192.168.0.1-192.168.0.254
;DHCPRange=192.168.4.1-192.168.4.254
;DHCPRange=192.168.5.1-192.168.5.254
#Following are flat range specific DHCP options.
#SubnetMask below
;1=255.255.255.0
#DomainServers below
;6=192.168.0.1, 192.168.0.2
#Router
;3=192.168.0.1
#AddressTime
;51=11000
[RANGE_SET]
#This is filtered [RANGE_SET] section.
#First eight entries in this example are filters.
#Currently only following types of filters are supported
#However 32 filters of each type can be specified
;FilterMacRange=00:0d:60:c5:4e:00-00:0d:60:c5:4e:ff
;FilterMacRange=00:0e:12:c5:4e:00-00:0e:12:c5:4e:ff
;FilterMacRange=00:0f:60:c5:4e:a1-00:0f:60:c5:4e:a1
;FilterVendorClass="MSFT 5.0"
;FilterVendorClass="MSFT 5.1"
;FilterVendorClass="MSFT 5.2"
;FilterUserClass="My User Class 4.0"
;FilterUserClass=123,56,87,123,109,0,23,56,156,209,234,56
;FilterUserClass=00:0d:60:c5:4e:0d:60:c5:4e
#You can select RANGE_SET based on FilterSubnetSelection
;FilterSubnetSelection=192.168.55.1
;FilterSubnetSelection=192.168.33.1
;TargetRelayAgent=192.168.44.11
#Next few are actual ranges of this section.
;DHCPRange=10.0.0.5-10.0.0.10
;DHCPRange=10.0.10.1-10.0.10.254
;DHCPRange=10.0.1.1-10.0.1.254
;DHCPRange=10.0.2.1-10.0.2.254
#Following are range specific DHCP options.
#You can copy more option names from [GLOBAL_OPTIONS]
#or add flat options like 240="this is the string value"
#or as IP like 6=192.168.5.1
#or byte array like 6=123,45,1,0,3,67,4,3,22,4,3,5
#or hex array like 6=23:89:a5:ba:a9:e4
;SubnetMask=255.255.255.0
;DomainServer=10.5.6.90, 11.4.5.6
;Router=11.5.6.7, 10.0.99.1
#AddressTime can be different for this range
#specify 0 for infinity.AddressTime
;AddressTime=360
;Ethernet=no
;NETBIOSNameSrv=192.168.0.201
#You can also use hex array or byte array with named options
#If you want to send option 43 back to client for
#ranges in this section, specify it as flat option like:-
;43="this is return string"
#or use the byte array in value
;43=123,56,87,123,109,0,23,56,156,209,234,56
#or use the hex array in value
;43=a6:87:b6:c9:ae:eb:89:09:a4:67:d5
[GLOBAL_OPTIONS] ⇒ グローバル設定。必須です。
#These are global DHCP Options and would supplement
#client specific options and [RANGE_SET] options.
#Options tags start with 1 and goes up to 254, you can
#always specify option like 1=255.255.255.0, but it may
#be difficult to remember option tags. Try using Option Names
#If no matching name found, you can use tag=value (flat options)
#You can also specify the value as byte array or even hex array.
#Some options having sub-options can only be specified as hex/byte
#array If options have client specific values, move/copy them
#to specific Static Client's section. If any option has DHCP range
#specific value, move/copy them to [RANGE_SET] sections.
#You may quote stings values (must quote if sting contain chars
#like comma, dot or colon) for example NDS_Tree_Name="my.NDS.Tree"
#or 43="this is return string" or use the byte array in value
#like 43=123,56,87,123,109,0,23,56,156,209,234,56 or use the hex
#array in value 43=a6:87:b6:c9:ae:eb:89:09:a4:67:d5
;DomainName="workgroup.com" ⇒ ドメイン名があればセットする
SubNetMask=255.255.255.0 ⇒ サブネットマスク。通常はこれ。
DomainServer=192.168.0.1, 8.8.8.8 ⇒ DNS設定。これが無いとインターネットに繋ぐことは出来ない。192.168.0.1はCTUのファーストアドレス。8.8.8.8はGoogle Public DNSでセカンドアドレス。分からなかったらGoogle Public DNSだけカットしても良い。
Router=192.168.0.1 = ルーター…デフォルトゲートウェイと考えたら良いかな?上記のDmainServerのファーストアドレスと同じ
#AddressTime is default lease time for server
#specify 0 for infinity lease time
;AddressTime=36000
;RenewalTime=0
;RebindingTime=0
#NextServer is PXEBoot TFTP Server
;NextServer=192.168.0.1
;TimeOffset=3000
;TimeServer=192.168.0.1
;NameServer=192.168.0.1
;LogServer=192.168.0.1 ⇒ LOGサーバー。Syslogだと思う。
;QuotesServer=192.168.0.1
;LPRServer=192.168.0.1
;ImpressServer=192.168.0.1
;RLPServer=192.168.0.1
;BootFileSize=2345
;SwapServer=192.168.0.1
;RootPath=/opt/boot/
;ExtensionFile=bootdir/files
;ForwardOn/Off=yes
;SrcRteOn/Off=yes
;PolicyFilter=192.168.34.1/255.255.255.240
;DefaultIPTTL=234
;MTUTimeout=3453
;MTUPlateau=ac:c0:12:09:02:24:0a:4D:61:63:20:48:44:5F:4E:42:53
;MTUInterface=23553
;MTUSubnet=yes
;BroadcastAddress=192.168.0.255
;MaskDiscovery=yes
;MaskSupplier=yes
;RouterDiscovery=yes
;RouterRequest=192.168.67.1
;StaticRoute=192.168.11.1/255.255.255.0, 192.168.12.1/255.255.255.0
;Trailers=yes
;ARPTimeout=3453
;Ethernet=yes
;DefaultTCPTTL=21
;KeepaliveTime=120
;KeepaliveData=yes
;NISDomain=my.nis.domain
;NISServers=192.168.110.1, 192.168.120.1, 192.168.130.1 ⇒ NISサーバー。特に設定する必要なし
;NTPServers=192.168.116.1, 192.168.126.1, 192.168.136.1 ⇒ NTPサーバー。特に設定する必要なし
;NETBIOSNameSrv=192.168.5.1
;NETBIOSDistSrv=192.168.5.1
;NETBIOSNodeType=8
;NETBIOSScope=NETBIOS.COM
;XWindowFont=192.168.0.1
;XWindowManager=192.168.0.1
;NetwareIPDomain=NETWAREDOMAIN.COM
;NetWareIPOption=123,7,0,45,234,20,27,167,198,34,112,45
;NISDomainName=NISDOMAINNAME.COM
;NISServerAddr=192.168.0.1
;TFTPServerName=MyTFTPServer
;BootFileName=BootFileName.ini
;BootFileOption=BootFileOption.ini
;HomeAgentAddrs=192.168.0.1
;SMTPServer=192.168.0.1 ⇒ SMTPサーバー。設定する必要なし。
;POP3Server=192.168.0.1 ⇒ POP3サーバー。設定する必要なし。
;NNTPServer=192.168.0.1
;WWWServer=192.168.0.1 ⇒ Webサーバー。設定する必要なし。
;FingerServer=192.168.0.1
;IRCServer=192.168.0.1
;StreetTalkServer=192.168.0.1
;STDAServer=192.168.0.1
;NDSServers=192.168.0.1
;NDSTreeName="myNDSTree"
;NDSContext=NewContext
;LDAP="ldap://192.168.1.1" ⇒ LDAPサーバー。設定する必要なし。
;AutoConfig=yes
;NameServiceSearch=23,0,235,4,2,0,236,7,94,34,87,4,127,254,23
;SubnetSelectionOption=255.255.255.240
#Option TFTPServerIPaddress is for phone use only, for PXEBoot use NextServer option
;TFTPServerIPaddress=192.168.4.1
;CallServerIPaddress=192.168.0.1
;DiscriminationString=""
;RemoteStatisticsServerIPAddress=192.168.50.1
;HTTPProxyPhone=192.168.51.1
;IPTelephone="MCIPADD=10.10.0.1,MCPORT=1719,TFTPSRVR=10.10.0.254,TFTPDIR=,VLANTEST=0"
#next few are sample flat option, (global mac boot options)
#option mac-version
;230=00:00:00:00
#option mac-nb-img
;234=ac:11:00:09:02:24:0a:4D:61:63:20:48:44:5F:4E:42:53:00:00:00:0:02:1b:53:68:61:72:65:64:49:6D:61:67:65:73:00:4E:65:74:42:6F:6F:74:20:48:44:2E:69:6D:67
#option mac-apps-img
;235="\opt\isv\boot\bootimage.bin"
#Following sections are Static Client DHCP entries/options
#If no IP is given, then that host will never be allooted any IP
#More option Names can be copied from DHCP-OPTIONS to clients.
#For BOOTP requests, only these options would be sent.
#For DHCP requests. Missing Options will be supplimented from
#first [DHCP-RANGE] options (if IP falls in any range), other
#options will be supplemented from [DHCP-OPTIONS].
#--------ここからMacアドレスからIPアドレスを割り当てる方法
# hogehoge ⇒ コメント。コンピューター名とか
[00:11:22:33:44:55] ⇒ MACアドレスを記入
IP=192.168.0.11 ⇒ 割り当てたいIPアドレスを記入
# mogmog ⇒ コメント。コンピューター名とか
[aa:bb:cc:dd:ee:ff] ⇒ MACアドレスを記入
IP=192.168.0.12 ⇒ 割り当てたいIPアドレスを記入
#--------以降、複数あれば同様に付加していく
これで完了。あとは、起動するだけだ。その前に、他にDHCPサーバーがあれば止めておこう。

上記の画面はWindows10である。①が上記の設定画面。②がDHCPサーバー開始である。
②は、コマンドプロンプトが立ち上がる。終了させるときは、そのまま×ボタンを押せば良い。
Windowsの場合、定期的にアップデートがあり再起動を要求される。
その為、絶対に固定IPアドレスにする機器やサーバーがあれば、それは、IPアドレス自動取得の設定するのでは無く、最初から固定に設定することは言うまでも無い。
記事を評価してください(★1つ=悪い、★5つ=良い) この記事の平均評価:





コメント
コメントする
この記事のトラックバックURL
http://www.sir-2.net/dablg/tb.php/5162
トラックバック