{"id":27515,"date":"2025-04-19T19:56:14","date_gmt":"2025-04-19T11:56:14","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/27515.html"},"modified":"2025-04-19T19:56:14","modified_gmt":"2025-04-19T11:56:14","slug":"linux%e7%b3%bb%e7%bb%9f%e5%ae%89%e8%a3%85dhcp%e6%9c%8d%e5%8a%a1%e8%af%a6%e7%bb%86%e8%bf%87%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/27515.html","title":{"rendered":"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b"},"content":{"rendered":"<h2>1.DHCP\u4ecb\u7ecd<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"758\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115610-68038f5a0b644.png\" width=\"1200\" \/><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"669\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115610-68038f5a98d20.png\" width=\"1200\" \/><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"641\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115611-68038f5b004b8.png\" width=\"1200\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"607\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115611-68038f5b5b531.png\" width=\"1107\" \/><\/p>\n<h2>2.DHCP\u5b89\u88c5\u8fc7\u7a0b<\/h2>\n<h3>2.1.\u5b89\u88c5\u524d\u51c6\u5907<\/h3>\n<h4>&#xff08;1&#xff09;\u5173\u95ed\u9632\u706b\u5899<\/h4>\n<p>1.systemctl disable &#8211;now firewalld<\/p>\n<p>2.setenforce 0<\/p>\n<p>3.vim \/etc\/selinux\/config<br \/>\n  &#xff08;SELINUX&#061;disabled&#xff09; <\/p>\n<h4>&#xff08;2&#xff09;\u67e5\u770b\u662f\u5426\u5df2\u5b89\u88c5dhcp\u670d\u52a1<\/h4>\n<p>rpm -qa|grep dhcp*(\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u8f6f\u4ef6&#xff09;<br \/>\n#\u6216\u8005<br \/>\nyum list installed | grep dhcp<\/p>\n<p>#\u67e5\u770bip\u5730\u5740<br \/>\nifconfig<\/p>\n<h3>2.2.\u5b89\u88c5dhcp\u670d\u52a1<\/h3>\n<h4>&#xff08;1&#xff09;\u5b89\u88c5<\/h4>\n<p>yum install -y dhcp <\/p>\n<h4>&#xff08;2&#xff09;\u67e5\u770b\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e<\/h4>\n<p>rpm -qc dhcp<br \/>\n#<br \/>\nfind \/ -name &#034;dhcp*&#034;  <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"211\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115611-68038f5bbb2e4.png\" width=\"389\" \/><\/p>\n<h4>&#xff08;3&#xff09;\u67e5\u770bdhcp\u521d\u59cb\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>cd \/etc\/dhcp<br \/>\nls<br \/>\ncat dhcpd.conf <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"240\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115611-68038f5be613d.png\" width=\"710\" \/><\/p>\n<h4>\u00a0&#xff08;4&#xff09;\u5c06\u6a21\u677f\u6587\u4ef6\u590d\u5236\u5230\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>\u00a0 \u00a0 \u00a0 \u00a0\u56e0\u4e3a\u521d\u59cb\u914d\u7f6e\u6587\u4ef6\u6ca1\u6709\u5185\u5bb9\u6240\u4ee5&#xff0c;\u00a0\u5c06\u6a21\u677f\u6587\u4ef6\u590d\u5236\u5230\/etc\/dhcp\/\u76ee\u5f55\u4e0b&#xff0c;\u8986\u76d6\u539f\u672c\u7684dhcpd.conf\u3002<\/p>\n<p>#<br \/>\ncd \/usr\/share\/doc<br \/>\n#<br \/>\nfind -name &#034;dhcp*&#034;<br \/>\n#<br \/>\ncd dhcp-4.2.5<br \/>\n#<br \/>\ncp -a \/usr\/share\/doc\/dhcp-4.2.5\/dhcpd.conf.example \/etc\/dhcp\/dhcpd.conf<\/p>\n<h4><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"505\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115612-68038f5c23452.png\" width=\"815\" \/>&#xff08;5&#xff09;dhcpd.conf\u539f\u6587\u89e3\u6790<\/h4>\n<p>cd \/etc\/dhcp\/<br \/>\n#<br \/>\nvim dhcpd.conf<\/p>\n<p>#\u5220\u9664\u6587\u4ef6\u91cc\u9762\u7684\u6ce8\u91ca&#xff0c;\u53bb\u9664\u6240\u6709\u4ee5 &#096;#&#096; \u5f00\u5934\u7684\u884c&#xff1a;<br \/>\nsed -i &#039;\/^#\/d&#039; dhcpd.conf <\/p>\n<p>\u6ce8&#xff1a;dhcpd.conf\u539f\u6587 \u89e3\u6790<\/p>\n<p>option domain-name &#034;example.org&#034;;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span style=\"color:#ff9900\"> \u00a0#\u6307\u5b9a\u9ed8\u8ba4\u57df\u540d<\/span><\/p>\n<\/p>\n<p><span style=\"color:#ff9900\">#\u4e3a\u5ba2\u6237\u7aef\u6307\u660eDNS\u670d\u52a1\u5668IP\u5730\u5740\u00a0\u00a0\u00a0\u00a0<\/span> option domain-name-servers ns1.example.org, ns2.example.org;<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0<\/p>\n<p><span style=\"color:#ff9900\"># \u6307\u5b9a\u9ed8\u8ba4\u7684\u79df\u7ea6\u671f\u9650&#xff08;\u5355\u4f4d&#xff1a;\u79d2&#xff09;\u5ba2\u6237\u7aef\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u53ef\u4ee5\u6301\u6709\u5206\u914d\u7684IP\u5730\u5740\u7684\u65f6\u95f4\u957f\u5ea6 \u00a0\u00a0<\/span><\/p>\n<p>default-lease-time 600;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span style=\"color:#ff9900\">\u00a0 # \u6307\u5b9a\u6700\u5927\u7684\u79df\u7ea6\u671f\u9650&#xff08;\u5355\u4f4d&#xff1a;\u79d2&#xff09;&#xff0c;\u5373\u5ba2\u6237\u7aef\u6301\u6709\u7684IP\u5730\u5740\u79df\u7ea6\u65f6\u95f4\u7684\u4e0a\u9650 \u00a0<\/span><\/p>\n<p>max-lease-time 7200;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/p>\n<p>log-facility local7;\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<span style=\"color:#ff9900\">\u00a0# \u6307\u5b9aDHCP\u670d\u52a1\u5668\u65e5\u5fd7\u6d88\u606f\u7684\u53d1\u9001\u76ee\u6807\u6216\u8bbe\u65bd\u4e3alocal7 \u00a0<\/span><\/p>\n<\/p>\n<p><span style=\"color:#fe2c24\"># \u7b2c\u4e00\u4e2a\u5b50\u7f51\u914d\u7f6e \u00a0<\/span><\/p>\n<p><span style=\"color:#ff9900\">#\u6ca1\u6709\u670d\u52a1\u8fd9\u4e2a\u5b50\u7f51\u5c06\u4f1a\u88ab\u6307\u5b9a&#xff0c;\u4f46\u662f\u8981\u58f0\u660e\u4ed6\u6765\u5e2e\u52a9DHCP\u670d\u52a1\u5668\u6765\u4e86\u89e3\u7f51\u7edc\u62d3\u6251<\/span> subnet 10.152.187.0 netmask 255.255.255.0 { \u00a0\u00a0<span style=\"color:#0d0016\">} \u00a0<\/span> \u00a0\u00a0<span style=\"color:#fe2c24\"># \u7b2c\u4e8c\u4e2a\u5b50\u7f51\u914d\u7f6e \u00a0<\/span><\/p>\n<p><span style=\"color:#ff9900\">#\u975e\u5e38\u57fa\u7840&#xff08;\u7b80\u5355&#xff09;\u7684\u5b50\u7f51\u58f0\u660e<\/span> subnet 10.254.239.0 netmask 255.255.255.224 { \u00a0 \u00a0 \u00a0 range 10.254.239.10 10.254.239.20;<span style=\"color:#ff9900\"> # \u5b9a\u4e49\u4e86\u4e00\u4e2a\u9759\u6001\u5206\u914d\u7684IP\u5730\u5740\u8303\u56f4 \u00a0<\/span> \u00a0 \u00a0 option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; <span style=\"color:#ff9900\"># \u6307\u5b9a\u4e86\u4e24\u4e2a\u8def\u7531&#xff08;\u7f51\u5173&#xff09; \u00a0<\/span> } \u00a0 \u00a0\u00a0<span style=\"color:#fe2c24\"># \u7b2c\u4e09\u4e2a\u5b50\u7f51\u914d\u7f6e \u00a0<\/span><\/p>\n<p><span style=\"color:#ff9900\">#\u8fd9\u4e2a\u58f0\u660e\u8fd0\u884cBUUTP(\u5f15\u5bfc\u534f\u8bae)\u5ba2\u6237\u7aef\u83b7\u53d6\u5730\u5740&#xff0c;\u6211\u4eec\u4e0d\u662f\u771f\u6b63\u7684\u63a8\u8350&#xff08;\u6211\u4eec\u5e76\u4e0d\u5efa\u8bae\u8fd9\u6837&#xff09;<\/span> subnet 10.254.239.32 netmask 255.255.255.224 { \u00a0<\/p>\n<p><span style=\"color:#ff9900\"># \u5b9a\u4e49\u4e86\u4e00\u4e2a\u52a8\u6001\u5206\u914d\u7684IP\u5730\u5740\u8303\u56f4&#xff0c;\u4f7f\u7528BOOTP\u534f\u8bae \u00a0<\/span> \u00a0 \u00a0 range dynamic-bootp 10.254.239.40 10.254.239.60;\u00a0 \u00a0 \u00a0 \u00a0 option broadcast-address 10.254.239.31;\u00a0 \u00a0 \u00a0 \u00a0<span style=\"color:#ff9900\"># \u6307\u5b9a\u4e86\u5e7f\u64ad\u5730\u5740&#xff0c;<\/span> \u00a0 \u00a0 option routers rtr-239-32-1.example.org;\u00a0 \u00a0\u00a0<span style=\"color:#ff9900\"># \u8bbe\u7f6e\u8def\u7531&#xff08;\u7f51\u5173&#xff09; \u00a0<\/span> } \u00a0 \u00a0\u00a0<span style=\"color:#fe2c24\"># \u7b2c\u56db\u4e2a\u5b50\u7f51\u914d\u7f6e \u00a0<\/span><\/p>\n<p><span style=\"color:#ff9900\">#\u4e3a\u4e00\u4e2a\u5185\u90e8\u5b50\u7f51\u8fdb\u884c\u7ec6\u5fae\u7684\u914d\u7f6e<\/span> subnet 10.5.5.0 netmask 255.255.255.224 { \u00a0 \u00a0 \u00a0 range 10.5.5.26 10.5.5.30; <span style=\"color:#ff9900\"># \u5b9a\u4e49\u4e86\u4e00\u4e2a\u9759\u6001\u5206\u914d\u7684IP\u5730\u5740\u8303\u56f4 \u00a0<\/span> \u00a0 \u00a0 option domain-name-servers ns1.internal.example.org; <span style=\"color:#ff9900\"># \u6307\u5b9a\u4e86\u57df\u540d\u670d\u52a1\u5668 \u00a0<\/span> \u00a0 \u00a0 option domain-name &#034;internal.example.org&#034;;<span style=\"color:#ff9900\"> # \u6307\u5b9a\u4e86\u9ed8\u8ba4\u57df\u540d \u00a0<\/span> \u00a0 \u00a0 option routers 10.5.5.1; <span style=\"color:#ff9900\"># \u8bbe\u7f6e\u8def\u7531\u7684IP\u5730\u5740 \u00a0<\/span> \u00a0 \u00a0 option broadcast-address 10.5.5.31;<span style=\"color:#ff9900\"> # \u6307\u5b9a\u4e86\u5e7f\u64ad\u5730\u5740 \u00a0<\/span> \u00a0 \u00a0 default-lease-time 600; <span style=\"color:#ff9900\"># \u5b9a\u4e49\u4e86\u79df\u7ea6&#xff08;IP\u5730\u5740\u5206\u914d&#xff09;\u7684\u9ed8\u8ba4\u65f6\u95f4&#xff08;\u5355\u4f4d&#xff1a;\u79d2&#xff09; <\/span>\u00a0 \u00a0 \u00a0 max-lease-time 7200; <span style=\"color:#ff9900\"># \u5b9a\u4e49\u4e86\u79df\u7ea6\u7684\u6700\u5927\u65f6\u95f4&#xff08;\u5355\u4f4d&#xff1a;\u79d2&#xff09;<\/span> \u00a0 \u00a0 \u00a0 <span style=\"color:#ff9900\"># \u8fd9\u4e2a\u5b50\u7f51\u540c\u6837\u88ab\u5206\u6210\u4e868\u4e2a\u5c0f\u7684\u5b50\u7f51\u6bb5&#xff0c;\u4f46\u53ea\u6307\u5b9a\u4e86\u4e00\u4e2a\u5730\u5740\u8303\u56f4 \u00a0<\/span> }<\/p>\n<\/p>\n<p><span style=\"color:#fe2c24\"># \u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3apassacaglia\u7684\u4e3b\u673a \u00a0<\/span> host passacaglia { \u00a0 \u00a0 hardware ethernet 0:0:c0:5d:bd:95; <span style=\"color:#ff9900\"># \u6307\u5b9a\u4e86\u8be5\u4e3b\u673a\u7684MAC\u5730\u5740 \u00a0<\/span> \u00a0 filename &#034;vmunix.passacaglia&#034;;<span style=\"color:#ff9900\"> # \u6307\u5b9a\u4e86\u4e3b\u673a\u6587\u4ef6\u540d <\/span>\u00a0 \u00a0 server-name &#034;toccata.fugue.com&#034;; <span style=\"color:#ff9900\"># \u6307\u5b9a\u4e86\u4e3a\u8be5\u4e3b\u673a\u63d0\u4f9b\u670d\u52a1\u7684DHCP\u670d\u52a1\u5668\u540d\u79f0\u00a0<\/span> } \u00a0 \u00a0\u00a0<span style=\"color:#fe2c24\"># \u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3afantasia\u7684\u4e3b\u673a \u00a0<\/span> host fantasia { \u00a0 \u00a0 hardware ethernet 08:00:07:26:c0:a5; <span style=\"color:#ff9900\"># \u6307\u5b9a\u4e86\u8be5\u4e3b\u673a\u7684MAC\u5730\u5740 \u00a0<\/span> \u00a0 fixed-address fantasia.fugue.com; <span style=\"color:#ff9900\"># \u8fd9\u91cc\u4f3c\u4e4e\u662f\u4e00\u4e2a\u9519\u8bef&#xff0c;\u901a\u5e38fixed-address\u540e\u9762\u8ddf\u7684\u662fIP\u5730\u5740&#xff0c;\u800c\u4e0d\u662f\u57df\u540d\u3002 \u00a0 \u00a0 # \u5982\u679c\u610f\u56fe\u662f\u5206\u914d\u4e00\u4e2a\u56fa\u5b9a\u7684IP\u5730\u5740\u7ed9\u8fd9\u4e2a\u4e3b\u673a&#xff0c;\u5e94\u8be5\u4fee\u6539\u4e3a\u7c7b\u4f3c&#xff1a;fixed-address 192.168.1.100; \u00a0<\/span> } \u00a0 \u00a0\u00a0<span style=\"color:#fe2c24\"># \u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3afoo\u7684\u7c7b \u00a0<\/span> class &#034;foo&#034; { \u00a0 \u00a0 match if substring (option vendor-class-identifier, 0, 4) &#061; &#034;SUNW&#034;; <span style=\"color:#ff9900\"># \u6839\u636e\u5ba2\u6237\u7aef\u53d1\u9001\u7684vendor-class-identifier\u7684\u524d4\u4e2a\u5b57\u7b26\u662f\u5426\u4e3a&#034;SUNW&#034;\u6765\u5339\u914d\u8fd9\u4e2a\u7c7b \u00a0<\/span> } \u00a0 \u00a0\u00a0<span style=\"color:#fe2c24\"># \u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3a224-29\u7684\u5171\u4eab\u7f51\u7edc \u00a0<\/span><\/p>\n<p><span style=\"color:#ff9900\">#\u8fd9\u4e00\u5757DHCP\u914d\u7f6e\u7684\u4e3b\u8981\u4f5c\u7528\u662f\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3a224-29\u7684\u5171\u4eab\u7f51\u7edc&#xff0c;\u8be5\u7f51\u7edc\u5305\u542b\u4e86\u4e24\u4e2a\u5b50\u7f51&#xff08;10.17.224.0\/24\u00a0\u548c\u00a010.0.29.0\/24&#xff09;&#xff0c;\u5e76\u4e3a\u8fd9\u4e24\u4e2a\u5b50\u7f51\u6307\u5b9a\u4e86\u4e0d\u540c\u7684\u9ed8\u8ba4\u7f51\u5173&#xff08;\u8def\u7531\u5668&#xff09;\u3002\u6b64\u5916&#xff0c;\u5b83\u8fd8\u5b9a\u4e49\u4e86\u4e24\u4e2aIP\u5730\u5740\u6c60&#xff08;pool&#xff09;&#xff0c;\u7528\u4e8e\u52a8\u6001\u5206\u914dIP\u5730\u5740\u7ed9\u8bf7\u6c42DHCP\u670d\u52a1\u7684\u5ba2\u6237\u7aef&#xff0c;\u4f46\u8fd9\u4e24\u4e2a\u5730\u5740\u6c60\u6709\u4e0d\u540c\u7684\u8bbf\u95ee\u63a7\u5236\u7b56\u7565\u3002<\/span> shared-network 224-29 { \u00a0<span style=\"color:#ff9900\">\u00a0 # \u5305\u542b\u4e24\u4e2a\u5b50\u7f51 \u00a0<\/span> \u00a0 subnet 10.17.224.0 netmask 255.255.255.0 { \u00a0 \u00a0 \u00a0 option routers rtr-224.example.org;<span style=\"color:#ff9900\"> # \u6307\u5b9a\u4e86\u8be5\u5b50\u7f51\u5185\u7684\u9ed8\u8ba4\u7f51\u5173&#xff08;\u8def\u7531\u5668&#xff09; \u00a0<\/span> \u00a0 } \u00a0 \u00a0 subnet 10.0.29.0 netmask 255.255.255.0 { \u00a0 \u00a0 \u00a0 option routers rtr-29.example.org; <span style=\"color:#ff9900\"># \u6307\u5b9a\u4e86\u8be5\u5b50\u7f51\u5185\u7684\u9ed8\u8ba4\u7f51\u5173&#xff08;\u8def\u7531\u5668&#xff09; \u00a0<\/span> \u00a0 } \u00a0 \u00a0\u00a0<span style=\"color:#fe2c24\">\u00a0 # \u5b9a\u4e49\u4e86\u4e24\u4e2aIP\u5730\u5740\u6c60 \u00a0<\/span> \u00a0 pool { \u00a0 \u00a0 \u00a0 allow members of &#034;foo&#034;; <span style=\"color:#ff9900\"># \u4ec5\u5141\u8bb8\u5c5e\u4e8e\u7c7b&#034;foo&#034;\u7684\u5ba2\u6237\u7aef\u4ece\u8fd9\u4e2a\u5730\u5740\u6c60\u4e2d\u83b7\u53d6IP\u5730\u5740 \u00a0<\/span> \u00a0 \u00a0 range 10.17.224.10 10.17.224.250;<span style=\"color:#ff9900\"> # \u5b9a\u4e49\u4e86\u53ef\u5206\u914d\u7684IP\u5730\u5740\u8303\u56f4 \u00a0<\/span> \u00a0 } \u00a0 \u00a0 \u00a0\u00a0 \u00a0 pool { \u00a0 \u00a0 \u00a0 deny members of &#034;foo&#034;; <span style=\"color:#ff9900\"># \u7981\u6b62\u5c5e\u4e8e\u7c7b&#034;foo&#034;\u7684\u5ba2\u6237\u7aef\u4ece\u8fd9\u4e2a\u5730\u5740\u6c60\u4e2d\u83b7\u53d6IP\u5730\u5740 \u00a0<\/span> \u00a0 \u00a0 range 10.0.29.10 10.0.29.230; <span style=\"color:#ff9900\"># \u5b9a\u4e49\u4e86\u53e6\u4e00\u4e2a\u53ef\u5206\u914d\u7684IP\u5730\u5740\u8303\u56f4 \u00a0<\/span> \u00a0 } \u00a0 \u00a0 \u00a0\u00a0<span style=\"color:#ff9900\">\u00a0 # \u6ce8\u610f&#xff1a;\u5728\u5171\u4eab\u7f51\u7edc\u4e2d\u5b9a\u4e49\u591a\u4e2apool\u65f6&#xff0c;\u9700\u8981\u786e\u4fdd\u5b83\u4eec\u7684\u5206\u914d\u7b56\u7565\u4e0d\u4f1a\u76f8\u4e92\u51b2\u7a81\u6216\u5bfc\u81f4\u914d\u7f6e\u9519\u8bef\u3002 \u00a0<\/span> }<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u683c\u5f0f<\/p>\n<p>\u9009\u9879\/\u53c2\u6570\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u8fd9\u4e9b\u9009\u9879\/\u53c2\u6570\u5168\u5c40\u6709\u6548<\/p>\n<p>\u58f0\u660e {<\/p>\n<p>\u00a0 \u00a0\u00a0\u9009\u9879\/\u53c2\u6570\u00a0 \u00a0 \u00a0 \u00a0\u00a0 \u00a0#\u8fd9\u4e9b\u9009\u9879\/\u53c2\u6570\u5168\u5c40\u6709\u6548<\/p>\n<p>}<\/p>\n<\/p>\n<p>\u4fdd\u7559\u7279\u5b9a\u7684IP\u5730\u5740 \u53ef\u4ee5\u4fdd\u7559\u7279\u5b9a\u7684IP\u56db\u80a2\u7ed9\u7279\u5b9a\u7684DHCP\u5ba2\u6237\u7aef\u4f7f\u7528&#xff0c;\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u5f53\u8fd9\u4e2a\u5ba2\u6237\u6bcf\u6b21\u5411DHCP\u670d\u52a1\u5668\u7d22\u53d6\u5730\u5740\u6216\u66f4\u65b0\u79df\u7ea6\u65f6&#xff0c;DHCP\u670d\u52a1\u5668\u90fd\u4f1a\u7ed9\u5ba2\u6237\u7aef\u5206\u914d\u76f8\u540c\u7684\u5730\u5740\u3002<\/p>\n<p>host \u00a0\u4e3b\u673a\u540d { \u00a0 \u00a0 \u00a0 \u00a0 next-server IP\u5730\u5740; \u00a0 \u00a0 \u00a0 \u00a0 hardware ethernet \u7f51\u5361\u5730\u5740; \u00a0 \u00a0 \u00a0 \u00a0 fixed-address IP\u5730\u5740; \u00a0 \u00a0 \u00a0 \u00a0 filename &#034;\/pxelinux.0&#034;; \u00a0 \u00a0 \u00a0 \u00a0 }<\/p>\n<\/p>\n<p>\u5206\u914d\u591a\u7f51\u6bb5\u7684IP\u5730\u5740 \u8d85\u7ea7\u4f5c\u7528\u57df\u6765\u89e3\u51b3DHCP\u5355\u4e2a\u4f5c\u7528\u57df\u4e2dIP\u5730\u5740\u4e0d\u8db3\u7684\u60c5\u51b5&#xff0c;\u540c\u65f6\u4e5f\u65b9\u4fbf\u4e86\u591a\u4e2a\u4f5c\u7528\u57df\u7684\u540c\u65f6\u7ba1\u7406\u3002\u800c\u4e14\u8d85\u7ea7\u4f5c\u7528\u57df\u53ef\u4ee5\u5b9e\u73b0DHCP\u670d\u52a1\u5668\u53ea\u67091\u4e2a\u5730\u5740\u5374\u53ef\u4ee5\u5206\u53d1\u591a\u4e2a\u7f51\u6bb5\u7684IP\u529f\u80fd&#xff08;\u4e0d\u4f7f\u7528\u8d85\u7ea7\u4f5c\u7528\u57df\u7684\u8bdd\u8981\u4e48\u7ed9DHCP\u670d\u52a1\u5668\u589e\u52a0\u591a\u5757\u7f51\u5361&#xff0c;\u8981\u4e48\u901a\u8fc7DHCP\u7ec8\u4e2d\u7ee7\u7684\u65b9\u5f0f\u6765\u5b9e\u73b0\u5206\u53d1\u4e0d\u540c\u7f51\u6bb5\u7684IP&#xff09;<\/p>\n<p>shared-network \u540d\u79f0 {<\/p>\n<p>\u00a0 subnet \u00a0{<\/p>\n<p>}<\/p>\n<p>\u00a0subnet {<\/p>\n<p>}\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u539f\u6587\u94fe\u63a5&#xff1a;https:\/\/blog.csdn.net\/owlcity123\/article\/details\/104877938<\/p>\n<h4 style=\"background-color:transparent\">\u00a0&#xff08;6&#xff09;\u5c06\u8981\u6dfb\u52a0\u7684\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p># \u6dfb\u52a0\u65b0\u7684\u5b50\u7f51\u00a0 \u6dfb\u52a0\u4f4d\u7f6e\u4e0e\u4e0a\u9762\u7684224-29\u540c\u7ea7 #VMLdhcp(\u81ea\u5df1&#xff09; # VMLdhcp (\u53ef\u9009\u6ce8\u91ca&#xff0c;\u5982\u679c\u786e\u5b9e\u9700\u8981) subnet 192.168.1.0 netmask 255.255.255.0 { \u00a0 \u00a0 range 192.168.1.10 192.168.1.250; \u00a0# \u53ef\u5206\u914d\u7684IP\u5730\u5740\u8303\u56f4 \u00a0 \u00a0 option domain-name-servers 8.8.8.8,114.114.114.114; \u00a0# \u8bbe\u7f6eDNS\u670d\u52a1\u5668 \u00a0 \u00a0 # option domain-name &#034;your.domain.name&#034;; \u00a0# \u5982\u679c\u9700\u8981\u8bbe\u7f6e\u57df\u540d&#xff0c;\u5219\u53d6\u6d88\u6ce8\u91ca\u5e76\u66ff\u6362\u4e3a\u4f60\u7684\u57df\u540d \u00a0 \u00a0 option broadcast-address 192.168.1.255; \u00a0# \u8bbe\u7f6e\u5e7f\u64ad\u5730\u5740 \u00a0 \u00a0 option routers 192.168.1.1; \u00a0# \u8bbe\u7f6e\u9ed8\u8ba4\u7f51\u5173<\/p>\n<p>\u00a0 \u00a0 default-lease-time \u00a0600;<\/p>\n<p>\u00a0 \u00a0\u00a0max-lease-time \u00a07200;<\/p>\n<p>}<\/p>\n<p> systemctl start dhcpd<br \/>\n#<br \/>\n systemctl status dhcpd<\/p>\n<h3><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"544\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115612-68038f5c81c54.png\" width=\"849\" \/>\u00a02.3.\u5ba2\u6237\u7aef\u7684dhcp\u670d\u52a1\u5b89\u88c5<\/h3>\n<p>\u00a0\u00a0dhclient\u00a0\u662f\u7528\u4e8e\u4ece DHCP \u670d\u52a1\u5668\u83b7\u53d6\u7f51\u7edc\u914d\u7f6e\u7684\u5ba2\u6237\u7aef\u7a0b\u5e8f&#xff0c;\u800c\u00a0dhcpd\u00a0\u662f\u8fd0\u884c\u5728\u7f51\u7edc\u670d\u52a1\u5668\u4e0a&#xff0c;\u4e3a DHCP \u5ba2\u6237\u7aef\u5206\u914d\u7f51\u7edc\u914d\u7f6e\u7684\u670d\u52a1\u5668\u7a0b\u5e8f\u3002<\/p>\n<p>\u00a0\u00a0dhclient.d\u00a0\u548c\u00a0dhclient-exit-hooks.d\u00a0\u76ee\u5f55&#xff0c;\u8fd9\u4e9b\u76ee\u5f55\u901a\u5e38\u662f\u4e0e DHCP \u5ba2\u6237\u7aef\u00a0dhclient\u00a0\u76f8\u5173\u8054\u7684&#xff0c;\u800c\u4e0d\u662f DHCP \u670d\u52a1\u5668\u00a0dhcpd\u3002<\/p>\n<h4>&#xff08;1&#xff09;\u68c0\u67e5dhclient\u662f\u5426\u5b89\u88c5<\/h4>\n<p>rpm -q dhclient <\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5982\u679c\u7cfb\u7edf\u63d0\u793a\u627e\u4e0d\u5230\u00a0dhclient&#xff0c;\u90a3\u4e48\u4f60\u9700\u8981\u5b89\u88c5\u5b83\u3002<\/p>\n<h4>&#xff08;2&#xff09;\u5b89\u88c5<\/h4>\n<p>sudo yum install  &#8211;y dhclient <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"70\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115612-68038f5ce0691.png\" width=\"707\" \/><\/p>\n<ul>\n<li>\n<p>dhclient.d&#xff1a;\u8fd9\u4e2a\u76ee\u5f55\u901a\u5e38\u7528\u4e8e\u5b58\u653e\u00a0dhclient\u00a0\u7684\u914d\u7f6e\u6587\u4ef6\u6216\u811a\u672c&#xff0c;\u8fd9\u4e9b\u811a\u672c\u4f1a\u5728 DHCP \u5ba2\u6237\u7aef\u83b7\u5f97\u6216\u5931\u53bb IP \u5730\u5740\u65f6\u8fd0\u884c\u3002\u4e0d\u8fc7&#xff0c;\u8bf7\u6ce8\u610f&#xff0c;\u5177\u4f53\u7684\u6587\u4ef6\u540d\u548c\u8def\u5f84\u53ef\u80fd\u4f1a\u56e0\u4e0d\u540c\u7684 Linux \u53d1\u884c\u7248\u800c\u5f02\u3002<\/p>\n<\/li>\n<li>\n<p>dhclient-exit-hooks.d&#xff1a;\u8fd9\u4e2a\u76ee\u5f55&#xff08;\u5982\u679c\u5b58\u5728&#xff09;\u901a\u5e38\u7528\u4e8e\u5b58\u653e DHCP \u5ba2\u6237\u7aef\u9000\u51fa\u65f6\u6267\u884c\u7684\u811a\u672c\u3002\u4f46\u5e76\u975e\u6240\u6709\u53d1\u884c\u7248\u90fd\u4f7f\u7528\u8fd9\u4e2a\u76ee\u5f55&#xff1b;\u6709\u4e9b\u7cfb\u7edf\u53ef\u80fd\u4f7f\u7528\u4e0d\u540c\u7684\u673a\u5236\u6216\u8def\u5f84\u6765\u5b9e\u73b0\u7c7b\u4f3c\u7684\u529f\u80fd\u3002<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4.4k\u6b21\uff0c\u70b9\u8d5e29\u6b21\uff0c\u6536\u85cf49\u6b21\u3002linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b\u3002_linux\u5b89\u88c5dhcp<\/p>\n","protected":false},"author":2,"featured_media":27506,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-27515","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/27515.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4.4k\u6b21\uff0c\u70b9\u8d5e29\u6b21\uff0c\u6536\u85cf49\u6b21\u3002linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b\u3002_linux\u5b89\u88c5dhcp\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/27515.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T11:56:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115610-68038f5a0b644.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/27515.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/27515.html\",\"name\":\"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T11:56:14+00:00\",\"dateModified\":\"2025-04-19T11:56:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/27515.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/27515.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/27515.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/27515.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4.4k\u6b21\uff0c\u70b9\u8d5e29\u6b21\uff0c\u6536\u85cf49\u6b21\u3002linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b\u3002_linux\u5b89\u88c5dhcp","og_url":"https:\/\/www.wsisp.com\/helps\/27515.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T11:56:14+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419115610-68038f5a0b644.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/27515.html","url":"https:\/\/www.wsisp.com\/helps\/27515.html","name":"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T11:56:14+00:00","dateModified":"2025-04-19T11:56:14+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/27515.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/27515.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/27515.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u7cfb\u7edf\u5b89\u88c5DHCP\u670d\u52a1\u8be6\u7ec6\u8fc7\u7a0b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/27515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=27515"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/27515\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/27506"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=27515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=27515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=27515"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=27515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}