2010年11月8日 星期一

DHCP



1.相關套件:
dhcp.i386

2.相關目錄與檔案:
/etc/dhcpd.conf
/var/lib/dhcpd/              //放租約記錄檔
/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample

3.設定:
安裝好dhcp套件後,設定檔/etc/dhcpd.conf沒有內容
要拷貝/usr/share/doc/dhcp-*/dhcpd.conf.sample來改      //dhcp-*表示安裝的版號
#cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
#vim /etc/dhcpd.conf      //修改為
ddns-update-style interim;
ignore client-updates;

subnet 192.168.213.0 netmask 255.255.255.0 {      //網段名稱

# --- default gateway
        option routers                  192.168.213.2;        // default gateway
        option subnet-mask              255.255.255.0;

        option nis-domain               "marcus";       //如果DHCP+NIS則須給正確值,否則client重開機會被覆蓋掉
        option domain-name              "marcus.com";
        option domain-name-servers      168.95.1.1;     //DNS server IP

        option time-offset              -18000; # Eastern Standard Time     //目前時區與格林威治的差值

        range dynamic-bootp 192.168.213.111 192.168.213.112;        //發放IP區段,練習用只發111,112
        default-lease-time 21600;          //租約時間
        max-lease-time 43200;           //最大租用時間

        # we want the nameserver to appear at a fixed address   //用來設定固定IP
        host ns {
                next-server marvin.redhat.com;
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 207.175.42.254;
        }
}



4.啟動與測試:
Server端:
#/etc/init.d/dhcpd restart

到client端測試:
Linux:
#dhclient eth0
#tail /var/log/message |grep dhclient

Windows:
將網卡設為自動取得IP,在修復讓他去抓

沒有留言:

張貼留言