普通、こんな事を考えるヤツはまずいない。
☆DHCPサーバーなんて1台で充分や!
これは、だいたいネットワークの世界では共通です。
もしも、2台のDHCPサーバーを同じセグメント(192.168.x.y)に立てると、IPアドレスをもらう側が「どっちのサーバーを確認すればええんや!」と怒りまくって取れなくなります。
そもそも論として、一般家庭でDHCPサーバーを立てるのはだいたい変態です(笑)
普通は、CTUやONU、ルーターから「自動的に配布する。」が正解なんですよ。
ただね、いちいち一台ずつIPアドレスを振り直したりすると、複合機がある日IPアドレスがコロッと変わって「印刷できない!」と言う事象が万に一つあるんですよ。
「万に一つ」なのだから、うちは大丈夫だな。と思うでしょう。
そういう人は、この記事を読む必要は全くありません。
ここから先は、興味本位のある人のみお読みください。
過去に何度はこのブログで記事にしてきましたが、Linuxの時代からDHCPサーバーを構築していまして、複合機を含めて家電製品のありとあらゆるものや、PCや一部のスマホについては、MACアドレスが固定化されているので、そのMACアドレスからこのIPアドレスを割り当てる!と言う事をしているのです。
これの何が良いのかというと、家電製品や複合機で「固定のIPアドレス振りたいな~。」と言うとき、いちいち面倒くさいじゃないですか。それこそ、Autoにしておくのがデフォルトだと思います。
それで、最初にダミーのIPアドレスを払い出して、OPEN DHCP Server の管理画面からMACアドレスをコピーして、こいつは、192.168.0.101!とか固定に設定するのです。
Autoの場合、DHCPサーバーの設定にも因りますが一定時間がたつとそのIPアドレスをリリース返却するんですよ。
それで、誰もいなかったら同じIPアドレスが割り振られるのですが、ふと割込が入ると空いている次のIPアドレスを割り当てて、「次は、192.168.0.102!」に変わることが稀にあります。
これが「万に一つ」です。
そう言うことをしないようにするのがDHCPサーバーの役割の一つです。
設定については、こちら、こちらとこちらを参照していただくとして、いよいよ本題のセカンダリーの構築です。
何で2台?と言うのはですね、このDHCPサーバーに慣れきったある日、次々と家電製品やスマホのネットが使えなくなってきたんです。
その時は、PC本体の故障と思っていなかったのですが、故障に気付いたのは3日後くらいなんです。
と言うのも、うちのDHCPサーバーに割り当てるIPアドレスの返却時間を3日間に設定しているのです。
家電製品一斉にネットが使えなくなるなら分かるのですが、真綿でクビを絞めるように死んでいったので、特定するのに時間がかかったんですよ(苦笑)
それで、そう言うことが起きないようにするために、2台目のDHCPサーバーを構築する決意をしたんです。
IT業界で言うと、「冗長化」と言います。
片方が壊れても片方が動いているので、継続してネットが使えるんですよ。
じゃぁ、どうやって故障したか判断するのか。
それはだいたい、コマンドプロンプトからpingを打って返ってこなかったら本体の故障を疑うことが出来ます。
「Request Time out...」みたいなメッセージ。
あと、OPEN DHCP Server にはWeb監視画面がありまして、こんな感じで見ることが出来ます。(セキュリティーのため一部隠しています。)
【Primary】

【Secondly】

どうです?Serverの項目にどちらから払い出されたか一目瞭然でしょ。
これが片方に寄ったら、どちらかが故障していることが分かります。
そして、セカンダリー(192.168.0.253)サーバーの設定値はこんな感じ。(赤字部分が修正箇所)
こんな感じです。
最近のスマホや無線LANは、MACアドレスを隠す機能が付いているので、そういう場合はゲストIPアドレスで良いと思います。
50個くらい確保しておけば良いでしょう。
必要に応じて、サブネットマスクを拡張して、ゲストIPアドレスは全く違うセグメントに割り振るのもありかもしれませんね。
参考になりましたかね?
構築時の注意点
これは私が沼にハマったので、絶対に気をつけてほしいので書いておきます。
・OPEN DHCP Server のバージョンを出来るだけ同じにしておくこと
⇒異なるバージョンだと互いに衝突して機能しませんでした。。。
・セカンダリーを動かすときは、いったんプライマリー側のサービスを停止して1日経過してからプライマリー側のサービスを再開すること
⇒何故か分からないのですが、同じバージョンにしてもお互いがIPアドレスを払出あって、要求する側が断念するという事象が起きました。
この2点を守れば、あとは大丈夫でしょう。
はい。
記事を評価してください(★1つ=悪い、★5つ=良い) この記事の平均評価:



