Linux NFS Root and PXE-Boot

November 6, 2006

Home· Linux

Linux kernel hacking and test running on the same machine becomes a major pain. This tutorial explains how to separate the two easily for a quick code-and-test loop. This tutorial explains how to setup a Linux thin client that boots using PXE by pulling a remote Linux kernel image and mounting a remote root file system over NFS. This is only possible if your client machine has a network card that supports this (do you remember seeing some type of option like press N to boot from network just after posting?). I am using Fedora Core 5 as my server, so some of the details may be specific to FC.
Most of the details of setting up the PXE boot server were found at Setting up a PXE-Boot Server.
1) yum install tftp-server dhcp
Make sure you have an NFS server.
2) create /etc/dhcpd.conf

allow bootp;
allow booting;   ddns-update-style interim;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.254;
default-lease-time 3600;
max-lease-time 4800;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "llama.net";
option time-offset -8;
}   host llama0 {
hardware ethernet 04:4B:80:80:80:03;
fixed-address 192.168.0.254;
option host-name "llama0";
filename "pxelinux.0";
}

Change MAC address to match that of the client machine.

3) Create the directory and add the following line to /etc/exports for the nfs share.

/nfsroot *(rw,no_all_squash,no_root_squash)

4) cp -a /bin /dev /etc /home /lib /mnt /sbin /tmp /usr /var /nfsroot

from a good Fedora Core install. You'll have to cleanup and change some of these files for your client at some point.

5) Activate tftp within xinetd by changing disable=yes to disable=no in /etc/xinetd.d/tftp. Restart xinetd. The tftp root is at /tftpboot.

6) Compile your kernel with the following options and move bzImage to /tftpboot/:

- NFS filesystem support (CONFIG_NFS_FS).

- Root file system on NFS (CONFIG_ROOT_NFS).

- Ethernet (10 or 100Mbit) (CONFIG_NET_ETHERNET).

- The ethernet driver for the clent's network card.

- IP: kernel level autoconfiguration (CONFIG_IP_PNP)

- BOOTP support (CONFIG_IP_PNP_BOOTP)

7) Configure pxelinux. First create the directory /tftpboot/pxelinux.cfg (and make it world readable). Inside that directory you need to create a number of zero size files (use touch):

01-04-4B-80-80-80-03

C

C0

C0A

C0A8

C0A80

C0A800

C0A800F

C0A800FE

01-04-4B-80-80-80-03

The first 8 are the hex representation of the 192.168.0.254 IP address that your PXE boot client will be assigned. The permutations allow a broader IP subnet to be searched first for matches. The last entry is the MAC address of your PXE boot client's NIC (with dashes substituted for the colons), with '01' pre-pended. The "01" at the front represents a hardware type of Ethernet, so pxelinux.0 see's the configuration string as an IP address.

Copy /usr/lib/syslinux/pxelinux.0 from your Fedora install to /tftpboot/

8) Now create the default pxelinux configuration inside the new file

/tftpboot/pxelinux.cfg/default:

prompt 1
default linux
timeout 100   label linux
kernel bzImage
append init=/sbin/init root=/dev/nfs rw nfsroot=192.168.0.1:/nfsroot ip=192.168.0.254:192.168.0.1:192.168.0.1:255.255.255.0:llama0::off noapic acpi=off

The last line is where you can stick any kernel parameters needed. You'll notice this menu is somewhat similar to a grub config file.

Check out the following articles for more information:

PXELINUX - SYSLINUX for network boot

NFS-Root-Client Mini-HOWTO

NFS-Root mini-HOWTO

NFS-Root

http://www.tldp.org/HOWTO/Diskless-root-NFS-other-HOWTO-4.html

