`

【转】set static ip in windows

阅读更多

Setting a Static IP Address in Windows 7

It is very important to setup a static ip address, if you are going to use port forwarding. When you have port forwarding setup, your router forwards ports to an ip address that you specify. This will probably work when you initially set it up, but after restarting your computer it may get a different ip address. When this happens the ports will no longer be forwarded to your computer's ip address. So the port forwarding configuration will not work.

What is an ip address?
IP addresses are four sets of numbers separated by periods that allow computers to identify each other. Every computer has at least one ip address, and two computers should never have the same ip address. If they do, neither of them will be able to connect to the internet. There is a lot of information at the following link. You don't need all of it. But if you want to know more about how networks work, you'll find it there. For more information on ip addresses, subnets, and gateways go here

Dynamic vs Static IPs Most routers assign dynamic IP addresses by default. They do this because dynamic ip address networks require no configuration. The end user can simply plug their computer in, and their network will work. When ip addresses are assigned dynamically, the router is the one that assigns them. Every time a computer reboots it asks the router for an ip address. The router then hands it an ip address that has not already been handed out to another computer. This is important to note. When you set your computer to a static ip address, the router does not know that a computer is using that ip address. So the very same ip address may be handed to another computer later, and that will prevent both computers from connecting to the internet. So when you asign a static IP addresses, it's important to assign an IP address that will not be handed out to other computers by the dynamic IP address server. The dynamic IP address server is generally refered to as the dhcp server.



Setting up a static ip for Windows 7.

If you have a printer, before you begin print out this page!
Step 1:
Open up the start menu, and look for the Search programs and files box. You should now see the following window.

win7_staticip_run_dialog.jpg

 

Step 2:
Type cmd in the Search programs and files box, and press Enter on your keyboard. The will bring up a black command prompt window.

winxp-command.jpg

 

Step 3:
The command prompt may look different on your screen, but it doesn't really matter. Type ipconfig /all in that window, and then press the enter key. This will display a lot of information. If it scrolls off the top you may need to enlarge the window.

win7_staticip_command_prompt.jpg

 

Step 4:
I want you to write down some of the information in this window. Take down the IP address, Subnet Mask, Default Gateway, and Name Servers. Make sure to note which is which. We are going to use this information a little bit later. We are only concerned with IPv4 entries, you can ignore the IPv6 stuff. 

The name server entries are a bit complicated. Name Server is just another name for DNS(domain name server) server. Some router's act as a proxy between the actual name servers and your computer. You will know when this is the case, because the Default Gateway will list the same ip address as the Name Servers entry. We need to have the correct Name Server IP addresses. If we do not, you will not be able to browse the web. There are a couple ways to get these. The first way is to log into your router's web interface, and look at your router's status page. On that page you should see an entry for DNS Servers, or Name Servers. Write down the ip adresses of your Name Servers. Another way to get the correct Name Servers to use, is to give your ISP a call. They should know the ip addresses of your Name Servers right off. If they ask you why you need them, you can tell them you are trying to setup a static IP address on your computer. If they try to sell you a static external ip address, don't buy it. That's an entirely different thing that what you are trying to setup. 

Type exit in this window, then press the enter key to close it.

Step 5:
Once again open the start menu. This time click Control Panel.

win7_staticip_control_panel1.jpg

 

Step 6:
Click on View Network Status and Tasks.

win7_staticip_control_panel2.jpg

 

Step 7:
Single click Change adapter settings on the left side of your screen.

win7_staticip_change_adapter_settings.jpg

 

 

Step 8:
You might have more than one Internet connection listed here. You will need to determine which adapter is your connection to the Internet if this is the case. Right click on your network adapter and choose properties to open up the properties window of this internet connection.

win7_staticip_change_adapter_properties.jpg

 

Step 9:
Click Internet Protocol Version 4(TCP/IPv4) and then the Properties button.

win7_staticip_lan_properties.jpg

 

You will see the following screen:

vista_static_ip_07.jpg

 

Step 10:
Before you make any changes, write down the settings that you see on this page. If something goes wrong you can always change the settings back to what they were! You should see a dot in the Obtain an IP address automatically box. If you do not, your connection is already setup for a static ip. Just close all these windows and you are done. 

Pick an ip address and enter it into the IP Address box. The ip address you choose should be very similar to the router's ip addres. Only the last number of the ip address should be different. If the router's ip address is 192.168.1.1, I might choose 192.168.1.10. The ip address you choose should end with a number between 1 and 254, and should not be the same as the router's ip address. Every device that connects to your network needs to have it's own ip address. 

Put the subnet mask we previously found in the subnet mask section. The default gateway should go into theDefault gateway box. Enter the dns servers we prevoiusly found into the two DNS Server boxes. Click okay all the way out of this menu. 

If you find that you can not pull up webpages, the problem is most likely the dns numbers you entered. Give your ISP a call, and they will be able to tell you which dns servers to use. This is a question they answer all of the time. They will be able to tell you what you should use right away. 

That's it you should be done! If you can't connect to the internet go back and change your configuration back to what it originally was.

分享到:
评论

相关推荐

    批处理修改IP很容易的额

    netsh interface ip set address name="%Interface%" static %NewIP% %NewMask% %NewGateway% ) else ( echo 开启DHCP服务... netsh interface ip set address name="%Interface%" dhcp ) echo 完成!按任意键...

    利用批处理设置和切换IP地址

    - `netsh interface ip set address "接口名" static IP 地址 子网掩码 默认网关`:设置指定接口的静态IP地址、子网掩码和默认网关。 4. **设置动态IP**: - `ipconfig /dhcp`:此命令可能用于重新启用DHCP服务,...

    Network IP.rar

    在Windows操作系统中,批处理文件通常用于执行一系列命令行操作,比如设置IP地址、子网掩码、默认网关等。这样的脚本可能会使用`ipconfig`命令来查看或更改网络配置,或者使用`set`命令来设置环境变量。批处理文件中...

    局域网自动更改IP批处理命令脚本文件

    netsh interface ip set address ""static 192.168.1.!randomip! 255.255.255.0 192.168.1.1 1"" ``` - `netsh interface ip set address`:设置指定接口的IP地址。 - `"static"`:表示设置的是静态IP地址。 - ...

    IP地址切换

    例如,可以创建一个批处理文件,里面包含`netsh interface ip set address "接口名" static 新的IP 子网掩码 默认网关`等命令,执行该文件即可实现IP地址切换。 5. **自动IP获取**: - 如果网络环境支持动态主机...

    c# 修改本地IP地址

    使用`ManagementBaseObject`的`InvokeMethod`方法调用`EnableStatic`方法,传入IP地址数组和子网掩码数组。 2. DHCP动态获取:如果希望网卡使用DHCP,可以调用`InvokeMethod`方法,调用`EnableDHCP`方法。 **五、...

    C#实现更换IP的源代码。

    ManagementBaseObject setIP = mo.InvokeMethod("EnableStatic", newIP, null); ``` #### 5. 设置默认网关 - **准备参数**:为`SetGateways`方法准备参数。 ```csharp ManagementBaseObject newGateway = mo....

    Windows下通过bat获取网络连线实际名称,加强IP类设置脚本的兼容性

    netsh interface ip set address name="%netname%" source=static addr=192.168.1.105 mask=255.255.254.0 gateway=192.168.1.1 pause ``` 这段代码会查找包含“Ethernet adapter”的行,并将之后的名称设为网络连接...

    获得和设置本机TCPIP信息程序(VB6.0代码编写)

    nicConfig.EnableStatic ip, "255.255.255.0" nicConfig.SetGateways "192.168.1.1", 1 If Not nicConfig.Put_ Then MsgBox "设置IP失败!" Else MsgBox "IP已设置为:" & ip End If Exit For End If Next...

    Ghost安装Win7/XP后自动恢复IP的批处理代码(ip备份恢复)

    netsh interface ip set address name="%%k" source=static addr=!addr! mask=!mask! gateway=!gateway! call :end ) if "%%j" == "接口" ( netsh interface ip set address name="%%k" source=static addr=!...

    CISCO 技术大集合

    建立动态地址翻译 ip nat inside source {list {access-list-number | name} pool name [overload] | static local-ip global-ip} 指定内部和外部端口 ip nat {inside | outside} 如下图所示, 路由器的Ethernet ...

    Zedboard板基于SOC的Adau1761测试项目

    6、 第15行set_property ip_repo_paths C:/xup/hls/sources/lab4 [current_fileset]路径改为set_property ip_repo_paths d:/lab4 [current_fileset] 7、 将audio_project_create.tcl 的每一行拷贝入 Tcl Console ...

    IP地址自动设置的批处理代码分享

    rem netsh interface ipv4 set address %eth% static %ip% %netmasks% %gw% rem >nul echo 5.验证当前本机IP:ipconfig -all >ipconfig.txt type ipconfig.txt | find "%ip%" ``` 在这个脚本中,`goto changeerror...

    SRS 2.0-258 windows版本

    最新版本SRS 2.0-258 ,使用cygwin 在windows下的编译 。 修改代码 setrlimit (2048) ,使其默认能支持 2048个连接 在i7笔记本上 ,测试 500路视频转发 ,srs.exe进程 占用cpu 5%,出奇的低。 以下是 编译错误笔记...

    c#技术大全之对windows系统的操作

    // 远程计算机的IP地址或名称 string remoteComputer = "192.168.1.100"; // 要执行的进程路径 string processPath = "C:\\Windows\\notepad.exe"; // 创建一个连接选项 ConnectionOptions connOpts = new ...

    Win2003下通过IP安全策略限制udp-flood发包的批处理代码

    之前有介绍Linux下通过iptables限制UDP发包,... tokens=1,2” %%a in (‘ipconfig /all ^|findstr /i “DNS Server”‘) do (set DNSIP=%%b):新建IP安装策略禁止UDPnetsh ipsec static add policy name=禁止UDP desc

    BURNINTEST--硬件检测工具

    - A printer to run the printer test, set-up as the default printer in Windows. - A CD ROM + 1 Music CD or Data CD to run the CD test. - A CD-RW to run the CD burn test. - A network connection and the ...

    自动获取本机多个网卡的信息(含源码)

    在Windows操作系统中,我们可以使用WinPCap库或者.NET Framework的System.Net.NetworkInformation命名空间来获取这些信息。WinPCap是一个底层的网络访问接口,可以捕获网络数据包并提供网络接口信息。而对于.NET...

    学习使用WMI管理网络

    - **属性和方法**:此类包含了许多属性和方法,如`IPAddress`、`IPSubnet`、`DefaultIPGateway`等,以及`EnableStatic`、`Disable`等方法,用于设置静态IP地址、禁用网络适配器等操作。 - **应用示例**:假设我们...

Global site tag (gtag.js) - Google Analytics