既然用到gpxe,就试试远程运行systemrecuecd。万一系统出毛病,可以拯救一下。

下载cd

wget http://downloads.sourceforge.net/project/systemrescuecd/sysresccd-x86/4.7.3/systemrescuecd-x86-4.7.3.iso  

装进 http://172.168.8.1/ks/sysrcd目录中

mount -o loop systemrescuecd-x86-4.7.3.iso /mnt/iso  
mkdir -p /var/www/html/ks/sysrcd  
cp -r /mnt/iso/* /var/www/html/ks/sysrcd  

重头戏,依然按前面的方法修改boot2.php即可

  case '\ec:f4:bb:d9:96:40':
    $ip="172.16.36.2:172.16.37.254:255.255.254.0:myhost-16-36-2";
    $ipa=explode(':',$ip);
    echo "ifopen net0\n";
    echo "set net0/ip $ipa[0]\n";
    echo "set net0/netmask $ipa[2]\n";
    echo "set net0/gateway $ipa[1]\n";
    echo "set net0/dns $dns\n";
    echo "set base-url http://172.16.8.1/ks/sysrcd\n";
    echo "kernel \${base-url}/isolinux/rescue32 netboot=\${base-url}/sysrcd.dat nodhcp eth0=172.16.36.2/23 dns=172.16.8.1 gateway=172.16.37.254 rootpass=12345678 vncserver=1:password nameif=eth0:ec:f4:bb:d9:96:40\n";
    echo "initrd ${base-url}/isolinux/initram.igz\n";
    echo "boot\n";
    break;

注意上面,静态ip的设置部分,还有同时设置了sshd和vncserver,方便远程操作。

comments powered by Disqus