WWW FAQs: How do I give my computer a static local IP address?

2006-01-25: If you are using a router to share your Internet connection with more than one computer in your home, or to achieve wireless Internet access (WiFi), congratulations! Your computers are protected from several common threats. That's because other computers on the Internet can't directly connect to your computers -- the router won't let them.

Normally this is great, but when we want to host a website at home or host BitTorrent downloads at home, it's inconvenient. In these cases, we want other people to be able to connect to our computer... for those purposes only, of course.

You can skip this article if you have no router. If you have wireless networking (wifi), or more than one computer, you definitely have a router and you will definitely need to follow these steps. Occasionally a router is built right into your DSL or cable modem, in which case you will need to look at the manual for that device.

Fortunately, all well-made routers allow us to forward ports to a particular computer inside the "local" network (your collection of computers at home, "behind" the router). Unfortunately, many routers assign a new address to each computer every time it is turned on. To forward connections on web or BitTorrent ports, we first need a "static" (unchanging) local address on the local network to forward those connections to! So how do we keep our computer from getting a new address every time we power it on? That's the question I'll answer here.

A static local IP address is not the same thing as a static Internet IP address. Most cable modem and DSL ISPs give you a dynamic Internet IP address - that is, it is subject to change. That's not what I'm talking about here. I'm talking about an address on the little "private" network that exists behind your router, where your personal computers live. Unless you take the steps in this article, addresses on the local network are also subject to change, which prevents you from forwarding ports to them. That's why we set up a static local IP address for your server - so that we can tell the router which local IP address to forward web or BitTorrent traffic to.
Some routers are smart enough to let you forward ports to a computer by its name instead of its address. If so, you can skip this article. Check under "virtual server" or "port forwarding" to see if yours is that smart. Mine isn't.

There are two ways to solve this problem. If your router is well-designed, it might have a feature that lets you assign a specific, never-changing local IP address to your computer by its name on the local network. That's convenient because you don't have to change settings on the computer itself.

The second way... which is the only way with some routers, like my own SMC Barricade G and the popular Linksys WRT54G... is to assign your computer an IP address outside the range of addresses that your router gives out automatically. By forcing the computer to use a specific IP address, we avoid the problem of receiving a new address every time we power the computer on. In this case we'll make the change in your computer's network settings. But first, we'll want to double-check the range of IP addresses that your router gives out, so that two different computers never get the same IP address.

Warning: setting a static IP address for a laptop can be a pain if you want to use your laptop on someone else's network, such as in a cafe with WiFi. But if you're going to take your computer other places, your BitTorrent or web server will be out of commission for the duration anyway. So what's the bottom line? Follow these steps only on a computer that stays put and stays turned on! Your BitTorrent won't work for anyone if you take the tracker away. Find an older PC, power it up, install Windows XP or Linux on it, make sure to run Windows Update or the equivalent automatically and often, and leave that machine powered up 24/7. You've just built your first server.
I've talked about changing settings on the router. But how do we get access to your router's settings? Almost all routers include a built-in web server that provides a simple way to configure the router. And that's what we'll use. Typically you'll log in at an address like (for an SMC Barricade G and many others) or (for a Linksys WRT54G and many others), but see the manual for your router to be sure. Hopefully you have already configured your router with an administrative password to keep hackers from changing your settings.
I can't give you exact step-by-step instructions to do this with every router, because every router is different. Keep your router's manual handy as you read this and you'll get there!

Please don't ask me what your router password is! You chose it when you set up your router, or it is still set to the default. If you can't seem to get in, check the manual of your router for more information. There may be a default password, or the default password might be blank. In a worst-case scenario, follow your router's procedure for a hard reset (not just a power cycle -- there is usually a recessed button for this job, see the manual).

Once you have logged in to your router's configuration interface, explore the advanced settings and look for a way to assign a fixed, unchanging IP address for your computer on your local network. Your router may provide a way to do this on a page of settings devoted to DHCP (Dynamic Host Configuration Protocol). Also take note of the range of addresses automatically assigned to computers without a fixed address. Typically this is to or something similar.

