這是dhcp 的設定檔...不用刻意記啦...因為它有sample...用 slocate dhcp 就可以看到...
#slocate dhcp
#cp /usr/share/doc/dhcp-2.0pl5/dhcpd.conf.sample /etc/dhcpd.conf
版上留的是個人的設定啦...下次要用比較快...
複製內容到剪貼板
代碼:
option domain-name "adj.idv.tw";
option domain-name-servers 168.95.1.1, 168.95.192.1;
default-lease-time 43200;
max-lease-time 86400;
subnet 192.168.20.0 netmask 255.255.255.0
{
# --- default gateway
option routers 192.168.20.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.20.3 192.168.20.100;
# we want the nameserver to appear at a fixed address
host netserver
{
hardware ethernet 00:20:ED:42:31:B6;
fixed-address 192.168.20.2;
}
}
詳細說明不用再自己打啦...看一下鳥哥的或netman 的文章就很精彩...
鳥哥:
http://linux.vbird.org/linux_server/0340dhcp.php#dhcp_server
Netman:
http://www.adj.idv.tw/server/linux_dhcp.htm
這次為什麼會弄這一篇...原因是昨晚弄很久...記得設定很簡單呀...dhcp run
起來也很正常呀...可是 client 端就是無法自動取得 IP...後來正準備放棄去睡
覺前...把整個 Firewall 打開...竟然就正常了...原來是被自己的 Firewall 擋掉了..
難怪就是無法取得 IP...真是的...我的防火牆是整個擋掉...再各別開的那種...
所以 udp 67 port 是擋掉的...只要把它打開..
# Allow DHCP
iptables -A INPUT -p udp --dport 67 -j ACCEPT
這樣就行啦...寫下來當個警惕囉...