|
这几天接触PXE网络远程启动PE,参考网上的各位PE中的PXE服务器配置,经多次试验,完全免配!
目前流行的PXE服务器有两种:HaneWin的DHCP,还有一种是TFTPD32
经试验,两种大同小异,都差不多,配置好后远程客户机都 能自动连接,并且可以直接上网,有点区别是:若用TFTPD32作服务器,远程端可以直接上网(稍等一会);而用DHCP作服务器,要手动更新IP后才能上网,两者均不需断开服务器!(网上有些PE网启后不能上网,主要是配置问题)
CMD 如下:
这是DHCP.cmd
@echo off
PUSHD %~dp0
SET TP=%CD%
rem ==========以下此行为启动引导文件,请自行修改=======
set bootfile=PXEgrldr.0
rem ==========================================================
IF NOT EXIST %systemroot%\SYSTEM32\PENETCFG.EXE GOTO END
rem 关闭
if exist DHCP.7z 7z.exe x DHCP.7z -y -aos -o"%WinDir%\System32"
cd /d %systemRoot%\system32
if exist dhcp4nt.exe dhcp4nt.exe -remove
PECMD FIND TFTPD32.EXE,KILL TFTPD32.EXE
set BaseDirectory=
for %%i in (C D E F G H I J K L M N O M P Q R S T U V W) DO IF EXIST %%i:\%bootfile% set BaseDirectory=%%i:\
setlocal
set/a a=-2
for /f "usebackq tokens=2 delims=:" %%i in (`ipconfig`) do (
set b=%%i
call :getip
)
for /f "tokens=1-3,4 delims=." %%i in ("%_myip%") do set IP_Pool=%%i.%%j.%%k.100
>%WinDir%\System32\DHCPsrv.ini echo.[License]
>>%WinDir%\System32\DHCPsrv.ini echo.Key=BBLZ26803UBBCAT9
>>%WinDir%\System32\DHCPsrv.ini echo.Name=Free User
>>%WinDir%\System32\DHCPsrv.ini echo.[DHCPsrv]
>>%WinDir%\System32\DHCPsrv.ini echo.Profile0=本地连接
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPDirectory=%BaseDirectory%
>>%WinDir%\System32\DHCPsrv.ini echo.Multicast=0
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPEnable=1
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPPort=69
>>%WinDir%\System32\DHCPsrv.ini echo.TFTPMode=0
>>%WinDir%\System32\DHCPsrv.ini echo.Log=0
>>%WinDir%\System32\DHCPsrv.ini echo.TestIP=1
>>%WinDir%\System32\DHCPsrv.ini echo.ChangeIP=1
>>%WinDir%\System32\DHCPsrv.ini echo.EnableMAC=1
>>%WinDir%\System32\DHCPsrv.ini echo.[本地连接]
>>%WinDir%\System32\DHCPsrv.ini echo.SubnetMask=%_mask%
>>%WinDir%\System32\DHCPsrv.ini echo.BaseIP=%IP_Pool%
>>%WinDir%\System32\DHCPsrv.ini echo.Range=101
>>%WinDir%\System32\DHCPsrv.ini echo.BootFile=%bootfile%
>>%WinDir%\System32\DHCPsrv.ini echo.GatewayIP=%_Gateway%
>>%WinDir%\System32\DHCPsrv.ini echo.InterfaceIP=%_myip%
dhcp4nt.exe -install
endlocal
PECMD.EXE LINK !%%DESKTOP%%\HaneWin网启服务端,dhcpsrv.cpl,,dhcp.ico
PECMD.EXE LINK !%%Programs%%\网络启动服务器\开启HaneWin网络启动服务端,dhcp4nt.exe,-install,shell32.dll#96
PECMD.EXE LINK !%%Programs%%\网络启动服务器\关闭HaneWin网络启动服务端,dhcp4nt.exe,-remove,shell32.dll#95
PECMD.EXE LINK !%%Programs%%\网络启动服务器\HaneWin网启服务端,dhcpsrv.cpl,,dhcp.ico
PECMD FILE "%%DESKTOP%%\开启HaneWin网络启动服务端.*"
PECMD FILE "%%DESKTOP%%\TFTPD32网络启动服务端.*"
rem 删除共享名PEroot,建立共享名为Peroot共享资源为%BaseDirectory%
PECMD EXEC CMD /C "net share PEROOT /d"
PECMD EXEC CMD /C "net share PEROOT=%BaseDirectory% /unlimited"
PECMD FIND EXPLORER.EXE,KILL EXPLORER.EXE
start dhcpsrv.cpl
PECMD.EXE MESS 远程启动网启服务器.启动成功!\n\n已将本机光盘 %BaseDirectory% 共享给远程客户(\\Winpe\PEROOT,用户名:Guest,密码为空)\n\n@提示 #ok *50000
if %BaseDirectory%.==. PECMD.EXE MESS 系统无法找到文件 %bootfile% 所在的盘符!\n\n请确认后, 手动配置网络服务器\n\n@提示 #ok *50000
EXIT
:END
PECMD.EXE MESS 先启动网络支持程序.再启动网网络启动服务器!@提示 #ok *30000
EXIT
:getip
set /a a=%a%+1
if %a%==1 set _myip=%b%
if %a%==2 set _mask=%b%
if %a%==3 set _Gateway=%b%
goto :eof
============================以下是TFTPD32的====================
@echo off
PUSHD %~dp0
SET TP=%CD%
rem ==========以下此行为启动引导文件,请自行修改=======
set bootfile=PXEgrldr.0
rem ==========================================================
IF NOT EXIST %systemroot%\SYSTEM32\PENETCFG.EXE GOTO END
rem 关闭
pecmd file "%TP%\TFTPD32.EXE=>%systemRoot%\system32\"
cd /d %systemRoot%\system32
if exist dhcp4nt.exe dhcp4nt.exe -remove&&pecmd wait 500
PECMD FIND TFTPD32.EXE,KILL TFTPD32.EXE&&pecmd wait 500
set BaseDirectory=
for %%i in (C D E F G H I J K L M N O M P Q R S T U V W) DO IF EXIST %%i:\%bootfile% set BaseDirectory=%%i:\
set/a a=-2
for /f "usebackq tokens=2 delims=:" %%i in (`ipconfig`) do (
set b=%%i
call :getip
)
for /f "tokens=1-3,4 delims=." %%i in ("%_myip%") do set/a IP_Pool=100*256*256*256+%%k*256*256+%%j*256+%%i
for /f "tokens=1-3,4 delims=." %%i in ("%_mask%") do set/a mask=%%l*256*256*256+%%k*256*256+%%j*256+%%i
for /f "tokens=1-3,4 delims=." %%i in ("%_Gateway%") do set/a Gateway=%%l*256*256*256+%%k*256*256+%%j*256+%%i
>%WinDir%\System32\TFTPD32.INI echo.[TFTPD32]
>>%WinDir%\System32\TFTPD32.INI echo.
>>%WinDir%\System32\TFTPD32.INI echo.Console Password=tftpd32
>>%WinDir%\System32\TFTPD32.INI echo.TftpPort=69
>>%WinDir%\System32\TFTPD32.INI echo.Negociate=1
>>%WinDir%\System32\TFTPD32.INI echo.ShowProgressBar=1
>>%WinDir%\System32\TFTPD32.INI echo.Timeout=3
>>%WinDir%\System32\TFTPD32.INI echo.MaxRetransmit=6
>>%WinDir%\System32\TFTPD32.INI echo.SecurityLevel=1
>>%WinDir%\System32\TFTPD32.INI echo.UnixStrings=1
>>%WinDir%\System32\TFTPD32.INI echo.Services=47
>>%WinDir%\System32\TFTPD32.INI echo.PersistantLeases=1
>>%WinDir%\System32\TFTPD32.INI echo.DHCP Ping=1
>>%WinDir%\System32\TFTPD32.INI echo.Max Simultaneous Transfers=100
>>%WinDir%\System32\TFTPD32.INI echo.BaseDirectory=%BaseDirectory%
>>%WinDir%\System32\TFTPD32.INI echo.[DHCP]
>>%WinDir%\System32\TFTPD32.INI echo.IP_Pool=%IP_Pool%
>>%WinDir%\System32\TFTPD32.INI echo.PoolSize=100
>>%WinDir%\System32\TFTPD32.INI echo.Gateway=%Gateway%
>>%WinDir%\System32\TFTPD32.INI echo.Mask=%mask%
rem >>%WinDir%\System32\TFTPD32.INI echo.DNS=%Gateway%
>>%WinDir%\System32\TFTPD32.INI echo.BootFile=%bootfile%
PECMD.EXE LINK !%%DESKTOP%%\TFTPD32网络启动服务端,TFTPD32.EXE
PECMD.EXE LINK !%%Programs%%\网络启动服务器\TFTPD32网络启动服务端,TFTPD32.EXE
PECMD FILE "%%DESKTOP%%\开启HaneWin网络启动服务端.*"
PECMD FILE "%%DESKTOP%%\开启TFTPD32网络启动服务端.*"
rem 删除共享名PEroot,建立共享名为Peroot共享资源为%BaseDirectory%
PECMD EXEC CMD /C "net share PEROOT /d"
PECMD EXEC CMD /C "net share PEROOT=%BaseDirectory% /unlimited"
PECMD FIND EXPLORER.EXE,KILL EXPLORER.EXE
start TFTPD32.EXE
PECMD.EXE MESS 远程启动网启服务器.启动成功!\n\n已将本机光盘 %BaseDirectory% 共享给远程客户(\\Winpe\PEROOT,用户名:Guest,密码为空)\n\n@提示 #ok *50000
if %BaseDirectory%.==. PECMD.EXE MESS 系统无法找到文件 %bootfile% 所在的盘符!\n\n请确认后, 手动配置网络服务器\n\n@提示 #ok *50000
EXIT
:END
PECMD.EXE MESS 先启动网络支持程序.再启动网网络启动服务器!@提示 #ok *30000
EXIT
:getip
set /a a=%a%+1
if %a%==1 set _myip=%b%
if %a%==2 set _mask=%b%
if %a%==3 set _Gateway=%b%
goto :eof
补充说明:
刚下了个WIn7PE做网启测试,感觉DHCP速度较TFTPD32快,此外,DHCP能远程启动WIN7PE成功,而tFTPD32传送BOOT.WIM文件完后启动失败,提示找不到boot.wim文件!!
===========================================
不用启动PE,WINDOWS下也能开启网启服务器功能:
免配CMD详见:35楼!!!!!!!
使用方法:将支持网启的PE文件放在硬盘即可
===============================
rem winPE\WINDOWS通用免配网启服务端.CMD
特点:1、PE\window通用,可在光盘或硬盘运行
2、本CMD与DHCP同一目录,方便移植,此目录可放在与启动文件同盘的任意子目录
3、无需启动PE,也能进行远程网启(安装系统或运行PE)
见 36楼!!!
========10.09最后更新见51楼!!!========
[ 本帖最后由 歌理 于 2009-10-9 17:10 编辑 ] |
|