IP切换小技巧

 时间:2024-09-28 09:21:12

一些公司可能会设置分配静态ip来管理网络,只有设置公司给你的静态ip才能上网,但是家里的网络可能就需要你使用动态IP才能上网,这时你需要一个切换ip的脚本来帮助你方便切换网络。

工具/原料

电脑

记事本

方法/步骤

1、对于频繁切换ip的人来说,使用如下图:手动设置ip已经out了,你需要一个能够快速切换ip的脚本。

IP切换小技巧

2、首先你需要定义你的网络名称和要切换的静态ip地址、子网掩码、网关、DNS和备用DNS。你可以这样写:@echooffrem//设置网络变量setNetName="以太网"rem//设置IP地址、子网掩码、网关、DNSsetAddr=192.168.xx.xxxsetMask=255.255.255.0setGway=192.168.xx.xxxsetDns=192.168.xx.xxxsetDnsRem=网络名称如下图:

IP切换小技巧

3、接着加入命令行中的选项功能,命令如下:echo请根据自己的需求选择下面的选项并回车echo●●●●●●●●●●●●●●●●●●echo●1设置为静态IP●echo●2设置为动态IP●echo●3退出●echo●●●●●●●●●●●●●●●●●●set/pInputNum=if%InputNum%==1goto1if%InputNum%==2goto2if%InputNum%==3goto3

4、根据各个选项写入相应的设置::1rem//可以根据自己的需求设置代理,命令为se隋茚粟胫thttp_proxy=网络sethttp_pr泠贾高框oxy_user=账号sethttp_proxy_pass=密码echo静态IP设置中,请稍等...echo.IP地址=%Addr%echo.子网掩码=%Mask%netshinterfaceipsetaddressname=%NetName%source=staticaddr=%Addr%mask=%Mask%gateway=%Gway%gwmetric=0>nulecho.首选DNS=%Dns%netshinterfaceipsetdnsname=%NetName%source=staticaddr=%Dns%register=PRIMARY>nulecho.备用DNS=%Dns2%netshinterfaceipadddnsname=%Nic%addr=%Dns2%index=2>nulecho----------------------------echo设置完成!pausegotoend:2echo动态IP设置中,请稍等...echo.从DHCP自动获取IP地址...netshinterfaceipsetaddress"以太网"dhcpecho.从DHCP自动获取DNS地址...netshinterfaceipsetdns"以太网"dhcpecho----echo全部设置完成!pausegotoend:3echobye!gotoend

5、脚本编写如下:首先创建一个文本文档

IP切换小技巧

6、再在文档中写入:@echooffrem//设置网络变量setNetName=&quo隋茚粟胫t;以太网"rem//设置IP地址斤舻浑趸、子网掩码、网关、DNSsetAddr=192.168.xx.xxxsetMask=255.255.255.0setGway=192.168.xx.xxxsetDns=192.168.xx.xxxsetDnsRem=echo请根据自己的需求选择下面的选项并回车echo●●●●●●●●●●●●●●●●●●echo●1设置为静态IP●echo●2设置为动态IP●echo●3退出●echo●●●●●●●●●●●●●●●●●●set/pInputNum=if%InputNum%==1goto1if%InputNum%==2goto2if%InputNum%==3goto3:1rem//可以根据自己的需求设置代理,命令为sethttp_proxy=网络sethttp_proxy_user=账号sethttp_proxy_pass=密码echo静态IP设置中,请稍等...echo.IP地址=%Addr%echo.子网掩码=%Mask%netshinterfaceipsetaddressname=%NetName%source=staticaddr=%Addr%mask=%Mask%gateway=%Gway%gwmetric=0>nulecho.首选DNS=%Dns%netshinterfaceipsetdnsname=%NetName%source=staticaddr=%Dns%register=PRIMARY>nulecho.备用DNS=%Dns2%netshinterfaceipadddnsname=%Nic%addr=%Dns2%index=2>nulecho----------------------------echo设置完成!pausegotoend:2echo动态IP设置中,请稍等...echo.从DHCP自动获取IP地址...netshinterfaceipsetaddress"以太网"dhcpecho.从DHCP自动获取DNS地址...netshinterfaceipsetdns"以太网"dhcpecho----echo全部设置完成!pausegotoend:3echobye!gotoend

7、将文档保存下来并退出来,给新建的文档重新命名为:IP切换.bat。如下图:

IP切换小技巧

绝地求生steam怎么开启直播? win7 游戏多开占用CPU的解决方法 如何使用系统磁盘功能实现软阵列 RAID 0 带区卷 如何调整计划亮度 电脑711最快解决方法
热门搜索
厨房橱柜图片 通体砖图片 小丑图片大全 蜡笔画图片大全 抗疫英雄图片