LINUX下搭建DHCP和NIS服務器
一. DHCP服務器配置
1.安裝DHCP服務軟件包
RHEL4第四張光盤,dhcp-3.0.1-12_EL.i386.rpm
掛載 mount /dev/cdrom /media/cdrom/
安裝DHCP包
rpm -ivh /media/cdrom/RedHat/RPMS/dhcp-3.0.1-12_EL.i386.rpm
2. dhcp.conf配置文件解析
復制樣例文件到 /etc/
cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
配置實例
Ddns-update-style interim;
Ignore client-updates;
Subnet 10.0.0.0 netmask 255.0.0.0 {
# --- default gateway
option routers “10.0.0.0.1”;
option subnet-mask “255.0.0.0”;
# option nis-domain “domain.org”;
# option domain-name "domain.org";
# option domain-name-servers 10.0.0.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 10.0.0.100 10.0.0.200;
default-lease-time 21600;
max-lease-time 43200;
"/etc/dhcpd.conf" 31L, 852C 1,1
# 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;
}
}
3. 多網(wǎng)絡接口時需要配置文件
/etc/sysconfig/dhcpd
DHCPDARGS=[網(wǎng)絡接口]
4. 啟動dhcpd服務
Service dhcpd start
5. 客戶端配置動態(tài)獲取IP
二. NIS服務器配置
1. 安裝NIS服務軟件包
默認安裝NIS服務器查詢和管理工具軟件
ypbind-1.17.2-3
yp-tools-2.8-7
NIS服務器RPM包,位于第一張盤 ypserv-2.13-5.i386.rpm
2. 啟動time和time-udp服務
Chkconfig time on
Chkconfig time-udp on
重啟xinetd
3. 建立NIS域名
Nisdomainname nisserver
啟動自動加載
Echo ‘/bin/nisdomainname nisserver’ >> /etc/rc.d/rc.local
Echo ‘NISDOMAIN=nisserver’ >> /etc/sysconfig/network
4. 設(shè)置ypserv.cond服務配置文件
(1) ypserv.conf 文件配置“/etc/ypserv.conf”
(2) 手工建立securenets安全配置文件 “/var/yp/securenets”
Host 127.0.0.1
255.0.0.0/10.0.0.0
5. 啟動NIS服務器
啟動 Portmap ; ypserv ; yppasswdd 三個服務
6. 構(gòu)建NIS數(shù)據(jù)庫
/usr/lib/yp/ypinit -m
三. NIS客戶端配置
1. 安裝NIS客戶端軟件包(默認已安裝)
ypbind-1.17.2-3
yp-tools-2.8-7
2. 設(shè)置hosts文件
echo ’10.0.0.10 localhost.localdomain’ >> /etc/hosts
3. 建立NIS域名
Nisdomainname nisclient
啟動自動加載
Echo ‘/bin/nisdomainname nisclient’ >> /etc/rc.d/rc.local
Echo ‘NISDOMAIN=nisclient’ >> /etc/sysconfig/network
4. 設(shè)置yp.conf配置文件
Echo ‘domain [域名] server [主機名] ’ >> /etc/yp.conf
5. 設(shè)置/etc/nsswitch.conf文件使用NIS
Passwd: files nis
Shadow: files nis
Group: files nis
Hosts: files nis dns
6.啟動ypbind服務
Portmap ; ypbind啟動這兩個服務
7. NIS客戶機測試與NIS服務器連接
命令: yptest 測試NIS服務器的域名,主機,數(shù)據(jù)庫,內(nèi)容。
ypwitch –x 查看NIS服務器數(shù)據(jù)庫和映射文件名稱
ypcat –x 同上
8. NIS客戶端登陸
提示:登陸失敗,關(guān)閉防火墻。
命令:service iptables stop
【編輯推薦】