⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhcp-script.nsh

📁 EFI(Extensible Firmware Interface)是下一代BIOS
💻 NSH
字号:
echo -off
set -v LOGGER echo

if not %new_network_number%  ==  ^%new_network_number^% then
#   %LOGGER% New Network Number: %new_network_number%
endif

if not %new_broadcast_address%  ==  ^%new_broadcast_address^% then
#  %LOGGER% New Broadcast Address: %new_broadcast_address%
  set -v new_broadcast_arg "broadcast %new_broadcast_address%"
endif

if not %new_subnet_mask%  ==  ^%new_subnet_mask^% then
#  %LOGGER% New Subnet Mask for %interface%: %new_subnet_mask%
  set -v new_netmask_arg "netmask %new_subnet_mask%"
endif

if %reason% == FAILED then
  %LOGGER% DHCP Client startup failed
  goto exit_with_hooks
endif

if %reason%  ==  PREINIT then
  ifconfig %interface% inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up
  route add -host 255.255.255.255 -interface %interface%
  goto exit_with_hooks
endif

#
# BOUND and REBOOT cases are the same but we have no 'or' syntax in batch files
#
if %reason%  ==  BOUND then
  goto common_config
endif
if %reason%  ==  REBOOT then
  goto common_config
endif

goto exit_with_hooks

:common_config

if not %old_routers%  == ^%old_routers^% then
  route delete default %old_routers%
endif

ifconfig %interface% inet %new_ip_address% %new_netmask_arg% %new_broadcast_arg%
route add default %new_routers% 
echo search %new_domain_name%  >a \etc\resolv.conf
echo nameserver %new_domain_name_servers%  >>a \etc\resolv.conf
set -v old_routers "%new_routers%"

:exit_with_hooks

set -d LOGGER

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -