Setting up a static IP address is useful if you want other devices in the local network to initiate a connection to your computer.
External (public) IP Address vs Local IP Address
Each device you connect to your router has its own local IP address. These addresses are unique within your local network. But since local addresses use a small address range they are not unique globally. There will be many devices around the world which has the same local address as your computer. So local addresses cannot be used to send packets over the internet. This is where the external IP address comes in. An external IP address is the address of your routers interface with the internet.
The IP packets leaving your computer will have the local IP address as its source IP address. If the packet is destined for the internet, the router will replace the local address with the external address before sending it off. A reverse translation takes place when a packet arrives at the router from outside.
The external IP address can be static or dynamic. But this is determined by your ISP. This article is about setting the local address of your computer.
Static Local Address vs Dynamic Local Address
By default, Windows obtains a dynamic address from the router via DHCP. Dynamic addresses are convenient because all our devices get unique addresses automatically without the need for any configuration. Static addresses provide us with more networking options but it requires configuration. With static addresses, we have to make sure that we don’t end up with duplicate addresses.
Gather some information
Before we start, we need to gather some information about our current network configuration.
- Open the command prompt. Search for command in the start menu and hit ENTER
- Issue the ipconfig /all command. Type ipconfig /all and hit ENTER
- Find information about the Ethernet Adapter. The ipconfig /all command might output a fair amount of text. Find the Ethernet Adapter section. This information will be helpful for the rest of this guide.
Find a suitable IP address
Here comes the tricky part. We need to find a suitable static IP address.
Why can’t we use the old IP address returned by the ipconfig command?
The old dynamic address was assigned to us automatically by the router. It belongs to a range of IP addresses used by the router for DHCP. To be on the safer side, we need to choose an IP address that is beyond the DHCP range of the router. Otherwise, the router might assign the IP address to some other device before our computer gets a chance to latch on to it.
You don’t need to bother about DHCP ranges if any of the following apply to you.
- You have disabled DHCP on the router
- You are using static IP for all your devices. This has the same effect as disabling DHCP.
- You are connecting only one device to your router.
Steps required to find the DHCP range differ between routers. I will describe the steps for my Tenda router. That should give you a reasonable idea as to how to go about it on other routers.
- Find the default gateway address from the output of the ipconfig /all command. Paste it in your web browsers address field and hit ENTER. The default gateway is the address of the interface between your computer and the router. This should open the router configuration page.
- You may have to enter a username and password before you can access the router configuration. Some routers require a password even if you have not set one manually. In this case, you have to find the default login details of your router. Contacting your ISP might help if you can’t figure how to log in.
- Look for settings related to the DHCP server. In my router, it was in the Administration section. Make a note of the DHCP range.
Set static IP address
- From the Start Menu open Settings.
- Network and Internet
- Click on Ethernet in the left pane. If you are using Wi-Fi, click on Wi-Fi in the left pane.
- Click on Network on the right pane. If you are using Wi-Fi, click on your Wi-Fi network name.
- Scroll down to the IP settings section
- Click on the Edit button
- Change the setting from Automatic (DHCP) to Manual
- Turn on the IPV4 button
- In the IP address field, enter an IP address that is beyond the range of your routers DHCP range. Refer to the previous section for details.
- Enter 24 as subnet prefix length. This should work with most routers.
- For Default Gateway use the gateway returned by the ipconfig /all command.
- For DNS servers, you can use the DNS server shown by the ipconfig command. Another option is to use Open DNS or Google DNS. For Open DNS use 184.108.40.206 and 220.127.116.11 as the address. For Google DNS this should be 18.104.22.168 and 22.214.171.124.