linux:dhcp

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
linux:dhcp [2013/10/07 01:16] – [DHCP サーバーの設定] ともやんlinux:dhcp [2019/05/18 02:23] (現在) – 外部編集 非ログインユーザー
行 3: 行 3:
 ===== パッケージインストール ===== ===== パッケージインストール =====
 <code> <code>
-$ sudo yum install dhcp+$ sudo dnf install dhcp
 </code> </code>
  
 ===== DHCP サーバーの設定 ===== ===== DHCP サーバーの設定 =====
-設定前にバックアップを作成しておく。+ 
 +====設定ファイルのバックアップ ====
 <code> <code>
 $ sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.org $ sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.org
行 14: 行 15:
 サンプルを元に修正する場合は、以下のファイルをコピーする。 サンプルを元に修正する場合は、以下のファイルをコピーする。
 <code> <code>
-$ sudo cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf+$ sudo cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf
 </code> </code>
- +==== 設定ファイルの編集 ====
-設定ファイルの編集+
 <code> <code>
 $ sudo vi /etc/dhcp/dhcpd.conf $ sudo vi /etc/dhcp/dhcpd.conf
行 24: 行 24:
 # #
 # DHCP Server Configuration file. # DHCP Server Configuration file.
-#   see /usr/share/doc/dhcp*/dhcpd.conf.sample 
-#   see 'man 5 dhcpd.conf' 
 # #
  
行 31: 行 29:
 ignore client-updates; ignore client-updates;
  
-subnet 172.16.78.0 netmask 255.255.255.0 {+subnet 192.168.1.0 netmask 255.255.255.0 {
     authoritative;     authoritative;
  
-    option routers 172.16.78.254;+    option routers 192.168.1.254;
     option subnet-mask 255.255.255.0;     option subnet-mask 255.255.255.0;
  
-    option domain-name fireball.local; +    option domain-name "fireball.local"
-    option domain-name-servers blue-ds.fireball.local172.16.78.254;+    option domain-name-servers blue-dcblue-ns, tomoyan-wrt;
  
-    option ntp-servers blue-ds.fireball.local+    option ntp-servers blue-dc
-    option time-offset 32400; +    option time-offset 32400; # Japan Standard Time 
-#    option netbios-name-servers 172.16.78.10;+#    option netbios-name-servers blue-dc;
 #    option netbios-node-type 2; #    option netbios-node-type 2;
 +    option root-path "/opt/ltsp/i386";
 +    if substring( option vendor-class-identifier, 0, 9 ) = "PXEClient" {
 +        filename "/ltsp/i386/pxelinux.0";
 +    } else {
 +        filename "/ltsp/i386/nbi.img";
 +    }
 +    next-server 192.168.1.15;
  
-    range dynamic-bootp 172.16.78.91 172.16.78.100;+    range 192.168.1.150 192.168.1.199; 
 +    range dynamic-bootp 192.168.1.91 192.168.1.100;
     default-lease-time 21600;     default-lease-time 21600;
     max-lease-time 43200;     max-lease-time 43200;
 +}
  
-    host blue-work-sv { +#host blue-work-sv { 
-        hardware ethernet 52:54:00:1D:7E:B2; +#    hardware ethernet 52:54:00:1D:7E:B2; 
-        fixed-address 172.16.78.80; +#    fixed-address 192.168.1.80; 
-    +#
-};+</code> 
 +==== 設定ファイルのチェック ==== 
 +<code> 
 +$ sudo dhcpd -t 
 +Internet Systems Consortium DHCP Server 4.3.6 
 +Copyright 2004-2017 Internet Systems Consortium. 
 +All rights reserved. 
 +For info, please visit https://www.isc.org/software/dhcp/ 
 +ldap_gssapi_principal is not set,GSSAPI Authentication for LDAP will not be used 
 +Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file 
 +Config file: /etc/dhcp/dhcpd.conf 
 +Database file: /var/lib/dhcpd/dhcpd.leases 
 +PID file: /var/run/dhcpd.pid 
 +Source compiled to use binary-leases 
 +</code> 
 +===== firewallの設定 ===== 
 +dhcpサービスを許可する。 
 +<code> 
 +$ sudo firewall-cmd --permanent --add-service=dhcp 
 +success 
 +</code> 
 + 
 +設定を反映する。 
 +<code> 
 +$ sudo firewall-cmd --reload 
 +success 
 +</code> 
 + 
 +設定を確認する。(dhcpが含まれていること) 
 +<code> 
 +$ sudo firewall-cmd --list-services 
 +dhcp dhcpv6-client ipp-client mdns 
 +</code> 
 + 
 +===== サービス自動起動設定 ===== 
 +<code> 
 +$ sudo systemctl enable dhcpd.service 
 +</code> 
 + 
 +===== サービス起動 ===== 
 +<code> 
 +$ sudo systemctl start dhcpd.service
 </code> </code>
  
 ===== 参考文献 ===== ===== 参考文献 =====
 [[http://linuxjm.sourceforge.jp/html/dhcp2/man5/dhcpd.conf.5.html|Man page of dhcpd.conf]]\\ [[http://linuxjm.sourceforge.jp/html/dhcp2/man5/dhcpd.conf.5.html|Man page of dhcpd.conf]]\\
  • linux/dhcp.1381076177.txt.gz
  • 最終更新: 2019/05/18 02:23
  • (外部編集)