虚拟机linux架设DHCP服务

本次试验,环境如下:

宿主机操作系统:windows xp

虚拟机操作系统:red hat enterprise linux 5

一.  需拟机的网卡模式:设置为网桥,并手动设置对应网卡的ip地址,如为多网卡,需要修改/etc/sysconfig/dhcpd文件中的DHCPDARGS=eth*

查询主机是否己经安装dhcp软件: rpm -qa | grep dhcp

出现dhcpv6-client-1.0.10-16.el5
dhcp-3.0.5-18.el5
dhcp-devel-3.0.5-18.el5     为己安装

如未安装,挂载cdrom: mount  /dev/cdrom /mnt/cdrom ,然后安装dhcpd服务软件

二.  下面进行dhcp服务软件的配置 :

初始安装dhcpd软件后,使用的配置文件为: /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample

执行:cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf   这样就己经拥有了一份最原始的dhcp服务配置。

dhcpd.conf的原始配置如下:

 

ddns-update-style interim;
ignore client-updates;

subnet 192.168.0.0 netmask 255.255.255.0 {    //设置子网及掩码

# --- default gateway
	option routers		192.168.0.1;     
	option subnet-mask		255.255.255.0;

	option nis-domain		"domain.org";
	option domain-name		"domain.org";
	option domain-name-servers	192.168.1.1;

	option time-offset		-18000;	# Eastern Standard Time
#	option ntp-servers		192.168.1.1;
#	option netbios-name-servers	192.168.1.1;
# --- 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 192.168.0.128 192.168.0.254;      //dhcp允许分配的ip池
 	default-lease-time 21600;
	max-lease-time 43200;

	# we want the nameserver to appear at a fixed address
	host ns {
		next-server marvin.redhat.com;
		hardware ethernet 12:34:56:78:AB:CD;
		fixed-address 207.175.42.254;
	}
}

然后按需修改即可。

你可能感兴趣的:(虚拟机,windows,linux,XP,dhcp软件)