Many routers, such as the SMC Barricade G and the Linksys WRT54G, do not have this feature. Don't worry - there's an alternative way to assign a static local IP address and I'll cover that next.
Assign your computer an address outside this range, such as (for the Barricade) or (for the Linksys). It must still be in the same "class C subnet." In other words, it must still begin with 192.168.2. or 192.168.1. if that is what your router's IP address begins with. Also, you may not use an address ending in .255, which is reserved for special "broadcast" messages.

Now reboot your computer. At the Windows command line (Start -> Run -> cmd.exe), the ipconfig command should now report the fixed IP address that you assigned.

If Your Router Doesn't Let You Set Static Local IPs

If your router doesn't allow you to assign fixed local IPs in this way, all is not lost. You can still assign a fixed IP via the Windows Control Panel (or the Macintosh or Linux equivalent). Follow these steps to force your computer to use a fixed IP address:
This is tricky stuff and you can mess up your connection if you do it wrong. So read carefully. If you don't understand something, don't just try things at random... read more instead!

1. Choose an address. It must be in the same "class C subnet" as your router. That is, if your router's web interface is at (typical for the SMC Barricade G) or (typical for the Linksys WRT54G), then you can choose an address where the last of those four numbers is different. The number you choose must be between 2 and 254, and you must choose an address that won't be dynamically assigned to other computers. The DHCP settings page of your router's web interface will tell you what range of addresses are dynamically assigned by DHCP. Many routers, including both the SMC Barricade G and the Linksys WRT54G, are set up "out of the box" not to assign addresses ending in a number between .2 and .99. So anything in that range is a good choice for your server. For instance, with my SMB Barricade G, is a good choice for a static local IP. With the Linksys WRT54G, is a good choice.

2. Access the Network Connections control panel of Windows XP (Start -> Control Panel -> Network Connections). Pick the connection you're using, either Local Area Connection (for wired Ethernet cables) or Wireless Network Connection (for WiFi). Right-click on that connection's icon and pick Properties. Under "this connection uses the following items," scroll down to "Internet Protocol (TCP/IP)" and double-click on that. The "Internet Protocol (TCP/IP) Properties" window will appear.

3. Right now, "Obtain an IP address automatically" is probably selected. Instead, select "Use the following IP address." In the "IP address:" field, enter the address you chose (for example, works well with my SMC Barricade G, while would work well with a Linksys WRT54G). The subnet mask will automatically become, which is correct. Set the "Default gateway" field to the address of your router, which is usually (for the Barricade G) or (for the Linksys WRT54G) -- but please don't copy and paste this! Use the address that actually gives you access to the router's web interface.

4. "Use the following DNS server addresses:" is now selected. In the "Preferred DNS server:" field, enter the IP address of your router (the same as the default gateway). Leave "Alternate DNS server:" blank.

5. Click "OK" to leave the "Internet Protocol (TCP/IP) Properties" window, and again to leave the connection properties window. In Windows XP, your IP address will change immediately at this point. Verify that you can still access the Internet. If not, double-check your work.

If you mess up and you're not sure why, you can restore your normal settings by returning to the "Internet Protocol (TCP/IP) Properties" window and re-selecting "Obtain an IP address automatically" and "Obtain a DNS server address automatically."
OK, great, your computer now has a fixed address on the local network. What does that do for us? It gives us a destination for incoming web or BitTorrent traffic. All we have to do now is tell the router what to do with inbound traffic on the ports we've chosen for BitTorrent. For most readers, the next step is to forward ports through the router.

"My server doesn't show up on the client list in my router!"

The "client list" displayed by some routers is just a list of PCs that were assigned addresses dynamically by the built-in DHCP server in the router. You have a static IP address for your server, so it doesn't show up. This is normal, and it's a good thing.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!