xiaomingzaixian

win10配置的静态/动态IP和 DNS的方法

1.配置静态IP和DNS

netsh interface ip set address name="以太网" source=static addr=192.168.9.145 mask=255.255.255.0 gateway=192.168.9.108
netsh interface ip set dns name="以太网" source=static addr=8.8.8.8 register=primary validate=no

管理员方式运行dos:

 

2.配置动态IP和DNS

netsh interface ip set address name="以太网" source=dhcp
netsh interface ip set dns name="以太网" source=dhcp

 

3.将命令写成脚本文件(iP配置.bat)

echo 1表示修改成静态IP
echo 2表示修改成动态IP

set /p KEY= [您的选择是:]     
::  /p表示将KEY设置为输入行
if %KEY% == 1 goto ONE 
if %KEY% == 2 goto TWO 

:: 设置静态IP
:ONE  
netsh interface ip set address name="以太网" source=static addr=192.168.9.145 mask=255.255.255.0 gateway=192.168.9.108
netsh interface ip set dns name="以太网" source=static addr=8.8.8.8 register=primary validate=no
pause
exit

:: 设置动态IP
:TWO
netsh interface ip set address name="以太网" source=dhcp
netsh interface ip set dns name="以太网" source=dhcp
pause
exit

 

分类:

技术点:

相关文章:

  • 2021-12-14
  • 2021-08-14
  • 2021-11-19
  • 2019-05-25
  • 2022-01-08
  • 2021-07-07
  • 2021-11-28
  • 2021-12-14
猜你喜欢
  • 2021-11-03
  • 2021-12-08
  • 2021-12-09
  • 2021-12-14
  • 2021-12-08
相关资源
相似解决方案