惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 龙城1号

谈谈几十种文件传输工具、FTP工具、跨平台手机电脑互传工具 office必须知道的一些事情 软件下载网址大全 用eclipse开发java 监控ip在线状态 部分毕业设计的论文和代码 隐藏在照片里的情书 关于系统多功能恢复盘制作 免费的ASP.net2.0免费空间 WMp和RealPlayer空间的一些命令 卡巴斯基激活码无限量获取 如何删除runauto...病毒 配置php开发环境 网刻 U盘启动盘 fckeditor转载 截取字符串substring() asp.net连接mysql 把SQL数据库部署到远程主机环境
配置ip的脚本bat详解
龙城1号 · 2010-02-25 · via 博客园 - 龙城1号

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\sdfkjs>ipconfig /all

Windows IP Configuration

          Host Name . . . . . . . . . . . . : my-tomato
          Primary Dns Suffix    . . . . . . . :
          Node Type . . . . . . . . . . . . : Unknown
          IP Routing Enabled. . . . . . . . : No
          WINS Proxy Enabled. . . . . . . . : No


Ethernet adapter 本地连接:

          Connection-specific DNS Suffix    . :
          Description . . . . . . . . . . . : VIA PCI 10/100Mb Fast Ethernet Adapt
er
          Physical Address. . . . . . . . . : 00-30-18-A9-CB-2A
          Dhcp Enabled. . . . . . . . . . . : No
          IP Address. . . . . . . . . . . . : 192.168.30.190
          Subnet Mask . . . . . . . . . . . : 255.255.255.0
          Default Gateway . . . . . . . . . : 192.168.30.1
          DNS Servers . . . . . . . . . . . : 202.131.80.1
                                              202.131.80.5

C:\Documents and Settings\sdfkjs>


Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\yqc>cd \

C:\>ipconfig /all //先查看原来IP地址和DNS地址

Windows IP Configuration

          Host Name . . . . . . . . . . . . : my-tomato
          Primary Dns Suffix    . . . . . . . :
          Node Type . . . . . . . . . . . . : Unknown
          IP Routing Enabled. . . . . . . . : No
          WINS Proxy Enabled. . . . . . . . : No


Ethernet adapter 本地连接:

          Connection-specific DNS Suffix    . :
          Description . . . . . . . . . . . : VIA PCI 10/100Mb Fast Ethernet Adapt
er
          Physical Address. . . . . . . . . : 00-30-18-A9-CB-2A
          Dhcp Enabled. . . . . . . . . . . : No
          IP Address. . . . . . . . . . . . : 192.168.30.190
          Subnet Mask . . . . . . . . . . . : 255.255.255.0
          Default Gateway . . . . . . . . . : 192.168.30.1
          DNS Servers . . . . . . . . . . . : 202.131.80.1
                                              202.131.80.5

C:\>netsh //配置windows中ip、dns地址的主要命令,功能很强大,有兴趣可以到网上找找它其他的功能选项
netsh>interface
netsh interface>ip
netsh interface ip>set //查看set配置命令使用方法

下列指令有效:

命令从 netsh 上下文继承:
set file         - 复制控制台输出到文件。
set machine      - 设置用来操作的当前计算机。
set mode         - 设置当前模式为联机或脱机。

此上下文中的命令:
set address      - 设置指定的接口的 IP 地址或默认网关。
set dns          - 设置 DNS 服务器模式和地址。
set wins         - 设置 WINS 服务器模式和地址。
netsh interface ip>set add //查看配置IP使用方法

用法: set address [name=]<string>
         [[source=]dhcp |
          [source=] static [addr=]IP address [mask=]IP subnet mask]
         [[gateway=]<IP address>|none [gwmetric=]integer]

