安装配置dhcp服务器
原创
©著作权归作者所有:来自51CTO博客作者海睿的原创作品,请联系作者获取转载授权,否则将追究法律责任
第一步:
安装配置dhcp服务器
1)设置服务器网卡ip地址
修改配置文件vim /etc/sysconfig/network-scripts/ifcfg-eth0
更改如下三项即可:
BOOTPROTO=no
IPADDR=172.17.17.2
NETMASK=255.255.255.0
GATEWAY=172.17.17.1
重启网络服务
service network restart
2)查看服务器是否安装dhcp服务
rpm -qa|grep dhcp
如果未安装,则挂载系统光盘,安装dhcp软件包
rpm -ivh dhcp-3*
rpm -ivh dchp-devel*
yum配置好的话,可以直接使用yum安装,
yum install dhcp
3)修改dhcp主配置文件
dhcp主配置文件默认是空的,需要根据模板修改
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
修改内容如下:
dns-update-style none;
ignore client-updates;
#log-faulity local4;
subnet 172.17.17.0 netmask 255.255.255.0 {
option routers 172.172.17.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 202.106.0.20;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 172.17.17.100 172.17.17.254;
default-lease-time 21600;
max-lease-time 43200;
# host ns {
# next-server marvin.redhat.com;
# hardware ethernet 12:34:56:78:AB:CD;
# fixed-address 192.168.1.22;
# }
}
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 202.106.0.20;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.1.100 192.168.1.254;
default-lease-time 21600;
max-lease-time 43200;
}
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.2.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 202.106.0.20;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.2.100 192.168.2.254;
default-lease-time 21600;
max-lease-time 43200;
}
重启dhcp服务
service dhcpd restart
chkconfig dhcpd on
二、配置dhcp中继
首先配置服务器IP地址
eth0:172.17.17.1/24
eth1:192.168.1.1/24
eth2:192.168.2.1/24
修改中继配置文件
/etc/sysconfig/dhcrelay
INTERFACES="eth0 eth1 eth2"
DHCPSERVERS="172.17.17.2"
开启ip转发功能
echo 1 >/proc/sys/net/ipv4/ip_forward
重启DHCP中继服务
/etc/init.d/dhcrelay restart
chkconfig dhcrelay on
三、配置dhcp客户端
使用setup命令
设置网卡eth0获取IP方式为dhcp
dhclient eth0
或者service network restat
查看网卡获得的IP地址
ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:69:15:FE
inet addr:192.168.1.254 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe69:15fe/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9919 errors:0 dropped:0 overruns:0 frame:0
TX packets:189 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:919624 (898.0 KiB) TX bytes:22094 (21.5 KiB)
Interrupt:169 Base address:0x2000
上一篇:安装配置dhcp服务器
下一篇:我的友情链接
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章