Linux NFS Root and PXE-Boot的更多相关文章

  1. Linux NFS 服务部署

    系统环境:Oracle Linux 5.7 服务端:192.168.1.111 客户端:192.168.1.171 一.服务端配置 二.客户端配置 一.服务端配置 1.依次启动portmap和nfs服 ...

  2. Linux NFS存储服务部署

    什么是NFS 中文意思是网络文件系统,主要功能是通过网络(一般是局域网)让不同主机之间可以共享文件或目录 NFS属于本地文件存储服务 缺点1: 1 2 3 4 5 6 7 windows上无法使用   ...

  3. Redhat Linux NFS配置

    Linux下,All deviceis file,所有的设备都是文件.当我们需要把某些文件夹就或者文件共享给其他用户,就可以使用网络文件系统. 本文介绍Redhat Linux下的NFS配置. 在使用 ...

  4. linux nfs

    linux(十四)之linux NFS服务管理 学到这里差不多就结束了linux的基础学习了,其实linux的内容并不难,我们要经常的反复的去操作它,多多和它去联络感情才能很好的掌握这个linux. ...

  5. Linux破解root密码

    实验环境                 虚拟机软件:VMware Workstation                 操作系统:Read Hat Enteprise 6.3      1.破解r ...

  6. Linux NFS 说明,配置及故障分析

    一.NFS服务简介 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操 ...

  7. linux nfs文件夹、文件共享

    ◆一.概念 NFS是网络文件系统(Network File System)的简称,是分布式计算机系统的一个组成部分,可实现在异构网络上共享和装配远程文件系统. NFS由SUN公司开发,目前已成为文件服 ...

  8. Linux nfs下载安装与简单配置

    1.什么是NFS? 全称 network file system 网络文件系统 通过网络存储和组织文件的一种方法或机制. 2.为什么要用共享存储? 前端所有的应用服务器接收到用户上传的图片.文件.视频 ...

  9. linux nfs服务配置挂载以及oracle使用nfs存储挂载注意事项

    服务端共享目录 /home/XXX/nfs_shared 172.16.22.0/24(rw,no_root_squash) service nfs restart 常用命令: 查看所有nfs共享目录 ...

随机推荐

  1. Spark初识

    一.简介 1.什么是Spark 官网地址:http://spark.apache.org/ Apache Spark™是用于大规模数据处理的统一分析引擎. 从右侧最后一条新闻看,Spark也用于AI人 ...

  2. 开发FTP不要使用sun.net.ftp.ftpClient

    转自:http://cai21cn.iteye.com/blog/700188 在开发一个web应用过程中,需要开发一个服务使用ftp功能将数据传输一个网外的ftp服务器.最初使用sun.net.ft ...

  3. openfire接收离线消息

    先接收离线消息后再通知openfire上线 //获取离线消息 OfflineMessageManager offlineMessageManager=new OfflineMessageManager ...

  4. Android开发(十二)——头部、中部、底部布局

    参考: [1] http://www.thinksaas.cn/group/topic/82898/ [2] http://***/Article/12399 其实RadioGroup不好使,不能图片 ...

  5. 学习MongoDB(Troubleshoot Replica Sets) 集群排除故障

    Test Connections Between all Members(集群中节点网络测试) 在进行Mongodb集群时,每个节点的网络都需要互动,假设有3个服务器节点. m1.example.ne ...

  6. Extjs4.2x与富文本框编辑器KindEditor的整合

    Extjs4本身的HtmlEditor编辑器,太鸡肋了,简单的html能够应付一下,稍加复杂的就无能为力了. 对于Extjs的HtmlEditor扩展主要有三个方向,一个是扩展其本身的htmlEdit ...

  7. 十分钟学会Charles抓包(iOS的http/https请求)

    ### 原文地址,感谢作者 : http://www.jianshu.com/p/5539599c7a25 Charles安装 HTTP抓包 HTTPS抓包 1. Charles安装 官网下载安装Ch ...

  8. Java知多少(12)运算符

    Java中的运算符和C/C++相差无几. 数学运算符 数学运算,结果为一个数值.见下表: 运算符 说明 举例 + 加法 1 + 2 - 减法 4 - 3.4 * 乘法 7 * 1.5 / 除法 3.5 ...

  9. 大杂烩 -- 四种生成和解析XML文档的方法详解

    基础大杂烩 -- 目录 众所周知,现在解析XML的方法越来越多,但主流的方法也就四种,即:DOM.SAX.JDOM和DOM4J DOM:在现在的Java JDK里都自带了,在xml-apis.jar包 ...

  10. VMware Workstation11安装Mac OS X 10.10虚拟机

    原文:http://jingyan.baidu.com/article/3f16e003eac66e2591c103e0.html 优化:http://www.cnblogs.com/yipu/p/4 ...