服务器维护,服务器代维,安全设置,漏洞扫描,入侵检测服务

运维之家

 找回密码
 注册
搜索
查看: 4658|回复: 0

通过PXE远程引导系统

[复制链接]
dirtysea 发表于 2011-10-3 10:12:27 | 显示全部楼层 |阅读模式
服务器托管在外地,系统出了大问题无法正常启动,虽然有远程控制卡可以操作,可以看到屏幕,而且通过控制卡提供的程序可以加载iso,但是本地连过去的网络太慢,很多时间是干着急,这时就想到用PXE引导,尝试了一下还是很方便的。

首先需要**和准备几件事:
  • 网卡支持PXE,有些服务器只支持内置的网卡引导,这时候就得注意这个网卡在交换机上如何访问到。
  • 可以远程控制目标机器的启动过程,KVM,DRAC或Console线都可以
  • 同网段内有另外一台机器可以操作,最好是在自己的内网内操作,否则会不安全
  • 可引导用的vmlinuz和initrd,可以从一些安装盘或live cd上找到
  • 提供服务器的机器需要安装好 syslinux, dhcp服务器和tftp服务器
修改tftp服务器的配置,它通过xinetd启动,编译 /etc/xinetd.d/tftp:
view plaincopy to clipboardprint?

  • service tftp  
  • {  
  •         socket_type             = dgram  
  •         protocol                = udp  
  •         wait                    = yes  
  •         user                    = root  
  •         server                  = /usr/sbin/in.tftpd  
  •         server_args             = -u nobody -s /tftpboot  
  •         disable                 = no  
  •         per_source              = 11  
  •         cps                     = 100 2  
  •         flags                   = IPv4  
  • }  

service tftp{        socket_type             = dgram        protocol                = udp        wait                    = yes        user                    = root        server                  = /usr/sbin/in.tftpd        server_args             = -u nobody -s /tftpboot        disable                 = no        per_source              = 11        cps                     = 100 2        flags                   = IPv4}
启动tftp服务器:
chkconfig tftp on
编辑 /etc/dhcpd.conf:
view plaincopy to clipboardprint?

  • ignore client-updates;  
  • allow booting;  
  • allow bootp;  
  • subnet 192.168.1.0 netmask 255.255.255.0 {  
  •         option routers 192.168.1.1;  
  •         option subnet-mask 255.255.255.0;  
  •         option time-offset -18000;  
  •         range dynamic-bootp 192.168.1.10 192.168.1.100;  
  •         default-lease-time 21600;  
  •         max-lease-time 43200;  
  •         next-server 192.168.1.1;  
  •         filename "/pxelinux.0";  
  • }  

ignore client-updates;allow booting;allow bootp;subnet 192.168.1.0 netmask 255.255.255.0 {        option routers 192.168.1.1;        option subnet-mask 255.255.255.0;        option time-offset -18000;        range dynamic-bootp 192.168.1.10 192.168.1.100;        default-lease-time 21600;        max-lease-time 43200;        next-server 192.168.1.1;        filename "/pxelinux.0";}   
启动dhcpd:
/etc/init.d/dhcpd start
安装引导文件:
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
cp /path/to/vmlinuz /tftpboot/
cp /path/to/initrd /tftpboot/
mkdir /tftpboot/pxelinux.cfg
最后编辑 /tftpboot/pxelinux.cfg/default
view plaincopy to clipboardprint?

  • default linux  
  • label linux  
  •   kernel vmlinuz  
  •   append initrd=initrd  

default linuxlabel linux  kernel vmlinuz  append initrd=initrd   

之后远程控制要引导的机器,控制它使用适当的网卡启动,通过DHCP获得IP引导就可以了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|运维之家

GMT+8, 2024-4-19 11:35 , Processed in 0.276494 second(s), 14 queries .

Powered by Dirtysea

© 2008-2020 Dirtysea.com.

快速回复 返回顶部 返回列表