As part of a troubleshooting effort described in another post, I decided to give my computer a static private IP address. This was in contrast to the default assignment of a dynamic IP address, using a process formally known as Dynamic Host Configuration Protocol (DHCP). The question at hand was, how can I choose and assign a static IP address?
It seemed there were three principal ranges within which one could choose a static IP address:
- Class A private range: 10.0.0.0 through 10.255.255.255, subnet mask 255.0.0.0
- Class B private range: 172.16.0.0 through 172.31.255.255, subnet mask 255.255.0.0
- Class C private range: 192.168.0.0 through 192.168.255.255, subnet mask 255.255.255.0
Those ranges would be narrowed slightly by certain practical suggestions. It seemed, in particular, that it would be best not to choose a value at the very end of the range (e.g., 10.255.255.255); it was also advised that one should avoid IP addresses commonly used by major router manufacturers, since these would be the first addresses targeted by hackers. A search suggested that these commonly used addresses included 10.0.0.1, 192.168.0.1, 192.168.1.1, and 192.168.2.1. This information seemed to suggest that I could safely choose a static private IP address of, say, 172.17.2.11.
Later, though, it seemed that perhaps this was not correct. I got to that realization by clarifying my understanding of my network hardware. I had both a modem and a router. Both had their own internal setup webpages that I could access, in an Internet browser, by going to an address like http://192.168.8.1 or http://192.168.100.1. (The specific address would usually be stated in the owner’s manual.) My impression was that the router, not the modem, would be responsible for managing addresses within a home network, so I logged into the router’s setup webpage. There, I looked for something that would set aside a range of IP addresses for automatic allocation to devices via DHCP. I found this in the DHCP Server section of my router’s internal webpage. That section specified starting and ending values for the IP Pool: from 192.168.8.100 to 192.168.8.200, inclusive. In other words, as one source described it, these were values that I could not use as my static IP address, because they were already held in reserve for DHCP allocation. I would have to choose a value outside that range (i.e., not between 192.168.8.100 and 200).
At the same time, according to this source, I did not have nearly as much freedom as suggested above. As just shown, the router was using values that began with 192.168.8. I would be permitted to change only the last set of numbers. The values could range from 0 to 255 although, again, it was best not to use numbers at the very start or end of these sets. In other words, I would probably be OK with an IP address between 192.168.8.3 and 192.168.8.253, excluding the range just specified (i.e., 192.168.8.100 to 192.168.8.200). So, for instance, 192.168.8.57 would be a valid static private IP address with my router, but 192.168.8.101 would not.
Before I could set up my static private IP address, however, I would need some additional values. To get these, I followed advice to open a command prompt and type “ipconfig /all.” This produced a lot of information. (If it had scrolled off my screen beyond the point of retrieval, I could have redirected it to a file: “ipconfig /all > outputfile.txt.”) (There were also other ways of getting this information.) Within that ipconfig command’s output, I looked for the section labeled “Ethernet adapter Local Area Connection” (because I was dealing with a wired Ethernet connection, not a wireless connection); and within that section, I copied down the Default Gateway and two entries for DNS servers (i.e., primary and alternate, if both were available). There was a potential wrinkle that I hoped would not apply to me: someone had said that I would need to be copying different numbers, from the IPCONFIG output, if my network was using IPv6 rather than IPv4. I didn’t know whether it was; I just assumed not, and went with the IPv4 numbers for the time being.
It seemed that I had better double-check some of this information by taking a look at my router’s setup webpage. There, I saw confirmation that I had the right DNS server addresses, but there was a discrepancy regarding the gateway. This called for a bit of digging into the question of what a gateway was. The term seemed to be used in two different ways. On one hand, there was the concept of a gateway device that would combine the functions of a modem and a router. This was not applicable to me. I was interested in the other meaning of the term, where a gateway was essentially the interface between two devices.
As one source put it, the router used two different IP addresses. One was the public IP address that would serve as the interface or point of connection between the router and the outside world (i.e., the Internet). The other was the IP address that would function as the interface between the router and the computers on my internal home network. This latter one was called the “default gateway.” So when I saw that my router’s setup webpage indicated a gateway value in the 70s (i.e., a number like 126.96.36.199, not detailed precisely here due to security concerns), I learned that it fell into the range of public IP addresses — defined as everything except the three private ranges listed above. In other words, the gateway value like 188.8.131.52 was a public IP address, reportedly assigned by my ISP. I could identify my own public IP address via a Google search or on WhatIsMyISP.org. On closer inspection, I saw that the public IP address thus identified was labeled, in my router’s webpage, as the WAN IP. What the router called my Gateway IP differed slightly from it, for reasons I did not investigate because both were in the 70s and, as such, were public IP addresses, not relevant to the quest for the internal Default Gateway that I needed to set up my static private IP address.
This left the problem that, so far, the router was not exactly confirming the Default Gateway value that I had obtained from IPCONFIG. They were off by just one digit. I decided to go with the IPCONFIG value, not the value reported by the router webpage, because the latter would produce nothing when entered into the Firefox address bar, whereas (as noted above) the former was the address for the router’s own webpage.
Now I had to enter these numbers into the computer. A HowToGeek article instructed me to do this by going into Control Panel > Network Sharing Center > Change adapter settings > right-click on Local Area Connection > Properties > Internet Protocol Version 4 (TCP/IPv4) > Properties. Mine was set to “Obtain an IP address automatically” and “Obtain DNS server address automatically.” If, instead, some addresses had been manually specified, I would have wanted to take a screenshot and save the image of the existing settings, before changing anything. One way of taking and saving a screenshot would be to hit the computer’s PrtSc (i.e., printscreen) key, open a new file in an image editor (e.g., Paint, Microsoft Word), hit Ctrl-V to paste the PrintScreen image into that new file, and then save the file.
Then I proceeded to click on the option that said “Use the following IP address.” There, I entered my chosen static IP address and hit Tab; the subnet mask was entered automatically when I used Tab and arrow keys to move through those boxes. I had to enter the Default Gateway and DNS server information. Then I took another screenshot, to save a record of the numbers that I had just entered, so that I would not have to look them up or figure them out again. I clicked “Validate settings upon exit” and then OK. This put me out to the Windows Network Diagnostics troubleshooter. It didn’t find any specific problems. It seemed we were good.
I tested the results by attempting to view a new webpage in Firefox. It worked. Evidently I had correctly figured out the path to a static private IP address.