linux diskless

来源:互联网 发布:tensorflow 可以做什么 编辑:程序博客网 时间:2024/06/17 12:39

1, setup dnsmasq

    /etc/dnsmasq.conf

interface=eth2   // connected to the dhcp client
dhcp-range=192.168.2.50,192.168.2.150,255.255.255.0,12h
dhcp-option=3,192.168.2.1
expand-hosts
dhcp-boot=pxelinux.0,192.168.2.1,192.168.2.1  // pxelinux.0 -> yum install syslinux
enable-tftp
tftp-root=/home/tftp-root  // tftp directory, chmod 777

dhcp-host=00:1d:7d:43:90:d1,192.168.2.10  // bind the dhcp client's mac address to 192.168.2.10

2, iptable打开67,68,69端口

/etc/sysconfig/iptables

-A INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT

-A INPUT -m state --state NEW -m udp -p udp --dport 68 -j ACCEPT

-A INPUT -m state --state NEW -m udp -p udp --dport 67 -j ACCEPT


3, setup nfs

   /etc/export

/home/tftp-root/192.168.2.10            192.168.2.1/24(insecure,rw,sync,no_root_squash,no_all_squash)

4, setup tftp setting

   /home/tftp-root:

-rwxrwxrwx  1 root root   26828 Sep  1 13:44 pxelinux.0

drwxrwxrwx  2 root root    4096 Sep  8 16:17 pxelinux.cfg

        -rw-r--r-- 1 root root 274 Sep  8 16:05 C0A8020A

               default         2.6.32
               timeout         3

               label           2.6.32
               kernel          192.168.2.10/vmlinuz
               append ip=192.168.2.10:192.168.2.1:192.168.2.1:255.255.255.0:diskless:eth0:off root=/dev/nfsroot rw enforcing=0 nfsroot=192.168.2.1:/home/tftp-root/192.168.2.10

drwxrwxrwx 13 root root    4096 Sep  8 16:32 192.168.2.10

        -rw-r--r--   1 root root 4710128 Sep  8 16:26 vmlinuz

5, compile linux kernel

Code maturity level options  --->  [*] Prompt for development and/or incomplete code/drivers  Device Drivers --->  [*] Networking support  Networking options --->    <*> Packet socket    <*> Unix domain sockets    [*] TCP/IP networking    [*]   IP: multicasting    [*]   IP: kernel level autoconfiguration    [*]     IP: DHCP support (NEW)Networking support  --->
  Networking options  --->  
  [*]   IP: kernel level autoconfiguration                          [*]     IP: DHCP support                          [*]     IP: BOOTP support  
File systems --->  Network File Systems  --->    <*> file system support    [*]   Provide NFSv3 client support    [*]   Root file system on NFS
 
* the most import things is that the device driver of dhcp client network adaptor should be include the kernel, not module.

 

 

原创粉丝点击