linux_DHCP配置文档
2015-07-18 00:17
656 查看
1、配置YUM
vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///misc/cd/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
2、配置IP
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:FC:E2:45
ONBOOT=yes
IPADDR=192.168.100.1
NETMASK=255.255.255.0
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
HWADDR=12:34:56:78:90:ab
ONBOOT=yes
IPADDR=192.168.200.1
NETMASK=255.255.255.0
service network restart
3、安装、配置DHCP服务
yum install dhcp -y
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
vim /etc/dhcpd.conf
#全局配置
ddns-update-style none; #动态DNS更新方法
ignore client-updates; #忽略客户机更新
#子网配置
#谁写IP谁傻X
subnet 192.168.100.0 netmask 255.255.255.0 {
#分配IP地址池、子网掩码、网关、DNS
range dynamic-bootp 192.168.100.128 192.168.100.254;
option subnet-mask 255.255.255.0;
option routers 192.168.100.1;
option domain-name "benet.com";
option domain-name-servers 192.168.100.1,192.168.100.2;
#租约时间:最大时间,更新时间
default-lease-time 21600;
max-lease-time 43200;
#主机配置(相当于WINDOWS里的保留)
host ns {
#next-server marvin.redhat.com;
#hardware ethernet 12:34:56:78:AB:CD;
#fixed-address 207.175.42.254;
}
subnet 192.168.200.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.200.128 192.168.200.254;
option subnet-mask 255.255.255.0;
option routers 192.168.200.1;
option domain-name "benet.com";
option domain-name-servers 192.168.200.1,192.168.200.2;
default-lease-time 21600;
max-lease-time 43200;
host ftp {
hardware ethernet 00:0C:29:60:E4:AD;
fixed-address 192.168.200.10;
}
host web {
hardware ethernet 12:34:56:78:90:AB;
fixed-address 192.168.200.20;
}
}
service dhcpd start
chkconfig dhcpd on
4、补充:
限制dhcp服务器提供服务的网络接口
vim /etc/sysconfig/dhcpd
DHCPDARGS="eth0 eth1"
租约文件
tail -f /var/lib/dhcpd/dhcpd.leases
vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///misc/cd/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
2、配置IP
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:FC:E2:45
ONBOOT=yes
IPADDR=192.168.100.1
NETMASK=255.255.255.0
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
HWADDR=12:34:56:78:90:ab
ONBOOT=yes
IPADDR=192.168.200.1
NETMASK=255.255.255.0
service network restart
3、安装、配置DHCP服务
yum install dhcp -y
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
vim /etc/dhcpd.conf
#全局配置
ddns-update-style none; #动态DNS更新方法
ignore client-updates; #忽略客户机更新
#子网配置
#谁写IP谁傻X
subnet 192.168.100.0 netmask 255.255.255.0 {
#分配IP地址池、子网掩码、网关、DNS
range dynamic-bootp 192.168.100.128 192.168.100.254;
option subnet-mask 255.255.255.0;
option routers 192.168.100.1;
option domain-name "benet.com";
option domain-name-servers 192.168.100.1,192.168.100.2;
#租约时间:最大时间,更新时间
default-lease-time 21600;
max-lease-time 43200;
#主机配置(相当于WINDOWS里的保留)
host ns {
#next-server marvin.redhat.com;
#hardware ethernet 12:34:56:78:AB:CD;
#fixed-address 207.175.42.254;
}
subnet 192.168.200.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.200.128 192.168.200.254;
option subnet-mask 255.255.255.0;
option routers 192.168.200.1;
option domain-name "benet.com";
option domain-name-servers 192.168.200.1,192.168.200.2;
default-lease-time 21600;
max-lease-time 43200;
host ftp {
hardware ethernet 00:0C:29:60:E4:AD;
fixed-address 192.168.200.10;
}
host web {
hardware ethernet 12:34:56:78:90:AB;
fixed-address 192.168.200.20;
}
}
service dhcpd start
chkconfig dhcpd on
4、补充:
限制dhcp服务器提供服务的网络接口
vim /etc/sysconfig/dhcpd
DHCPDARGS="eth0 eth1"
租约文件
tail -f /var/lib/dhcpd/dhcpd.leases
相关文章推荐
- Linux socket 初步
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- 基于 Linux 集群环境上 GPFS 的问题诊断
- 谁是桌面王者?Win PK Linux三大镇山之宝
- vivi下重新调整分区
- Linux VS Unix:Linux欲一统天下 Unix不死
- linux下设定环境变量
- Linux下修改MySQL编码的方法