DHCP服务器搭建
准备三台虚拟机
把其中一台作为DHCP服务器
[root@jinchuan ~]# mount /dev/sr0 /media/cdrom 挂载光盘
[root@jinchuan ~]# yum -y install dhcp 安装DHCP
[root@jinchuan ~]# /bin/cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf 将他配置文件的模板覆盖原配置文件
[root@jinchuan ~]# sed -i '/#/d' /etc/dhcp/dhcpd.conf 去掉里面有#的行,对原文进行修改
[root@jinchuan ~]# vim /etc/dhcp/dhcpd.conf 修改配置文件,修改为:
1 option domain-name "JinChuan";
2 option domain-name-servers 192.168.200.2;
3 default-lease-time 21600;
4 max-lease-time 43200;
5 log-facility local7;
6
7 subnet 192.168.200.0 netmask 255.255.255.0 {
8 range 192.168.200.190 192.168.200.195;
9 option routers 192.168.200.2;
10 }
这样另两台虚拟机在自动获取IP时可以按着自己设定的范围获取了
如果要固定某台虚拟机在自动获取时指定分给他IP
1 host passacaglia {
2 hardware ethernet 00:0c:29:c9:5e:de;
3 fixed-address 192.168.200.199;
4 }