【IT系】kvm上のCentOS6.5でdhcpサーバを構築してみた。

インフラエンジニア教本 ~ネットワーク構築技術解説 (Software Design 別冊)
- 作者: 編集部
- 出版社/メーカー: 技術評論社
- 発売日: 2014/12/05
- メディア: 大型本
- この商品を含むブログ (1件) を見る
これを基に、dhcpサーバの構築をしてみました。
まずは、dhcpをインストールする。
$ sudo yum install dhcp ---------中略---------- ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: dhcp x86_64 12:4.1.1-43.P1.el6.centos base 819 k Installing for dependencies: portreserve x86_64 0.0.4-9.el6 base 23 k Updating for dependencies: dhclient x86_64 12:4.1.1-43.P1.el6.centos base 318 k dhcp-common x86_64 12:4.1.1-43.P1.el6.centos base 143 k Transaction Summary ================================================================================ Install 2 Package(s) Upgrade 2 Package(s) Total download size: 1.3 M Is this ok [y/N]: y ---------中略---------- Installed: dhcp.x86_64 12:4.1.1-43.P1.el6.centos Dependency Installed: portreserve.x86_64 0:0.0.4-9.el6 Dependency Updated: dhclient.x86_64 12:4.1.1-43.P1.el6.centos dhcp-common.x86_64 12:4.1.1-43.P1.el6.centos Complete!
ここで、自動起動をonにする。起動時にIPアドレスを割り当てられるようにね。
$ chkconfig --list dhcpd
dhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
$ sudo service dhcpd start
dhcpd を起動中: [失敗]
しかし、dhcpdの起動に失敗してしまう。原因はchownできないかららしいけど、なぜchownできなかったのかというとSELinuxが起動していたからでした。
ちなみに、chownしなければいけない理由は今のところ判明してません。
Dec 27 23:11:24 localhost dhcpd: Internet Systems Consortium DHCP Server 4.1.1-P 1 Dec 27 23:11:24 localhost dhcpd: Copyright 2004-2010 Internet Systems Consortium. Dec 27 23:11:24 localhost dhcpd: All rights reserved. Dec 27 23:11:24 localhost dhcpd: For info, please visit https://www.isc.org/software/dhcp/ Dec 27 23:11:24 localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file Dec 27 23:11:24 localhost dhcpd: Can't chown new lease file: Operation not permitted Dec 27 23:11:24 localhost dhcpd: Dec 27 23:11:24 localhost dhcpd: This version of ISC DHCP is based on the release available Dec 27 23:11:24 localhost dhcpd: on ftp.isc.org. Features have been added and other changes Dec 27 23:11:24 localhost dhcpd: have been made to the base software release in order to make Dec 27 23:11:24 localhost dhcpd: it work better with this distribution. Dec 27 23:11:24 localhost dhcpd: Dec 27 23:11:24 localhost dhcpd: Please report for this software via the CentOS Bugs Database: Dec 27 23:11:24 localhost dhcpd: http://bugs.centos.org/ Dec 27 23:11:24 localhost dhcpd: Dec 27 23:11:24 localhost dhcpd: exiting.
dhcpサーバがどのようなやりとりをしているか、サーバ側でパケットの流れを追う
$ sudo /usr/sbin/tcpdump -nlSvi eth1 dst port 67 or dst port 68 tcpdump: listening on eth1, link-type EN10MB (Ethernet), capture size 65535 bytes 13:13:19.007105 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x799ee650, secs 7, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Discover Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 13:13:20.001406 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 192.168.1.101.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x799ee650, secs 7, Flags [none] Your-IP 192.168.1.101 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Offer Server-ID Option 54, length 4: 192.168.1.2 Lease-Time Option 51, length 4: 28800 Subnet-Mask Option 1, length 4: 255.255.255.0 Domain-Name Option 15, length 11: "example.com" Domain-Name-Server Option 6, length 4: 192.168.11.1 Default-Gateway Option 3, length 4: 192.168.1.254 13:13:20.002211 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x799ee650, secs 7, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Request Server-ID Option 54, length 4: 192.168.1.2 Requested-IP Option 50, length 4: 192.168.1.101 Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 13:13:20.048547 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 192.168.1.101.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x799ee650, secs 7, Flags [none] Your-IP 192.168.1.101 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: ACK Server-ID Option 54, length 4: 192.168.1.2 Lease-Time Option 51, length 4: 28800 Subnet-Mask Option 1, length 4: 255.255.255.0 Domain-Name Option 15, length 11: "example.com" Domain-Name-Server Option 6, length 4: 192.168.11.1 Default-Gateway Option 3, length 4: 192.168.1.254
こんな感じで、Duscover -> Offer -> Request -> ACK となり、IPアドレスの割り当てがされていることが分かる。
続いて、eth1を再起動し、割り当て期間内で再度割り当てを要求した場合の動作を確認する。
$ sudo ifdown eth1 $ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:A4:B9:65 inet addr:192.168.11.5 Bcast:192.168.11.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fea4:b965/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1168 errors:0 dropped:0 overruns:0 frame:0 TX packets:764 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:106375 (103.8 KiB) TX bytes:93214 (91.0 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:47 errors:0 dropped:0 overruns:0 frame:0 TX packets:47 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4888 (4.7 KiB) TX bytes:4888 (4.7 KiB) $ sudo ifup eth1 eth1 のIP情報を検出中... 完了。
再起動時のtcpdumpのログがこれ↓
IPアドレス再割り当ての際は、Requestから開始される
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x2908202, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Request Requested-IP Option 50, length 4: 192.168.1.101 Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 13:31:26.043929 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 192.168.1.101.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x2908202, Flags [none] Your-IP 192.168.1.101 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: ACK Server-ID Option 54, length 4: 192.168.1.2 Lease-Time Option 51, length 4: 28800 Subnet-Mask Option 1, length 4: 255.255.255.0 Domain-Name Option 15, length 11: "example.com" Domain-Name-Server Option 6, length 4: 192.168.11.1 Default-Gateway Option 3, length 4: 192.168.1.254 13:36:13.355180 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 328)
「dhclient」コマンドで、明示的にIPアドレスの割り当てを解放した場合を検証する
$ sudo dhclient -r eth1 -lf /var/lib/dhclient/dhclient-eth1.leases $ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:A4:B9:65 inet addr:192.168.11.5 Bcast:192.168.11.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fea4:b965/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1494 errors:0 dropped:0 overruns:0 frame:0 TX packets:984 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:137899 (134.6 KiB) TX bytes:121682 (118.8 KiB) eth1 Link encap:Ethernet HWaddr 52:54:00:6B:74:8E inet6 addr: fe80::5054:ff:fe6b:748e/64 Scope:Link ← IPアドレスの割り当てがなくなっている UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:781 errors:0 dropped:0 overruns:0 frame:0 TX packets:105 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:41370 (40.4 KiB) TX bytes:5958 (5.8 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:58 errors:0 dropped:0 overruns:0 frame:0 TX packets:58 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:6032 (5.8 KiB) TX bytes:6032 (5.8 KiB)
解放した際に、tcpdumpのログはこちら↓
192.168.1.101.bootpc > 192.168.1.2.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x55c2f47b, Flags [none] Client-IP 192.168.1.101 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Release Server-ID Option 54, length 4: 192.168.1.2
eth1を再起動して、再度IPアドレスを割り当てる
$ sudo ifdown eth1 [sudo] password for test1: $ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:A4:B9:65 inet addr:192.168.11.5 Bcast:192.168.11.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fea4:b965/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1597 errors:0 dropped:0 overruns:0 frame:0 TX packets:1038 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:146977 (143.5 KiB) TX bytes:129174 (126.1 KiB) ←eth1が認識されなくなりました lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:58 errors:0 dropped:0 overruns:0 frame:0 TX packets:58 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:6032 (5.8 KiB) TX bytes:6032 (5.8 KiB) $ sudo ifup eth1 eth1 のIP情報を検出中... 完了。 $ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:A4:B9:65 inet addr:192.168.11.5 Bcast:192.168.11.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fea4:b965/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1635 errors:0 dropped:0 overruns:0 frame:0 TX packets:1061 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:150315 (146.7 KiB) TX bytes:132768 (129.6 KiB) eth1 Link encap:Ethernet HWaddr 52:54:00:6B:74:8E inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0 ←割り当てられました inet6 addr: fe80::5054:ff:fe6b:748e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1027 errors:0 dropped:0 overruns:0 frame:0 TX packets:115 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:54688 (53.4 KiB) TX bytes:7410 (7.2 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:61 errors:0 dropped:0 overruns:0 frame:0 TX packets:61 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:6344 (6.1 KiB) TX bytes:6344 (6.1 KiB)
再割り当て時のtcpdumpのログはこちら↓
Discoverから開始されたことが分かる
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x96384d5a, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Discover Requested-IP Option 50, length 4: 192.168.1.101 Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 13:46:12.001109 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 192.168.1.101.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x96384d5a, Flags [none] Your-IP 192.168.1.101 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Offer Server-ID Option 54, length 4: 192.168.1.2 Lease-Time Option 51, length 4: 28800 Subnet-Mask Option 1, length 4: 255.255.255.0 Domain-Name Option 15, length 11: "example.com" Domain-Name-Server Option 6, length 4: 192.168.11.1 Default-Gateway Option 3, length 4: 192.168.1.254 13:46:12.001434 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x96384d5a, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Request Server-ID Option 54, length 4: 192.168.1.2 Requested-IP Option 50, length 4: 192.168.1.101 Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 13:46:12.076217 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 192.168.1.101.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x96384d5a, Flags [none] Your-IP 192.168.1.101 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: ACK Server-ID Option 54, length 4: 192.168.1.2 Lease-Time Option 51, length 4: 28800 Subnet-Mask Option 1, length 4: 255.255.255.0 Domain-Name Option 15, length 11: "example.com" Domain-Name-Server Option 6, length 4: 192.168.11.1 Default-Gateway Option 3, length 4: 192.168.1.254
固定IPを割り当ててみる
/etc/dhcp/dhcpd.confに以下のように追記する
ddns-update-style none; default-lease-time 28800; max-lease-time 86400; subnet 192.168.1.0 netmask 255.255.255.0 { authoritative; range 192.168.1.101 192.168.1.199; option routers 192.168.1.254; option subnet-mask 255.255.255.0; option domain-name-servers 192.168.11.1; option domain-name "example.com"; ----------ここから host client01 { hardware ethernet 52:54:00:6B:74:8E; fixed-address 192.168.1.99; option host-name "client01"; } ----------ここまで追記 }
ホスト「dhcp01」のdhcpdを再起動する
$ sudo service dhcpd restart dhcpd を停止中: [ OK ] dhcpd を起動中: [ OK ]
クライアントでIPアドレスの割り当てが成功しているか確認する
$ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:A4:B9:65 inet addr:192.168.11.5 Bcast:192.168.11.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fea4:b965/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:110 errors:0 dropped:0 overruns:0 frame:0 TX packets:82 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:13723 (13.4 KiB) TX bytes:12218 (11.9 KiB) eth1 Link encap:Ethernet HWaddr 52:54:00:6B:74:8E inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0 ←まだ、以前に割り当てられてまま inet6 addr: fe80::5054:ff:fe6b:748e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:357 errors:0 dropped:0 overruns:0 frame:0 TX packets:85 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:18818 (18.3 KiB) TX bytes:4182 (4.0 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:42 errors:0 dropped:0 overruns:0 frame:0 TX packets:42 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4368 (4.2 KiB) TX bytes:4368 (4.2 KiB) $ sudo ifdown eth1 [sudo] password for test1: $ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:A4:B9:65 inet addr:192.168.11.5 Bcast:192.168.11.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fea4:b965/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:161 errors:0 dropped:0 overruns:0 frame:0 TX packets:110 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:18193 (17.7 KiB) TX bytes:17506 (17.0 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:42 errors:0 dropped:0 overruns:0 frame:0 TX packets:42 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4368 (4.2 KiB) TX bytes:4368 (4.2 KiB) $ sudo ifup eth1 eth1 のIP情報を検出中... 完了。 $ ifconfig eth0 Link encap:Ethernet HWaddr 52:54:00:A4:B9:65 inet addr:192.168.11.5 Bcast:192.168.11.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fea4:b965/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:199 errors:0 dropped:0 overruns:0 frame:0 TX packets:131 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:21517 (21.0 KiB) TX bytes:21564 (21.0 KiB) eth1 Link encap:Ethernet HWaddr 52:54:00:6B:74:8E inet addr:192.168.1.99 Bcast:192.168.1.255 Mask:255.255.255.0 ←設定通りのIPアドレスとが割り当てられている inet6 addr: fe80::5054:ff:fe6b:748e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:375 errors:0 dropped:0 overruns:0 frame:0 TX packets:96 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:20624 (20.1 KiB) TX bytes:5716 (5.5 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:45 errors:0 dropped:0 overruns:0 frame:0 TX packets:45 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:4680 (4.5 KiB) TX bytes:4680 (4.5 KiB)
固定IPアドレス割り当て時の、dhcpサーバ側のtcpdumpのログはこちら↓
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x33249a7e, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Request Requested-IP Option 50, length 4: 192.168.1.101 Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 14:25:09.656447 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 255.255.255.255.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x33249a7e, Flags [Broadcast] Server-IP 192.168.1.2 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: NACK Server-ID Option 54, length 4: 192.168.1.2 MSG Option 56, length 30: "requested address is incorrect" 14:25:09.685652 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x482bd718, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Discover Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 14:25:09.685795 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 192.168.1.99.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x482bd718, Flags [none] Your-IP 192.168.1.99 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Offer Server-ID Option 54, length 4: 192.168.1.2 Lease-Time Option 51, length 4: 28800 Subnet-Mask Option 1, length 4: 255.255.255.0 Domain-Name Option 15, length 11: "example.com" Domain-Name-Server Option 6, length 4: 192.168.11.1 Hostname Option 12, length 8: "client01" Default-Gateway Option 3, length 4: 192.168.1.254 14:25:09.685945 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 52:54:00:6b:74:8e, length 300, xid 0x482bd718, Flags [none] Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: Request Server-ID Option 54, length 4: 192.168.1.2 Requested-IP Option 50, length 4: 192.168.1.99 Parameter-Request Option 55, length 13: Subnet-Mask, BR, Time-Zone, Classless-Static-Route Domain-Name, Domain-Name-Server, Hostname, YD YS, NTP, MTU, Option 119 Default-Gateway 14:25:09.686002 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328) 192.168.1.2.bootps > 192.168.1.99.bootpc: BOOTP/DHCP, Reply, length 300, xid 0x482bd718, Flags [none] Your-IP 192.168.1.99 Client-Ethernet-Address 52:54:00:6b:74:8e Vendor-rfc1048 Extensions Magic Cookie 0x63825363 DHCP-Message Option 53, length 1: ACK Server-ID Option 54, length 4: 192.168.1.2 Lease-Time Option 51, length 4: 28800 Subnet-Mask Option 1, length 4: 255.255.255.0 Domain-Name Option 15, length 11: "example.com" Domain-Name-Server Option 6, length 4: 192.168.11.1 Hostname Option 12, length 8: "client01" Default-Gateway Option 3, length 4: 192.168.1.254
見事dhcpサーバから固定IPアドレスを割り当てることができました
やっぱり、教科書通りの単純なことだと分かっていても、端折らずに地道に行うことが大事だね。
ぶっちゃけ、dhcpなんて業務外でまったく業務には関係ありません
でも、業務でやってることしかわからないエンジニアにはなりたくなくて、上っ面だけしかわからないエンジニアにもなりたくなくて、仕組みを根本から理解しているエンジニアになりたいので、寄り道しまくります笑
もちろん、学んだことの中から業務への活かし方も考えますよ。仕事に活かせてナンボっていうのは前提ですからね
以上、教科書をなぞっただけのハンズオンでしたが、dhcpサーバの構築終了です。