NFS服务多协议平台建设

网络 网络管理
下面我们来介绍一下NFS服务在多协议平台中的建设。包括了基础介绍,以及环境说明。之后针对不同协议的配置进行了细致的说明。

随着嵌入式卡发的不断发展,目前在平台中加入NFS服务,以及ftp协议等内容是时常遇到的事情。那么如何构架这样一个平台呢?下面我们就来详细介绍一下具体的实现步骤。

一、 介绍

简单原理介绍:无光软驱服务器通过PXE网卡启动,从dhcp服务器获取IP 通过tftp 下载pxelinux.0文件找到pxelinux.cfg里的配置文件,按配置文件找着vmlinuz引导centos进入安装界面,之后选择NFS服务方式安装系统.

另: 如需要实现全自动安装 要安装 Kickstart  软件包并配置.本文并不讨论

二、环境说明

本文测试环境及用到的软件

Server: centos 5.2  dhcp nfs tftp  ip:192.168.1.251 (此IP只需要与服务器网卡相连,不管是什么都可以)

三、安装配置过程及基本讲解:

安装相应的软件:yum –y install dhcp* nfs* tftp*

1、 配置tftp more /etc/xinetd.d/tftp

  1. # default: off  
  2. # description: The tftp server serves files using the trivial file transfer \  
  3. #       protocol.  The tftp protocol is often used to boot diskless \  
  4. #       workstations, download configuration files to network-aware printers, \  
  5. #       and to start the installation process for some operating systems.  
  6. # trad: liuyu  
  7. # blog: liuyu.blog.51cto.com  
  8. # bbs: www.linuxtone.org  
  9. service tftp  
  10. {  
  11. disable = no   #默认是yes 改为no  
  12. socket_type             = dgram 
  13. protocol                = udp 
  14. wait                    = yes 
  15. user                    = root 
  16. server                  = /usr/sbin/in.tftpd  
  17. server_args             = -u nobody -s /tftpboot  #添加nobody可以访问  
  18. per_source              = 11 
  19. cps                     = 100 2  
  20. flags                   = IPv4 

重启xinetd服务: /etc/init.d/xinetd restart

查看tftp 是否启动:# chkconfig --list |grep tftp

tftp:           on

2、 配置nfs服务

  1. mount /iso/CentOS-5.2-i386-bin-1of6.iso /mnt -o loop  #我是挂载的镜像文件,你们可以挂载光驱  
  2. echo "/tftpboot *(ro,sync)" > /etc/exports  
  3. echo "/mnt *(ro,sync)" > /etc/exports   #此二步设置共享的目录  
  4. exportfs –a   #使配置生效  
  5. /etc/init.d/portmap start  &&/etc/init.d/nfs start    #重启服务  
  6. Showmount –e localhost  #看查共享的目录  
  7. Export list for localhost:  
  8. /mnt      *  
  9. /tftpboot * 

3、配置dhcp

直接copy我的配置 

  1. # more /etc/dhcpd.conf  
  2. # DHCP Server Configuration file.  
  3. #   see /usr/share/doc/dhcp*/dhcpd.conf.sample  
  4. #  
  5. # trad: liuyu  
  6. # blog: liuyu.blog.51cto.com  
  7. # bbs: www.linuxtone.org  
  8. ddns-update-style interim;  
  9. ignore client-updates;  
  10. allow booting;  
  11. allow bootp;  
  12. subnet 192.168.1.0 netmask 255.255.255.0 {  
  13. option routers 192.168.1.251;  
  14. option subnet-mask 255.255.255.0;  
  15. option domain-name-servers 192.168.1.251;   #本地IP  
  16. option time-offset -18000; # Eastern Standard Time  
  17. range dynamic-bootp 192.168.1.12 192.168.1.254;  #要分区的IP  
  18. default-lease-time 21600;  
  19. max-lease-time 43200;  
  20. # Group the PXE bootable hosts together  
  21. # PXE-specific configuration directives...  
  22. next-server 192.168.1.251;  
  23. filename "/pxelinux.0";   #方便查找配置文件  
  24. }   
  25. /etc/init.d/dhcpd start  启动服务 

4、 配置pxe所需要的文件 Mkdir /tftpboot/pxelinux.cfg

  1. cp /usr/lib/syslinux/pxelinux.0 /tftpboot/  
  2. cp /mnt/isolinux/vmlinuz /tftpboot/  
  3. cp /mnt/isolinux/initrd.img /tftpboot/  
  4. cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default  

四、测试

启动服务器,一般是按F12选择进入PXE网络启动.这时就会自动获取IP并进入Boot: 界面.按linux text 进入.之后选择NFS服务安装系统.

五、配置文件详解

dhcpd.conf配置的有关说明:

parameters(参数):

ddns-update-style 配置DHCP-DNS互动更新模式

default-lease-time 指定缺省租赁时间的长度,单位是秒

max-lease-time 指定最大租赁时间长度,单位是秒

hardware 指定网卡接口类型和MAC地址

server-name 通知DHCP客户服务器名称

get-lease-hostnames flag 检查客户端使用的IP地址

fixed-address ip 分配给客户端一个固定的地址

authritative 拒绝不正确的IP地址的要求

declarations(声明):

shared-network 用来告知是否一些子网络分享相同网络

subnet 描述一个IP地址是否属于该子网

range 起始IP 终止IP 提供动态分配IP 的范围

host 主机名称 参考特别的主机

group 为一组参数提供声明

allow unknown-clients或deny unknown-client 是否动态分配IP给未知的使用者

allow bootp或deny bootp 是否响应激活查询

allow booting或deny booting 是否响应使用者查询

filename 开始启动文件的名称,应用于无盘工作站

next-server 设置服务器从引导文件中装如主机名,应用于无盘工作站

option(选项):

subnet-mask 为客户端设定子网掩码

domain-name 为客户端指明DNS名字

domain-name-servers 为客户端指明DNS服务器IP地址

host-name 为客户端指定主机名称

routers 为客户端设定默认网关

broadcast-address 为客户端设定广播地址

ntp-server 为客户端设定网络时间服务器IP地址

time-offset 为客户端设定和格林威治时间的偏移时间,单位是秒.

责任编辑:佟健 来源: csdn.net
相关推荐

2010-08-03 17:07:55

NFS服务器

2010-08-05 11:32:07

NFS协议

2010-08-03 10:58:25

NFS Server

2010-08-06 13:12:55

NFS服务器

2023-01-31 08:26:57

企业服务整合

2012-02-08 11:15:43

云计算微软

2010-08-05 13:28:57

2010-08-03 15:48:42

VMware存储协议N

2010-08-03 16:17:17

NFS协议

2010-08-05 13:23:05

NFS协议

2010-08-04 11:18:45

Linux NFS

2023-12-06 19:04:31

多平台消息推送

2010-08-04 13:02:30

NFS服务

2010-08-06 10:16:55

RIP协议Linux

2016-02-15 10:50:50

服务器华为

2023-03-30 08:58:14

2010-08-03 11:17:31

AIX 5LNFS Server

2010-07-28 16:07:30

NFS协议pNFS

2009-09-16 08:55:07

2010-08-04 17:04:20

AIXNFS
点赞
收藏

51CTO技术栈公众号