linux dhcp
dhcp 服務(wù)一、要求服務(wù)器地址:192.168.2.2/24 網(wǎng)關(guān):192.168.2.1分配192.168.1.2-192.168.1.60/24 網(wǎng)關(guān)為192.168.1.1 新建保留192.1
dhcp 服務(wù)
一、要求
服務(wù)器地址:192.168.2.2/24 網(wǎng)關(guān):192.168.2.1
分配192.168.1.2-192.168.1.60/24 網(wǎng)關(guān)為192.168.1.1 新建保留192.168.1.3分配給AA:BB:CC:DD:EE:FF
二、操作步驟:
1. yum –y install dhcp*
2. cat /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample > /etc/dhcpd.conf
3. 修改/etc/dhcpd.conf 文件(注意:dhcp 首先要做與本機同網(wǎng)段的作用域)
, 紅色字體是需要修改部分
#ddns-update-style interim; #ignore client-updates;
subnet 192.168.2.0 netmask 255.255.255.0 { ping-check true; ping-timeout 1; # #
//分配之前ICMP 檢測,1S 后無響應(yīng)則分配
# --- default gateway
option routers option subnet-mask option nis-domain option domain-name
192.168.2.1; 255.255.255.0; "domain.org"; "domain.org";
//dns域名 //dns地址
192.168.1.1;
option domain-name-servers option time-offset option ntp-servers
-18000; # Eastern Standard Time 192.168.1.1;
option netbios-name-servers 192.168.1.1;
,# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well
#
}
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
#
# option time-offset option ntp-servers -18000; # Eastern Standard Time 192.168.1.1; option nis-domain option domain-name "domain.org"; "domain.org"; 192.168.1.1; option routers option subnet-mask 192.168.1.1; 255.255.255.0; range dynamic-bootp 192.168.2.128 192.168.2.254; default-lease-time 21600; max-lease-time 43200; //地址池 //默認租期時間 (秒) //最大租期時間 (秒) option netbios-node-type 2; option domain-name-servers option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well
#
} # we want the nameserver to appear at a fixed address host ns { } next-server marvin.redhat.com; hardware ethernet AA:BB:CC:DD:EE:FF; fixed-address 192.168.1.3; //新建保留 range dynamic-bootp 192.168.1.2 192.168.1.60; default-lease-time 21600; max-lease-time 43200; option netbios-node-type 2;
4. service dhcpd restart
5. ※開機自啟動(如果需要)
chkconfig dhcpd on
,四、測試結(jié)果
mac 地址為AA:BB:CC:DD:EE:FF的客戶機 打開cmd 輸入 ipconfig /renew
Windows IP Configuration
Ethernet adapter 本地連接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.3 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1
五、問題判斷:
無法啟動服務(wù),請仔細檢查配置文件,注意不要少;和}符號
客戶端無法獲取地址,請檢查客戶機與服務(wù)器中間有沒有路由設(shè)備。
dhcp 超級作用域
一、要求
服務(wù)器地址:192.168.2.2/24 網(wǎng)關(guān):192.168.2.1
分配192.168.1.2-192.168.1.60/24 網(wǎng)關(guān)為192.168.1.1 新建保留192.168.1.3分配給AA:BB:CC:DD:EE:FF 建立名為dhcp 超級作用域。
二、操作步驟:
1. yum –y install dhcp*
2. cat /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample > /etc/dhcpd.conf
3. 修改/etc/dhcpd.conf 文件(注意:dhcp 首先要做與本機同網(wǎng)段的作用域)
4. service dhcpd restart
5. ※開機自啟動(如果需要)
chkconfig dhcpd on
三、配置文件
, 紅色字體是需要修改部分
#ddns-update-style interim;
#ignore client-updates;
share-network <名字> {
subnet 192.168.2.0 netmask 255.255.255.0 {
# --- default gateway
#
# option time-offset option ntp-servers -18000; # Eastern Standard Time 192.168.1.1; option nis-domain option domain-name "domain.org"; "domain.org"; //dns域名 //dns地址 192.168.1.1; option routers option subnet-mask 192.168.2.1; 255.255.255.0; option domain-name-servers option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well
#
}
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
option nis-domain option domain-name "domain.org"; "domain.org"; option routers option subnet-mask 192.168.1.1; 255.255.255.0; range dynamic-bootp 192.168.2.128 192.168.2.254; default-lease-time 21600; max-lease-time 43200; //地址池 //默認租期時間 (秒) //最大租期時間 (秒) option netbios-node-type 2;
,#
# option domain-name-servers option time-offset option ntp-servers 192.168.1.1; -18000; # Eastern Standard Time 192.168.1.1; option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well
#
}
} # we want the nameserver to appear at a fixed address host ns { } next-server marvin.redhat.com; hardware ethernet AA:BB:CC:DD:EE:FF; fixed-address 192.168.1.3; //新建保留 range dynamic-bootp 192.168.1.2 192.168.1.60; default-lease-time 21600; max-lease-time 43200; option netbios-node-type 2;
四、測試結(jié)果
mac 地址為AA:BB:CC:DD:EE:FF的客戶機
打開cmd 輸入 ipconfig /renew
Windows IP Configuration
Ethernet adapter 本地連接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
五、問題判斷:
無法啟動服務(wù),請仔細檢查配置文件,注意不要少;和}符號 客戶端無法獲取地址,請檢查客戶機與服務(wù)器中間有沒有路由設(shè)備。
dhcp group 組
,一、要求
服務(wù)器地址:192.168.2.2/24 網(wǎng)關(guān):192.168.2.1
分配192.168.1.2-192.168.1.60/24 網(wǎng)關(guān)為192.168.1.1 新建保留192.168.1.3分配給AA:BB:CC:DD:EE:FF 建立dhcp group 組。
二、操作步驟:
1. yum –y install dhcp*
2. cat /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample > /etc/dhcpd.conf
3. 修改/etc/dhcpd.conf 文件(注意:dhcp 首先要做與本機同網(wǎng)段的作用域)
4. service dhcpd restart
5. ※開機自啟動(如果需要)
chkconfig dhcpd on
三、配置文件
, 紅色字體是需要修改部分
#ddns-update-style interim; #ignore client-updates;
share-network <名字> {
subnet 192.168.2.0 netmask 255.255.255.0 {
# --- default gateway
option routers option subnet-mask option nis-domain option domain-name
192.168.2.1; 255.255.255.0; "domain.org"; "domain.org";
//dns域名 //dns地址
192.168.1.1;
option domain-name-servers
,#
# option time-offset option ntp-servers -18000; # Eastern Standard Time 192.168.1.1; option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well
#
}
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
#
# option time-offset option ntp-servers -18000; # Eastern Standard Time 192.168.1.1; option nis-domain option domain-name "domain.org"; "domain.org"; 192.168.1.1; option routers option subnet-mask 192.168.1.1; 255.255.255.0; range dynamic-bootp 192.168.2.128 192.168.2.254; default-lease-time 21600; max-lease-time 43200; //地址池 //默認租期時間 (秒) //最大租期時間 (秒) option netbios-node-type 2; option domain-name-servers option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless # -- you understand Netbios very well
#
}
} # we want the nameserver to appear at a fixed address host ns { } next-server marvin.redhat.com; hardware ethernet AA:BB:CC:DD:EE:FF; fixed-address 192.168.1.3; //新建保留 range dynamic-bootp 192.168.1.2 192.168.1.60; default-lease-time 21600; max-lease-time 43200; option netbios-node-type 2;
,四、測試結(jié)果
mac 地址為AA:BB:CC:DD:EE:FF的客戶機
打開cmd 輸入 ipconfig /renew
Windows IP Configuration
Ethernet adapter 本地連接:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 192.168.1.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
五、問題判斷:
無法啟動服務(wù),請仔細檢查配置文件,注意不要少;和}符號 客戶端無法獲取地址,請檢查客戶機與服務(wù)器中間有沒有路由設(shè)備。
group 組中可以有多個作用域,其作用域選項在作用域前面設(shè)置,則都起作用不用分開設(shè)置。