Board logo

标题: dos下修改副dns的方法? [打印本页]

作者: hynq2000     时间: 2008-1-11 03:58    标题: dos下修改副dns的方法?

Netsh Interface ip Set Dns Name="本地连接" source=static addr=61.139.2.69 register=PRIMARY

上面是修改主dns 下面是副dns


Netsh Interface ip Add Dns Name="本地连接" add=202.96.134.133 Index=2

这个是我在网上搜到的,修改主dns的命令可以用,修改副dns的命令不行,我是分开来执行的

请教各位大侠修改副dns的命令是什么? 谢谢了


第一次发帖 不知道发到这里对不对 请版主纠正!
作者: wen513520     时间: 2008-1-11 04:05
Netsh interface ip Set Dns Name="本地连接" Source=static addr=202.101.224.68
netsh interface ip add dns name="本地连接" addr=202.101.226.69
作者: everest79     时间: 2008-1-11 04:08
set dns name="本地连接" source=static addr=192.168.0.1 register=PRIMARY
add dns name="本地连接" addr=202.96.128.86 index=2
add dns name="本地连接" addr=61.144.56.101 index=3

你可能通过netsh interface ip dump来查看你在界面方式下配置的各项是如何在命令行下完成的
作者: hynq2000     时间: 2008-1-11 23:11
谢谢 各位老大的回复 我试验的时候多添加了一个
add dns name="本地连接" addr=111.111.111.111 index=3
现在想知道怎么来删除这个错误的dns! 谢谢各位了
---------------------------------------------------------------------------------
Ethernet adapter 本地连接:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : Realtek RTL8139 Family PCI Fast Ethernet NIC
        Physical Address. . . . . . . . . : 00-E0-4C-DA-49-17
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.1.16
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 192.168.1.1
        DNS Servers . . . . . . . . . . . : 202.102.224.68
                                                 222.222.222.222
                                                 202.102.227.68
                                                 111.111.111.111
-----------------------------------------------------------------------------------------
上面的这个是用ipconfig /all 查看的结果
发现这个add dns name="本地连接" addr=222.222.222.222 index=2 不是把原来的202.102.227.68 替换掉而是插入了一个新的nds,想要替换掉副dns应该如何做?

[ Last edited by hynq2000 on 2008-1-11 at 11:18 PM ]
作者: everest79     时间: 2008-1-12 01:48
add dns 只能添加
set dns 可以替换,但空值会清空整个列表
delete dns 才是你想要的

delete dns "Local Area Connection" 10.0.0.1
作者: hynq2000     时间: 2008-1-12 06:03
谢谢楼上的解惑
想要替换副dns 是不是要先清空整个列表 然后在逐个设置?
作者: everest79     时间: 2008-1-12 15:18
delete dns "本地连接" 222.222.222.222
作者: hynq2000     时间: 2008-1-12 23:20
这个的意思就是说要先删除副dns 然后再设置了?
没有能直接替换的吗?
作者: wswsysl     时间: 2008-1-13 10:33
set slection3=
set/p slection3=请输入主dns地址
netsh interface ip set dns name="本地连接" source=static addr=%slection3% register=PRIMARY

set slection4=
set/p slection4=请输入备份dns地址
netsh interface ip add dns name="本地连接" addr=%slection4%
netsh interface ip set wins name="本地连接" source=static addr=none
作者: hynq2000     时间: 2008-1-15 09:36
谢谢楼上的方法 好像还是添加不是修改
作者: hynq2000     时间: 2008-1-20 00:08
新发现 我主要的是想要设置副dns,能不能这样先复位网卡的各项设置,然后在重新设置各项参数?这种命令格式该怎么搞?还望大侠们指点一下
-----------------------------------------------------------------------------------------
此上下文中的命令:
?              - 显示命令列表。
add            - 向表中添加一个配置项目。
delete         - 从表中删除一个配置项目。
dump           - 显示一个配置脚本。
help           - 显示命令列表。
reset          - 复位 TCP/IP 及相关的组件到干净的状态。
set            - 设置配置信息。
show           - 显示信息。
作者: everest79     时间: 2008-1-20 02:16
netsh interface ip reset %temp%\log.txt

netsh interface ip reset all %temp%\log.txt