Linux DHCP服务器搭建

1.    需要做的准备工作:

Dhcp服务器的安装

两台虚拟机:一台红帽,做dhcp服务器;另一台window2003,动态获得ip地址。

2.    dhcp的配置:

注:以下红色为要编写内容。

(1)在服务器上设置一个ip地址,比如192.168.5.100.

# vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=static

HWADDR=00:0c:29:39:65:80

ONBOOT=yes

NETMASK=255.255.255.0

IPADDR=192.168.5.100

TYPE=Ethernet

GATEWAY=192.168.5.254

(2) 编辑 /etc/dhcpd.conf文件来编写dhcp地址池:

subnet 192.168.5.0 netmask 255.255.255.0 {

 

# --- default gateway

        option routers                  192.168.5.254;

        option subnet-mask              255.255.255.0;

 

        option domain-name              "xiaoyangdabian.com";

        option domain-name-servers      222.88.88.88,222.85.85.85;dns,这个是根据自己的情况)

 

        option time-offset              -18000; # Eastern Standard Time

#       option ntp-servers              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

#       option netbios-node-type 2;

 

        range dynamic-bootp 192.168.5.1  192.168.5.253

        default-lease-time 21600;

        max-lease-time 43200;                

3)启动dhcp服务器:

 #  service  dhcpd  start | restart

3.     打开window2003虚拟机,将本地连接设置为自动获取ip地址,然后输入 ipconfig/renew 查看 获取ip地址的情况

 

 Linux DHCP服务器搭建_Linux DHCP服务器搭建