RHEL系统DHCP和DHCP中继配置

RHEL5
DHCP服务器
--------------------------------------
1.设置本机IP地址
# ifconfig eth0 192.168.0.2
2.挂载光盘
# mount /dev/cdrom /media
3.安装DHCP软件包
# cd /media/Server
# ls -l dhcp*
# rpm -ivh dhcp-3.*
4.将样例文件copy到dhcpd.conf配置文件中
# cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcpd.conf
5.在/etc/dhcpd.conf配置文件中添加一个subnet作用域
# vi /etc/dhcpd.conf
ddns-update-style none;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
  option routers   192.168.0.1;
  option subnet-mask  255.255.255.0;
  option domain-name-servers 192.168.0.1,202.106.0.20;
  option time-offset  -18000;
  range 192.168.0.100 192.168.0.200;
  default-lease-time 36000;
  max-lease-time 86400;
  host printer {
   hardware ethernet 00:12:fc:78:AB:CD;
   fixed-address 192.168.0.250;
  }
}
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 192.168.1.1,202.106.0.20;
  option time-offset  -18000;
  range 192.168.1.100 192.168.1.200;
  default-lease-time 36000;
  max-lease-time 86400;
}
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 192.168.2.1,202.106.0.20;
  option time-offset  -18000;
  range 192.168.2.100 192.168.2.200;
  default-lease-time 36000;
  max-lease-time 86400;
}
:wq
6.重启DHCP服务
# service dhcpd start

RHEL4
DHCP中继代理
---------------------------------------
1.设置本机IP地址
# ifconfig eth0 192.168.0.1/24
# ifconfig eth1 192.168.1.1/24
# ifconfig eth2 192.168.2.1/24
配置DHCP中继也要将光盘挂载
# mount /dev/cdrom /media/cdrom
2.安装DHCP中继包
# cd /media/cdrom/RedHat/RPMS
# ls -l dhcp*
# rpm -ivh dhcp-3.*
3.找到/etc/sysctl.conf文件
# vi /etc/sysctl.conf
net.ipv4.conf.all.bootp_relay = 1
net.ipv4.ip_forward = 1
:wq
# echo 1 > /proc/sys/net/ipv4/conf/all/bootp_relay
# echo 1 > /proc/sys/net/ipv4/ip_forward
4.找到/etc/sysconfig/dhcrelay文件
# vi /etc/sysconfig/dhcrelay
INTERFACES="eth0 eth1 eth2"
DHCPSERVERS="192.168.0.2"
:wq
5.开启2345的运行级别
# chkconfig --level 2345 dhcrelay on
# /etc/init.d/dhcrelay start
6.开启路由
# /usr/sbin/dhcrelay -i eth0 -i eth1 -i eth2 192.168.0.2
7.启动DHCP中继代理
# service dhcrelay restart

 

本文出自 “菜鸟集结号” 博客,转载请与作者联系!

你可能感兴趣的:(职场,休闲)