深圳office培训 深圳excel培训
深圳excel培训 深圳office培训
咨询服务
深圳office培训
深圳office培训
office培训
excel培训
ppt培训
vba培训
access培训
word培训
visio培训
project培训
outlook培训
数据库培训
深圳access培训
深圳sql培训
深圳office培训
 

Linux下的DHCP服务器配置


2013年12月5日 作者: 来源:

一、修改dhcp服务器ip地址:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.0
BOOTPROTO=static
HWADDR=00:0C:29:AF:43:A6
ONBOOT=yes
TYPE=Ethernet
vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
IPADDR=192.168.2.100
NETMASK=255.255.255.0
BOOTPROTO=static
HWADDR=00:0C:29:AF:43:A7
service network restart  使修改的地址生效
二、挂载光盘并安装DHCP软件包或用yum install dhcp 安装
mount -t iso9660 /dev/cdrom /media/cdrom/
cd /media/cdrom/RedHat/RPMS/
rpm -ivh dhcp-3.0.1-59.EL4.i386.rpm
三、复制dhcpd配置文件的样本
cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcpd.conf
四、编辑配置文件
vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
        option routers                  192.168.0.1;
        option subnet-mask              255.255.255.0;
        option nis-domain               "domain.org";
        option domain-name              "domain.org";                            #域名
        option domain-name-servers      192.168.1.1;
        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.0.128 192.168.0.254;
        default-lease-time 21600;
        max-lease-time 43200;
        # we want the nameserver to appear at a fixed address
        host ns {
                next-server marvin.redhat.com;
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 207.175.42.254;
        }
}

修改为
ddns-update-style interim;                                                 #dhcp服务器和dns服务器内部更新自动协商
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {                               
        option routers                  192.168.1.1;                       #网关
        option subnet-mask              255.255.255.0;                     #子网掩码
        option domain-name-servers      202.103.24.68,202.103.0.117;       #DNS服务器地址
        option time-offset              -18000; # Eastern Standard Time
# --- 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.1.101 192.168.1.200;                   #地址池
        default-lease-time 21600;                                          #默认租约时间(秒)
        max-lease-time 43200;                #最大租约时间(秒)
        # we want the nameserver to appear at a fixed address
        host JTWD01-28 {
                next-server marvin.redhat.com;
                hardware ethernet 00:1E:90:17:CC:67;                       #根据主机网卡mac地址分配IP地址
                fixed-address 192.168.1.88;                                #分配的固定IP地址
        }
}
subnet 192.168.2.0 netmask 255.255.255.0 {
        option routers                  192.168.2.1;
        option subnet-mask              255.255.255.0;
        option domain-name-servers      202.103.24.68,202.103.0.117;
        option time-offset              -18000; # Eastern Standard Time
# --- 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.2.101 192.168.2.200;
        default-lease-time 21600;
        max-lease-time 43200;
}

五、应用不同的网络接口:
vi /etc/sysconfig/dhcpd
DHCPDARGS=eth0  // DHCPDARGS=eth1                      #仅在eth0上提供dhcp服务
六、开启dhcp服务:
service dhcpd start                                    #stop status restart
注:/var/lib/dhcpd/dhcpd.leases 中记录着DHCP服务器向DHCP客户机提供租用的每个IP地址的信息
七、DHCP中继代理
1)首先安装dhcpd服务(里面包含中继代理服务)
2)启用路由功能:
echo  "1"  > /proc/sys/net/ipv4/ip_forward
3)然后修改dhcrelay的配置文件:
vi  /etc/sysconfig/dhcrelay
加入以下内容:
INTERFACES="eth0 eth1"
DHCPSERVERS="192.168.1.2"
4)给dhcp服务器增加新网段的地址池
5)启动中继服务
service  dhcrelay  start
6)客户端测试


阅读:2256 上一则:linux网络管理相关配置文件 下一则:无线局域网组网案例

返回前页 返回顶部
温馨提示:本中心是深圳较为专业office培训机构、咨询及报名请先预约,电话:0755-82124110。
深圳地址:深圳红荔路四川大厦1109B-1110(3号龙岗线通新岭地铁站A出口10米)
热线:0755-82124110(福田、南山、宝安) 0755-22205758(罗湖、龙岗、龙华) 13510024571(东莞、惠州、珠海、广州)
北京地址:北京清华大学华业大厦三区三楼 版权所有:深圳万博计算机教育 粤ICP备11006947号-1
 
深圳信息系统项目管理师培训
深圳信息系统项目管理师培训 欢迎咨询!
您好!请点击这里咨询万博教育
深圳万博吴老师
您好!请点击这里咨询万博教育
深圳万博史老师
 
深圳信息系统项目管理师培训
深圳信息系统项目管理师培训