您的位置:首页 > 电脑网络 > 电脑配件 > Ubuntu环境下DHCP的安装与配置

Ubuntu环境下DHCP的安装与配置

luyued 发布于 2011-04-16 17:55   浏览 N 次  

1. 安装 dhcp3 服务器

sudo apt-get install dhcp3-server

2. 配置 dhcp3 服务

sudo gedit /etc/dhcp3/dhcpd.conf

# dhcpd.conf

#

# Configuration file for ISC dhcpd (see 'man dhcpd.conf')

#

#add the ddns-update for later versions of isc dhcpd,

#it will complain and perhaps not run if not present

#ddns-update-style ad-hoc;

subnet 192.168.200.0 netmask 255.255.255.0 {

range 192.168.200.100 192.168.200.200;

##

# If 192.168.200.1 is also an internet gateway and you

# want your PXE booted device to be able to route to it on

# boot, uncomment these lines.

##

option routers 192.168.200.1;

allow booting;

allow bootp;

next-server 192.168.200.1;

filename "/pxelinux.0";

max-lease-time 6000;

default-lease-time 6000;

}

3. 保存配置文件

4. 重新启动服务:

sudo /etc/init.d/dhcp3-server restart

5. 如果需要更改 dhcp3 服务监听的网卡,可以修改 /etc/default/dhcp3-server

sudo gedit /etc/default/dhcp3-server

查找:

INTERFACES="eth0"

修改为:

INTERFACES="eth1"

二、建立脚步文件

#cd /etc/init.d/

#vi dhcp

添加如下内容:

#!/bin/bash

/sbin/ifconfig eth0 192.168.200.1 netmask 255.255.255.0

/sbin/ifconfig eth0 up

/etc/init.d/dhcp3-server start

保存。

三、建立连接并修改权限:

#ln –s /etc/init.d/dhcp /etc/rc2.d/S95dhcp

#chmod 777 dhcp

四、重启电脑

图文资讯
广告赞助商