(33人)
☆DHCPサーバーなんて1台で充分や!
これは、だいたいネットワークの世界では共通です。
もしも、2台のDHCPサーバーを同じセグメント(192.168.x.y)に立てると、IPアドレスをもらう側が「どっちのサーバーを確認すればええんや!」と怒りまくって取れなくなります。
そもそも論として、一般家庭でDHCPサーバーを立てるのはだいたい変態です(笑)
普通は、CTUやONU、ルーターから「自動的に配布する。」が正解なんですよ。
ただね、いちいち一台ずつIPアドレスを振り直したりすると、複合機がある日IPアドレスがコロッと変わって「印刷できない!」と言う事象が万に一つあるんですよ。
「万に一つ」なのだから、うちは大丈夫だな。と思うでしょう。
そういう人は、この記事を読む必要は全くありません。
ここから先は、興味本位のある人のみお読みください。
過去に何度はこのブログで記事にしてきましたが、Linuxの時代からDHCPサーバーを構築していまして、複合機を含めて家電製品のありとあらゆるものや、PCや一部のスマホについては、MACアドレスが固定化されているので、そのMACアドレスからこのIPアドレスを割り当てる!と言う事をしているのです。
これの何が良いのかというと、家電製品や複合機で「固定のIPアドレス振りたいな~。」と言うとき、いちいち面倒くさいじゃないですか。それこそ、Autoにしておくのがデフォルトだと思います。
それで、最初にダミーのIPアドレスを払い出して、OPEN DHCP Server の管理画面からMACアドレスをコピーして、こいつは、192.168.0.101!とか固定に設定するのです。
Autoの場合、DHCPサーバーの設定にも因りますが一定時間がたつとそのIPアドレスをリリース返却するんですよ。
それで、誰もいなかったら同じIPアドレスが割り振られるのですが、ふと割込が入ると空いている次のIPアドレスを割り当てて、「次は、192.168.0.102!」に変わることが稀にあります。
これが「万に一つ」です。
そう言うことをしないようにするのがDHCPサーバーの役割の一つです。
設定については、こちら、こちらとこちらを参照していただくとして、いよいよ本題のセカンダリーの構築です。
何で2台?と言うのはですね、このDHCPサーバーに慣れきったある日、次々と家電製品やスマホのネットが使えなくなってきたんです。
その時は、PC本体の故障と思っていなかったのですが、故障に気付いたのは3日後くらいなんです。
と言うのも、うちのDHCPサーバーに割り当てるIPアドレスの返却時間を3日間に設定しているのです。
家電製品一斉にネットが使えなくなるなら分かるのですが、真綿でクビを絞めるように死んでいったので、特定するのに時間がかかったんですよ(苦笑)
それで、そう言うことが起きないようにするために、2台目のDHCPサーバーを構築する決意をしたんです。
IT業界で言うと、「冗長化」と言います。
片方が壊れても片方が動いているので、継続してネットが使えるんですよ。
じゃぁ、どうやって故障したか判断するのか。
それはだいたい、コマンドプロンプトからpingを打って返ってこなかったら本体の故障を疑うことが出来ます。
「Request Time out...」みたいなメッセージ。
あと、OPEN DHCP Server にはWeb監視画面がありまして、こんな感じで見ることが出来ます。(セキュリティーのため一部隠しています。)
【Primary】

【Secondly】

どうです?Serverの項目にどちらから払い出されたか一目瞭然でしょ。
これが片方に寄ったら、どちらかが故障していることが分かります。
そして、セカンダリー(192.168.0.253)サーバーの設定値はこんな感じ。(赤字部分が修正箇所)
#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.253 ←応答許可しておく
[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.254
Secondary=192.168.0.253 ←;を外す
[HTTP_INTERFACE]
#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.253: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
;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.191-192.168.0.240
;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=3600
[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=8.8.8.8, 192.168.0.11
Router=192.168.0.11
#AddressTime is default lease time for server
#specify 0 for infinity lease time
AddressTime=259200
;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
;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
;NTPServers=192.168.116.1, 192.168.126.1, 192.168.136.1
;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
;POP3Server=192.168.0.1
;NNTPServer=192.168.0.1
;WWWServer=192.168.0.1
;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
;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].
#####
#
# 複合機系
#
#####
#
[11:22:33:44:55:66]
IP=192.168.0.101
[aa:bb:cc:dd:ee:ff]
IP=192.168.0.102ここは必要に応じて作成する。
こんな感じです。
最近のスマホや無線LANは、MACアドレスを隠す機能が付いているので、そういう場合はゲストIPアドレスで良いと思います。
50個くらい確保しておけば良いでしょう。
必要に応じて、サブネットマスクを拡張して、ゲストIPアドレスは全く違うセグメントに割り振るのもありかもしれませんね。
参考になりましたかね?
構築時の注意点
これは私が沼にハマったので、絶対に気をつけてほしいので書いておきます。
・OPEN DHCP Server のバージョンを出来るだけ同じにしておくこと
⇒異なるバージョンだと互いに衝突して機能しませんでした。。。
・セカンダリーを動かすときは、いったんプライマリー側のサービスを停止して1日経過してからプライマリー側のサービスを再開すること
⇒何故か分からないのですが、同じバージョンにしてもお互いがIPアドレスを払出あって、要求する側が断念するという事象が起きました。
この2点を守れば、あとは大丈夫でしょう。
はい。
記事を評価してください(★1つ=悪い、★5つ=良い) この記事の平均評価:




