Обговорення Wiki:Портал спільноти

Матеріал з Wiki
Перейти до: навігація, пошук

DHCP versus Static IP Assignment To help you understand the application of static IP addresses, let’s start with the setup you (and most readers for that matter) have. The vasty majority of modern computer networks, including the little network in your home controlled by your router, use DHCP (Dynamic Host Configuration Protocol). DHCP is a protocol that automatically assigns a new device an IP address from the pool of available IP addresses without any interaction from the user or a system administrator. Let’s use an example to illustrate just how wonderful DHCP is and how easy it makes all of our lives.

How to Set Up Static DHCP So Your Computer’s IP Address Doesn’t Change Imagine that a friend visits with their iPad. They want to get on your network and update some apps on the iPad. Without DHCP, you would need to hop on a computer, log into your router’s admin panel, and manually assign an available address to your friend’s device, say That address would be permanently assigned to your friend’s iPad unless you went in later and manually released the address.

With DHCP, however, life is so much easier. Your friend visits, they want to jump on your network, so you give them the Wi-Fi password to login and you’re done. As soon as the iPad connected to the router, the router’s DHCP server checks the available list of IP addresses, and assigns an address with an expiration date built in. Your friend’s iPad is given an address, connected to the network, and then when your friend leaves and is no longer using the network that address will return to the pool for available addresses ready to be assigned to another device.

All that happens behind the scenes and, assuming there isn’t a critical error in the router’s software, you’ll never even need to pay attention to the DHCP process as it will be completely invisible to you. For most applications, like adding mobile devices to your network, general computer use, video game consoles, etc., this is a more than satisfactory arrangement and we should all be happy to have DHCP and not be burdened with the hassle of manually managing our IP assignment tables.

When To Use Static IP Addresses Although DHCP is really great and makes our lives easier, there are situations where using a manually assigned static IP address is quite handy. Let’s look at a few situations where you would want to assign a static IP address in order to illustrate the benefits of doing so.

You need reliable name resolution on your network for computers that need to be consistently and accurately found. Although networking protocols have advanced over the years, and the majority of the time using a more abstract protocol like SMB (Server Message Block) to visit computers and shared folders on your network using the familiar style address works just fine, for some applications it falls apart. For example, when setting up media syncing on XBMC it’s necessary to use the IP address of your media source instead of the SMB name.

Any time you rely on a computer or a piece of software to accurately and immediately locate another computer on your network (as is the case with our XBMC example – the client devices need to find the media server hosting the material) with the least chance of error, assigning a static IP address is the way to go. Direct IP-based resolution remains the most stable and error free method of communicating on a network.

You want to impose a human-friendly numbering scheme onto your network devices. For network assignments like giving an address to your friend’s iPad or your laptop, you probably don’t care where in the available address block the IP comes from because you don’t really need to know (or care). If you have devices on your network that you regularly access using command line tools or other IP-oriented applications, it can be really useful to assignment permanent addresses to those devices in a scheme that is friendly to the human memory.

For example, if left to its own devices our wireless router would assign any available address to our three Raspberry Pi XBMC units. Because we frequently tinker with those units and access them by their IP addresses, it made sense to permanently assign addresses to them that would be logical and easy to remember: http://gearupz.com/best-wireless-router/

The .90 unit is in the basement, the .91 unit is on the first floor, and the .92 unit is on the second floor.

You have an application the expressly relies on IP addresses. Some applications will only allow you to supple an IP address to refer to other computers on the network. In such cases it would be extremely annoying to have to change the IP address in the application every time the IP address of the remote computer was changed in the DHCP table. Assigning a permanent address to the remote computer prevents you from the hassle of frequently updating your applications. This is why it’s quite useful to assign any computer that functions as a server of any sort to a permanent address.

Assigning Static IP Addresses the Smart Way Before you just start assigning static IP addresses left and right, let’s go over some basic network hygiene tips that will save you from a headache down the road.

How and Why All Devices in Your Home Share One IP Address First, check what the IP pool available on your router is. Your router will have a total pool and a pool specifically reserved for DHCP assignments. The total pool available to home routers is typically through or through . Then, within those ranges a smaller pool is reserved for the DHCP server, typically around 252 addresses in a range like through Once you know the general pool, you should use the following rules to assign static IP addresses:

Never assign an address that ends in .0 or .255 as these addresses are typically reserved for network protocols. This is the reason the example IP address pool above ends at .254. Never assign an address to the very start of the IP pool, e.g. as the start address is always reserved for the router. Even if you’ve changed the IP address of your router for security purposes, we’d still suggest against assigning a computer. Never assign an address outside of the total available pool of private IP addresses. This means if your router’s pool is through every IP you assign (keeping in mind the prior two rules) should fall within that range. Given that there are nearly 17 million addresses in that pool, we’re sure you can find one you like. Some people prefer to only use addresses outside of the DHCP range (e.g. they leave the through block completely untouched) but we don’t feel strongly enough about that to consider it an outright rule. Given the improbability of a home user needing 252 device addresses simultaneously, it’s perfectly fine to assign a device to one of those addresses if you’d prefer to keep everything in, say, the 10.0.0.x block.

Have a pressing tech question? Shoot us an email at ask@howtogeek.com and we’ll do our best to answer it.