Linux如何配置DHCP?

Linux如何配置DHCP?,第1张

安装:
yum install -y dhcpx86_64
或者rpm -ivh dhcpx86_64
配置DHCP:
[root@test ~]# rpm -q dhcp
dhcp-411-30P1el6x86_64
[root@test ~]# rpm -qc dhcp |grep conf
/etc/dhcp/dhcpdconf
/etc/dhcp/dhcpd6conf
/etc/sysconfig/dhcpd
/etc/sysconfig/dhcpd6
/etc/sysconfig/dhcrelay
[root@test ~]# vim /etc/dhcp/dhcpdconf
修改为下面参数:
subnet 192168450 netmask 2552552550 {
range 19216845101 19216845200;
option domain-name-servers 19216801;
option domain-name "ncieorg";
option routers 19216845254;
option broadcast-address 19216845255;
default-lease-time 720;
max-lease-time 2160;
}
开启服务
service dhcpd start

这个问题包括了linux dhcp除中继外绝大多数功能,我先一个一个的帮你说明一下,最后给出配置文件
首先搭建我就不用多说了,直接使用rpm -ivh安装dhcp服务即可,然后开始写配置文件,默认是个空白的,可以将/usr/share/doc/dhcp-305/dhcpdconf复制到sample /etc/dhcpdconf,然后VI打开这个文件编写(下面是我自己电脑上配置文件)
ddns-update-style interim;
ignore client-updates;
subnet 192168100 netmask 2552552550 { 指定的网段
# --- default gateway
option routers 192168101; 网关
option subnet-mask 2552552550; 掩码
option nis-domain "domainorg";
option domain-name "domainorg"; 域名
option domain-name-servers 192168102; DNS服务器
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 19216811;
# option netbios-name-servers 19216811;
# --- 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 192168101 19216810100; 分配置IP的范围
default-lease-time 21600; 默认租期
max-lease-time 43200; 最大租期
# we want the nameserver to appear at a fixed address
host ns { 绑定MAC与IP
next-server marvinredhatcom;
hardware ethernet 00:0c:29:61:3c:3c;
fixed-address 192168102;
}
}
只是你的要求中有要排除一些IP ,以及绑定多个IP,下面将继续说明。
比如说在192168101到19216810100中要排除1921681010~1921681020,可以写两段IP范围,即
range 192168101 192168109;
range 1921681021 19216810100;
绑定多个IP
host ns {

hardware ethernet a4:d5:6b:55:9d:43;
fixed-address 192168101;
}
host ns {

hardware ethernet 1a:6f:8c:12:23:5a;
fixed-address 192168102;
}
然后启动DCHP服务
service dhcpd start
查看DHCP服务状态
servic dhcpd staus
到此完毕,如果启动出错一般是配置文件写错了,注意标点符号,你自己总结下,归纳下即可完成。
不足之处,敬请见谅!

你自己linux服务器的IP必须是19216810网段,我估计你服务器配置的IP肯定不是19216810网段。
或者说,你可以单独给自己服务器的网段写一个subnet,里面内容为空也没事,只要和linux服务器上的ip在同一网段即可
这样服务器就能起来了
比如在你的配置文件下面写一行:
subnet xxxxxxxxxxxx netmask 2552552550 {
}
这里的xxxxxxxxxxxx的意思就是你linux的DHCP服务器的IP地址所在网段

一个文件,不知道光盘上有没有,而且不能用光盘,也不能用U盘等移动设备,只能从网络获取,但是又不能上网。
你这个文件又是必须有,没有不行,你这个完全已经把自己逼到死胡同里面了。根本没有可以实现的放法了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10304423.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-07
下一篇 2023-05-07

发表评论

登录后才能评论

评论列表(0条)

保存