PXE, NFS launching Linux test
1. Test purposes
Familiar with Linux through PXE, NFS start-up
2. Test environment
Waves 2 sets of NF420 servers, as follows: Linux operating system is EL-3.0,
2 network card (only 1 network cable), the kernel version number Linux-
2.4.21
-15
Software Package: TFTP-HPA-0.40.tar.gz (Proof Linux9 can be used with it), kernel Linux-
2.4.28
3. Test principle
Please refer to PXE, NFS principle
4. Experimental procedure
1). Install DHCP server DHCPD, configure /etc/dhcpd.conf file
DHCP server IP is 10.151.11.168
PXE launched client MAC address is 00: 02: B3: 55: 84: D2
PXE started client IP 10.151.11.176
Configure the following (red logo as a key modification section):
#################################################
Deny UNKNOWN-Clients;
Option Subnet-Mask 255.255.0.0;
Option Broadcast-Address 10.151.255.255;
Option Domain-name "langchao";
Option routers 10.151.11.168;
DDNS-UPDATE-STYLE NONE NONE NONE
Subnet 10.151.0.0 Netmask 255.255.0.0 {
GROUP {
Host node {
Hardware Ethernet 00:02: B3: 55: 84: D2;
Fixed-Address 10.151.11.176;
FileName "Pxelinux.0";
}
}
}
#################################################
2). Configure TFTP Server
In this experiment, use the PXELinux as a boot tool to support the TFTP Server of the TSIZE parameter, and I find the default TFTP RPM package, then delete the TFTP RPM package.
(Find the current TFTP RPM package: RPM-Q TFTP)
(Delete the current TFTP RPM package: RPM-E TFTP)
TAR XzVF TFTP-HPA-0.40.tar.gz
After CD TFTP-HPA-0.40, make Make Install
At this point, TFTP Server is installed.
Use TFTP service with xinetd, my /etc/xinetd.conf file is as follows
#################################################
Service TFTP
{
Socket_type = DGRAM
Proctocol = UDP
Wait = yes
User = root
Server = / usr / sbin / in.tftpd
}
#################################################
After the configuration is completed, use the Service Xinetd Start to start the TFTP service.
3). Configure the client boot file
Create a directory / tftpboot on the server, will /usr/bin/syslinux/pxelinux.0 (if there is no syslinux, you need to install it first) to copy to / tftpboot /, pxelinux.0 is the startup file, and create a new PXELinux under / tftpboot .cfg directory, the client starts in this directory to find a configuration file corresponding to its IP, the name of the file is the 16-based output of the IP address (such as the client's IP 10: 151: 11) : 176, start the configuration file named 0A
970bb0), the file format is
################################
DEFAULT Linux
PROMPT 0
Label Linux
Kernel VMLinuz
Append ip = dhcp root = / dev / node nfsroot = 10.151.11.168: / remove / node
VGA = Normal
###################
4). Configuring NFS
Establish a directory / remote / node, as the file system started by the customer, in the configuration file of TFTPBoot / Pxelinux.cfg
0A
The 970bb0 is specified from this NFS EXPORT / Remote / Node directory.
The standard catalog should be built, including usr, root, bin, etc.
Below is a script to establish this directory
##############################
CD / Remote / Node
Echo -n "Copy Directory Bin ..."
Cp -a / bin.
Echo "OK"
echo -n "Copy Directory Dev ..."
CP -A / DEV.
Echo "OK"
echo -n "make a node nd0 ..."
MKNOD DEV / NODE B 43 0
CHMOD 600 Dev / Node
Echo "OK"
Echo -n "Copy Directory ETC ..."
CP -A / ETC.
Echo "OK"
Echo -n "Create Directory Home ..."
Mkdir Home
Echo "OK"
echo -n "Copy Directory Lib ..."
CP -A / LIB.
Echo "OK"
Echo -n "Clean Modules of Directory LIB ..."
RM-RF LIB / MODULES
Echo "OK"
Echo -n "Create Directory Root ..."
Mkdir root
Echo "OK"
echo -n "Copy Directory Sbin ..."
Cp -a / sbin.
Echo "OK"
#echo -n "link directory usr ..."
#LN -S / USR USR
#echo "OK"
Echo -n "Create Directory Var ..."
Mkdir var
CD var
Echo "Entering Directory Var"
echo -n "copy lib"
CP -A / VAR / LIB.
echo -n "cache"
Cp -a / var / cache.
echo -n "log"
CP -A / VAR / LOG.
echo -n "tmp"
CP -A / VAR / TMP.
echo -n "spool"
Cp -A / var / spool.
echo -n "yp"
CP -A / VAR / YP.
Cd ../
Echo -n "Leaving Directory Var"
Echo "OK"
Echo -n "Create Directory Proc USR TMP ..."
MKDir Proc USR TMP
Echo "OK"
Echo -n "Change Attribute of TMP ..."
CHMOD 777 TMP
Echo "OK"
Echo -n "Create File Fastboot and Add I Attribute ..."
Touch fastboot
Chattr I fastboot
Echo "OK"
##############################
Edit / etc / exports file: Make the server with the NFS file system directory
##############################
/ remove / node * (rw, async, no_root_squash)
##############################
Edit / Remote / Node / etc / fstab
##############################
None / Proc Proc defaults, INTR 0 1
10.151.11.168:/remote/node / nfs rw 0 0
# 10.151.11.168: / remove / root / root nfs rw 0 1
# 10.151.11.168: / remote / home / home NFS RW 0 1
# 10.151.11.168: / bin / bin NFS RW 0 1
10.151.11.168:/USR / USR NFS RW 0 0
# 10.151.11.168: / lib / lib NFS RW 0 1
# 10.151.11.168: / sbin / sbin NFS RW 0 1
# 10.151.11.168: / etc / etc NFS RW 0 1
##############################
Start NFS using Service NFS Start
5) Compile the kernel
##############################
Make Menuconfig
Make Dep
Make Bzimage
##############################
The client should be supported by the kernel started by NFS.
Kernel Level Auto Configuration's DHCP protocol,
NFS, NFS root
Client network card driver
Copy the BZIMAGE Copy to / TFTPBoot / Directory under the compiled kernel / USR / SRC / ARCH / I386 / BOOT, change the name VMLinuz
6) Start the server's DHCP, NFS, TFTP services
Service DHCPD Start
Service NFS Start
Service Xinetd Start
7) Start the client
Set the client to start from the NIC
5. Test summary
During the test, the following issues occurred:
1. Sometimes the client is started when the IP is not the IP configured by the server, causing the startup launch profile (file obtained according to IP rules).
Analysis: Since there are other DHCP servers in this network segment, this type of problem is resolved: two-stranded lines are used to connect two machines, or disconnect the external network, so that only Server is only server as DHCP in the LAN
2 The client starts through the PXE, there will be few files that can not find and do not affect the execution of the continued startup.
Analysis: The NFS provided by the server is not a clean Linux operating system.
Solve: Do not affect the execution of the startup, you can ignore
3 After the client started by PXE, it was found to have NFS on Mount, but an error occurred during the startup process, prompting "Network is unreachable"
Analysis: Maybe because the NIC is not driven (but actually is not this)
Solve: Modify / Remote / Node / etc / Sysconfig / Network-Scripts / IFCFG-ETH0
And / Remote / Node / etc / ifcfg / network-scripts / ifcfg-eth1, set it to NO, I understand that the NIC does not need to configure the NIC, because the NIC has been used during the PXE process, if used When it is prompted, this error will be prompted.