收藏 分享(赏)

命令行设置IP.doc

上传人:yjrm16270 文档编号:6846774 上传时间:2019-04-24 格式:DOC 页数:9 大小:32.50KB
下载 相关 举报
命令行设置IP.doc_第1页
第1页 / 共9页
命令行设置IP.doc_第2页
第2页 / 共9页
命令行设置IP.doc_第3页
第3页 / 共9页
命令行设置IP.doc_第4页
第4页 / 共9页
命令行设置IP.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

1、命令行设置 IP命令行下设置 IP 地址 一、添加 IP 地址及默认网关 (是添加,要重设或更新原来 IP 的请看第三点) netsh interface ip add address 用法 : add address name= addr=IP address mask=IP subnet mask gateway=IP address gwmetric=integer 参数 : name - IP 接口名称。 addr - 要添加到此接口的 IP 地址。 mask - 指定 IP 地址的 IP 子网掩码。 gateway - 指定 IP 地址的默认网关。 gwmetric - 默认网关的跃

2、点数。 注释 : 向一个用静态 IP 地址配置的接口添加 IP 地址和 默认网关。 示例 : add address “Local Area Connection“ 10.0.0.2 255.0.0.0 add address “Local Area Connection“ gateway=10.0.0.3 gwmetric=2 第一个命令向本地连接接口添加一个静态 IP 地址 10.0.0.2 ,子网掩码 为 255.0.0.0 。第二个命令向网关跃点数为 2 的接口添加 IP 地址 10.0.0.3 作为第二个默认网关。 我的实例 : (1)netsh interface ip add a

3、ddress “LocalConnection“ 172.20.0.49 255.255.252.0 此命令设置 LocalConnection 的 IP 为 172.20.0.49, 子网掩码为 255.255.252.0 (2) C:netsh interface ip add address “LocalConnection“ gateway=172.20.0.254 gwmetric=1 此命令设置 Localconnection 的默认网关为 172.20.0.254, 默认网关的跃点数为 1 二、添加 DNS netsh interface ip add dns ? 用法 : ad

4、d dns name= addr= index=integer 参数 : 标记 数值 name - 添加 DNS 服务器的接口的名称。 addr - 添加的 DNS 服务器的 IP 地址。 index - 为指定的 DNS 服务器地址 指定索引 ( 首选项 ) 。 说明 : 静态添加新的 DNS 服务器 IP 地址或重新索引现有 DNS 服务器地址的列表以修改 DNS 服务器首选项。 例如 : add dns “Local Area Connection“ 10.0.0.1 add dns “Local Area Connection“ 10.0.0.3 index=2 我的实例: netsh

5、 interface ip add dns “LocalConnection“ 172.20.0.1 netsh interface ip add dns “LocalConnection“ 202.96.128.68 index=2 三、设置 IP 地址、默认网关及 DNS : netsh interface IP set address local static 172.20.0.49 255.255.252.0 设置 IP 及子网掩码 netsh interface IP set address local static gateway=172.20.0.254 gwmetric=1 (

6、set address name=“LocalConnection“ source=dhcp 此条表示从 dhcp 服务器得到 IP) netsh interface IP set dns “LocalConnection“ static 172.20.0.1 (set dns name=“LocalConnection“ source=dhcp) 四、综合例 netsh interface IP set address local static 172.20.0.49 255.255.252.0 netsh interface IP set address local static gate

7、way=172.20.0.254 gwmetric=1 netsh interface IP set dns “LocalConnection“ static 172.20.0.1 netsh interface ip add dns “LocalConnection“ 202.96.128.68 index=2 以上命令做成批处理: edit setIP.bat netsh interface IP set address local static %2 255.255.252.0 netsh interface IP set address local static gateway=172

8、.20.0.254 gwmetric=1 netsh interface IP set dns “%1“ static 172.20.0.1 netsh interface ip add dns “%1“ 202.96.128.68 index=2 setIP.bat 的命令用法是: setIP 网络接口名 IP 地址 例如: setip LocalConnection 172.20.0.49-C:ipconfig (首先用 ipconfig 这个命令看一下更改之前的 ip 地址) Windows 2000 IP Configuration Ethernet adapter 本地连接: Con

9、nection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 192.168.0.250 (本地连接更改之前的 ip) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.0.1 PPP adapter 拨号连接: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 211.149.128.147

10、Subnet Mask . . . . . . . . . . . : 255.255.255.255 Default Gateway . . . . . . . . . : 211.149.128.147 C:netsh (然后执行 netsh 这个命令) netshinterface (netsh 命令的子命令) interfaceip (interface 命令的子命令) interface ipset (interface ip 命令的子命令) 下列指令有效: 此上下文中的命令: set address - 设置指定的接口的 IP 地址或默认网关。 set dns - 设置 DNS 服

11、务器模式和地址。 set wins - 设置 WINS 服务器模式和地址。 interface ipset address “本地连接“ static 192.168.0.2 255.255.255.0 192.168.0.1 1 (设置 ip 地址) 确定。 (注释:上面一段象不象 Cisco 的命令。 ) interface ipexit C:ipconfig (更改后再用 ipconfig 命令看一下 ip 地址,确认一下是否更改成功) Windows 2000 IP Configuration Ethernet adapter 本地连接: Connection-specific DNS

12、 Suffix . : IP Address. . . . . . . . . . . . : 192.168.0.2 (更改后的ip 说明成功了) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.0.1 PPP adapter 拨号连接: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 211.149.128.147 Subnet Mask . . . . .

13、. . . . . . : 255.255.255.255 Default Gateway . . . . . . . . . : 211.149.128.147 C: netsh 这个命令还有好多强大的功能 如下: C:netsh netsh? 下列指令有效: 此上下文中的命令: - 移到上一层上下文级。 ? - 显示命令列表。 aaaa - 更改到 aaaa 上下文。 abort - 丢弃在脱机模式下所做的更改。 add - 将一个配置项添加到项目列表中。 alias - 添加一个别名 bye - 退出程序。 commit - 提交在脱机模式中所做的更改。 delete - 在项目列表上删

14、除一个配置项目。 dhcp - 更改到 dhcp 上下文。 dump - 显示一个配置脚本。 exec - 运行一个脚本文件。 exit - 退出程序。 help - 显示命令列表。 interface - 更改到 interface 上下文。 offline - 将当前模式设置成脱机。 online - 将当前模式设置成联机。 popd - 从堆栈上打开一个上下文。 pushd - 将当前上下文放推入堆栈。 quit - 退出程序。 ras - 更改到 ras 上下文。 routing - 更改到 routing 上下文。 set - 更新配置设置。 show - 显示信息 unalias - 删除一个别名。 wins - 更改到 wins 上下文。 下列的子上下文可用: routing interface ras dhcp wins aaaa 若需要命令的更多帮助信息,请键入命令, 后面跟 ?。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报