不重启修改IP,网关,DNS

来源:互联网 发布:2016年淘宝年度销售额 编辑:程序博客网 时间:2024/05/21 06:57

1. IP Helper API. Using AddIPAddress and DeleteIPAddress: Only adds an IP
address to the adapter, will not change the current one.

2. WMI using Win32_NetworkAdapterConfiguration: I don't want this solution.

3. netsh: Using CreateProcess and passing specail command line can do it, but I don't want to do by another process(Program).

4. DhcpNotifyConfigChange: Eidt registry and call DhcpNotifyConfigChange to notify change. The problem with DhcpNotifyConfigChange is that
it's an undocumented API.And if don't call DhcpNotifyConfigChange, you have to reboot your machine to take effect.

5. SetAdapterIpAddress. This solution are done well in Win2K and WinXP. It is not working under WinVista platform. This is an undocumented API. Using an undocumented API is never ideal

 

直接使用DOS命令cmd-----netsh

例如:

netsh interface ip set address "XXXX" static 192.168.18.183 255.255.255.0 192.168.18.1 1pause
netsh interface ip set DNS "XXXX" static 211.161.192.1netsh interface ip add dns "XXXX" 211.161.192.73 index=2
pause

 

注:

从注册表中寻找网卡型号

 

  为了让网卡设备处于最佳工作状态,我们必须在安装网卡设备时使用与该设备型号完全一致的驱动程序!那么如何才能知道网卡设备的具体型号呢?尽管寻找网卡型号的方法有很多,但我们在注册表中,也能快速地将网卡型号信息寻找出来,下面就是具体的寻找操作步骤:

  单击本地计算机系统桌面中的“开始”按钮,在弹出的对应菜单中执行“运行”命令,然后在随后弹出的系统运行文本框中输入字符串命令“regedit”,单击“确定”按钮后,打开本地计算机的系统注册表编辑界面;

  用鼠标展开该编辑界面左侧子窗口中的“HKEY_LOCAL_MACHINE”注册表子键,在其后展开的注册表分支下面依次用鼠标选中其中的

  “SYSTEM/ControlSet001/Control/Network/{4D36E972-E325-11CE-BFC1-08002BE10318}”选项,选中该注册表子键下面的“Descriptions”子项,并在该子项下面我们就可以清楚地看到各种网络接口的名称信息和型号信息,这也包括网卡接口的名称信息和型号信息

原创粉丝点击