安裝套件
apt-get install dhcp3-server

編輯 /etc/default/dhcp3-server
INTERFACES="eth1" #要發DHCP的網路卡介面,用空白分隔

編輯 /etc/dhcp3/dhcpd.conf
option domain-name "ljhuang"; # 設定 domain-name
option domain-name-servers 168.95.1.1; # 設定DNS
option routers 172.16.0.254; # DHCP client的預設 gateway
option broadcast-address 172.16.0.255;
default-lease-time 3600;
max-lease-time 72000;

# 基本設定,給予224-239這些ip給clients
subnet 172.16.0.0 netmask 255.255.255.0 {
range dynamic-bootp 172.16.0.224 172.16.0.239;
}

# 固定特定 MAC address為某ip。因為我沒有使用所以只列出大概
#host pc01 {
# hardware ethernet <網卡MAC address>;
# fixed-address ;
#}

啟動或關閉等作用的script:
/etc/init.d/dhcp3-server start|stop|restart|status


 


http://wiki.ubuntu.org.cn/index.php?title=Dhcp3-server&variant=zh-hant


http://ljhuang.pixnet.net/blog/post/15021307


 


http://140.128.18.171/wiki/index.php/DHCP%E4%BC%BA%E6%9C%8D%E5%99%A8(apt)


 


最後講一下 有遇過下面的錯誤
後來發現 subnet  的的IP 網域要一樣
如你IP為 *.*.5.*  那 也需要 *.*.5.* 的才會認的到


root@ubuntu:~# /etc/init.d/dhcp3-server restart
 * Stopping DHCP server dhcpd3                                           [fail]
 * Starting DHCP server dhcpd3                                                   * check syslog for diagnostics.
      


default-lease-time 259200;
max-lease-time 777600;
option domain-name "siyongc.domain"; 


subnet 192.168.5.0 netmask 255.255.255.0 {
        range 192.168.5.230 192.168.5.240;
        option broadcast-address 192.168.5.255;
        option routers 192.168.5.17;
        option domain-name-servers 192.168.5.17, 203.56.8.1;
}    


 

    全站熱搜

    立你斯 發表在 痞客邦 留言(0) 人氣()