参数:

        标记             值
        name           - 接口名称。
        source         - 下列值之一:
                       dhcp: 对于指定接口,设置用 DHCP 配置 IP
                             地址。
                       static: 设置使用本地静态配置设置 IP
                               地址。

        gateway        - 下列值之一:
                       <IP address>: 您设置的 IP 地址的指定默认
                                     网关。
                       none: 不设置默认网关。
        gwmetric       - 默认网关的跃点数。如果网关设置为 'none',则
                       不应设置此字段。
        只有在 'source' 为 'static' 时才设置下列选项:

        addr           - 指定接口的 IP 地址。
        mask           - 指定 IP 地址的子网掩码。

注释     : 用来将 IP 地址配置模式从 DHCP 模式改为 static,或从 static
           模式改为 DHCP。用静态 IP 地址在接口上添加 IP 地址,或添加
           默认网关。
示例     :

         set address name="Local Area Connection" source=dhcp
         set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1

netsh interface ip>set add "本地连接" dhcp //设置动态分配IP地址、子网掩码和默认网关)
确定。

netsh interface ip>set add "本地连接" static 192.168.30.190 255.255.255.0 192.168.30.1 1
确定。 //设置静态IP地址、子网掩码和默认网关 (注意后面的 "1",不然不能设置默认网关)

netsh interface ip>set dns //查看配置DNS使用方法

用法: set dns [name=]<string> [source=]dhcp|static [addr=]<IP address>|none
               [[register=]none|primary|both]

参数:

        标志             值
        name           - 界面的名称。
        source         - 下面的值之一:
                       dhcp: 设置 DHCP 作为为某一个界面配置 DNS 服务器的源。

                       静态: 设置配置 DNS 服务器的源为本地静态配置。

        addr           - 下面的值之一:
                       <IP 地址>: DNS 服务器的一个 IP。
                       none: 清除 DNS 服务器列表。
        register       - 下面的值之一:
                       none: 禁用动态 DNS 注册。
                       primary: 只在主 DNS 后缀下注册。
                       both: 在主 DNS 后缀下注册,也在特定连接后缀下注册。

说明:      设置 DNS 服务器配置为 DHCP 或静态模式。只有在源是“static”,
           并且“addr” 选项也可用以为此特定的界面配置 DNS 服务器的 IP
           地址的一个静态列表的情况下。

示例:

         set dns name="Local Area Connection" source=dhcp
         set dns "Local Area Connection" static 10.0.0.1 primary

netsh interface ip>set dns "本地连接" dhcp //设置动态分配DNS地址
确定。

netsh interface ip>set dns "本地连接" static 202.131.80.1 //设置静态主要DNS地址
确定。

netsh interface ip>add dns "本地连接" 202.131.80.5 //添加静态备用DNS地址
确定。

netsh interface ip>exit //退出

以上文章详细分解了DOS配置IP和DNS,其实批处理BAT配置IP和DNS就是把命令集中编辑到.bat文件中双击运行.bat程序就可以了。

例如:

在记事本中输入下列IP并保存为任意A.bat格式文件

静态IP:


netsh.exe interface ip set address "本地连接" static 192.168.30.190 255.255.255.0 192.168.30.1 1

双击运行后,你会发现你的IP已经设置为静态的了

动态IP:

netsh.exe interface ip set address "本地连接" dhcp

双击运行后,你会发现你的IP已经设置为动态的了

同理:

配置DNS也一样保存为任意B.bat格式文件

静态DNS:

netsh.exe interface ip set dns "本地连接" static 202.131.80.1 primary

netsh.exe interface ip add dns "本地连接" 202.131.80.5

双击运行后你会发现你的静态DNS也存在了

动态DNS:

netsh.exe interface ip set dns "本地连接" dhcp

双击运行后你会发现你的变成动态DNS

@ECHO OFF
rem 修改IP地址、子网掩码、网关
cmd /c netsh interface ip set address name="本地连接" source=static addr=21.5.251.63 mask=255.255.0.0 gateway=21.5.251.254 gwmetric=1

好像这种也可以,在网上找到的资料,有兴趣的朋友可以试试啊!

如果对DOS中配置IP和DNS还有问题,可以看我上篇文章的分解!

如果更多好东西,希望朋友提供,谢谢!!!