Gentoo 下 DHCP 的設定
目的: 建立起 DHCP server,讓所有接上這個網域的電腦能不需 config 即可連上網路。
說明: DNS 為 168.95.1.1,domain 為 posiedon。網段為 192.168.0.0/24,其中 254 給 server,1 保留,因此分配出去的 IP range 為 2 - 253
首先,安裝 dhcpcd
emerge dhcpcd
接下來,編輯 /etc/dhcp/dhcpd.conf
# dhcpd.conf # # Sample configuration file for ISC dhcpd # # option definitions common to all supported networks... option domain-name "poseidon"; option domain-name-servers 168.95.1.1; option routers 192.168.0.254; ddns-update-style none; default-lease-time 600; max-lease-time 7200; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. # A slightly different configuration for an internal subnet. subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.2 192.168.0.253; }
最後,啟動 DHCPD
/etc/init.d/dhcpd start
加入開機即起動的行列
rc-update add dhcpd default