Linux diskless workstation Practices _unix Linux

Source: Internet
Author: User
Tags get ip

First, the principle of remote start

Before starting, the client has no operating system or floppy disk or hard disk, it only has the basic components of the computer: CPU, memory, motherboard, etc. But the most important thing is to have the NIC and start the bootrom. The client can only obtain the operating system from the network. Linux diskless remote boot and Novell, Winnt under the diskless boot technology is not the same, not the use of RPL (Remote Initial program Loader), but based on the standard BOOTP/DHCP and TFTP protocol, And the file system is established through NFS file system. Compared with the first two kinds, it has more versatility and adaptability. Dos,win95,winnt and Linux customers can be started remotely based on Linux systems.

Because of their own network card (3c905b-tpo100, there is a bug, according to the etherboot of the instructions did not modify the success, is now a floppy disk instead of an EPROM, not much to say, but also please go directly to the http://sourceforge.net/ Download the required source code, etc. or to compile their own source code required.

The following is a brief introduction to Linux startup principles:
1. After the client PC is turned on, the TCP/IP bootrom gain control right before doing self test.
2.Bootprom send out BOOTP/DHCP request and get IP.
3. If the server receives the request from the personal computer, it will send back the BOOTP/DHCP response, including the client's IP address, the preset gateway and the boot image file. Otherwise, the server ignores this requirement.
4.Bootprom Download the boot image file from the server by the TFTP communication protocol.
5. PC through this boot image file boot, this boot file can be just a simple boot program can also be operating system.
6. The boot image file will contain kernel loader and compressed kernel, which will support the NFS root system.
7. The remote client starts the machine according to the downloaded file.

All OK!!! It's easy! Here's how to build a Linux remote boot.

Second, remote boot instance
As an example defines the following:
Linux Server: Server (ip:192.168.0.254)
First client: PC01 (ip:192.168.0.1)
Second client: PC02 (ip:192.168.0.2)
All remote Boot customer directory:/client
First Remote boot client directory:/CLIENT/PC01
Second Remote boot client directory:/CLIENT/PC02
Support Rsh

First recompile the Linux kernel.
Make Menuconfig
Attention to network support, Nfs-root support, BootP (DHCP) support must be included.
Make clean
Make DEP
Make Bzimage
Make modules
Make Modules_install
After the above command, you will find the client-initiated image file in the/usr/src/linux/i386/boot directory, after compiling the new kernel, with Mknbi-linux (Mknbi-linux bzimage VMLINUZ.NB) processing, the VMLINUZ.NB can be placed under the/tftpboot.
Then execute the following command: Mknod/dev/nfsroot B 0 255 modifies the boot device to point to Nfsroot.

The following modifies the server for the remote client to establish the file system for the remote client.

Add in Server/etc/exports:
/CLIENT/PC01 192.168.0.1 (rw, No_root_squash)
/CLIENT/PC02 192.168.0.2 (rw, No_root_squash)
/home 192.168.0.1/255.255.255.0 (Rw,no_root_squash)

With DHCP, add support for remote clients in/etc/dhcpd.conf, where the server address is 192.168.0.254:
# dhcpd.conf

# Global Options
Option Domain-name "server.ustc.edu.cn";
Option Domain-name-servers 202.38.64.1;

# Intranet
Subnet 192.168.0.0 netmask 255.255.255.0 {
Range 192.168.0.1 192.168.0.250;
default-lease-time-1;

# option Root-path "/CLIENT/PC01";
Option Dhcp-server-identifier 192.168.0.254;
Option broadcast-address 192.168.0.255;
# option Routers 198.168.0.254;

Server-name "Server";
Next-server 192.168.0.254;
FileName "/boot/vmlinuz";
Host pc01{
Option Root-path "/CLIENT/PC01";
Hardware Ethernet 00:01:02:96:65:92;
Fixed-address 192.168.0.1;
}
Host pc02{
Option Root-path "/CLIENT/PC02";
Hardware Ethernet 00:01:02:98:92:55;
Fixed-address 192.168.0.2;
}
}
Subnet 202.38.64.0 netmask 255.255.255.0 {
}
Please refer to: dhcp-howto

To set up a remote client directory on the server:
/client
/client/pc01
/client/pc02

Let's talk about PC01 's practice.

The PC01 directory includes: Bin,dev,etc,home,lib,mnt,proc,root,sbin,tmp,usr,var directory.
We are completely copying Bin,dev,etc,lib,sbin,usr,var directly, Home,mnt,proc,root,tmp is a new empty directory, (at that time was reinstalled a support including Dhcp,nfs,rsh, as small as possible, As clean as possible Linux, and then completely copy them all over, so there must be a lot of unnecessary things can be deleted, but now the level does not follow, according to the reference to do not succeed, had to use this convenient way: (, etc. later slowly delete unnecessary documents)
Note that the/CLIENT/PC01/ETC/RC.D boot file must be modified: MOUNT-AVT Nonfs is mount-av. The NFS root file system is allowed. (We're Debian Woody, this file has changed to/client/pc01/etc/init.d/mountall.sh, and our mount-a-t NOPROC,NOSMBFS)

Modify the/client/pc01/etc/fstab file in the following format:
192.168.0.254:/client/pc01/nfs DEFAULTS,RW 0 0
192.168.0.254:/home/home NFS RW,BG 0 0
PROC/PROC proc Defaults 0 0

Modify Client/pc01/etc/hostname:
Pc01

Modify Client/pc01/etc/hosts:
127.0.0.1 localhost
192.168.0.254 pc00
192.168.0.1 PC01
192.168.0.2 PC02

Modify CLIENT/PC01/ETC/HOSTS.EQUIV:
+
Server
Pc01
Pc02

Modify Client/pc01/etc/mtab:
192.168.0.254:/client/pc01/nfs RW 0 0
PROC/PROC proc RW 0 0
Devpts/dev/pts devpts rw,gid=5,mode=620 0 0
192.168.0.254:/home/home NFS rw,bg,addr=192.168.0.254 0 0

Modify Client/pc01/etc/network/interfaces
Face eth0 inet Static
Address 192.168.0.1
Netmask 255.255.255.0
Network 192.168.0.0
Broadcast 192.168.0.255
Gateway 192.168.0.254

Next you must establish a chain to link the IP address of the remote client to the/CLIENT/PC01 directory.
$:ln-s PC01 192.168.0.1

Do PC02 can copy pc01 over, and the above several documents to modify.

Below the personal directory to set the RSH support:
Home/username/.rhosts

192.168.0.254 username
192.168.0.1 username
192.168.0.2 username

Finally, verify that the NFSD,TFTPD and BOOTPD daemons on the server are started.
All done! The remote boot will soon be available in about 10 seconds to enjoy Linux.
For NFS,TFTP,BOOTP (DHCP) settings, see How-to.

As a point of thumb, it's best to put all of the client's files in a separate partition so that you can install a basic system (like a normal installation) on the partition. And then as a basis for modification (the recommended use of Debian is easier to crop). If you need to install any software on the client at a later time, you can do this:
Chroot/client/pc01
Dselect or Apt-get.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.