admin 管理员组

文章数量: 887007

路由器桥接静态ip设置

Routers both modern and antiquated allow users to set static IP addresses for devices on the network, but what’s the practical use of static IP addresses for a home user? Read on as we explore when you should, and shouldn’t, assign a static IP.

现代路由器和过时路由器都允许用户为网络上的设备设置静态IP地址,但是对于家庭用户而言,静态IP地址的实际用途是什么? 在我们探索何时应该,不应该分配静态IP时,请继续阅读。

Dear How-To Geek,

亲爱的How-To Geek,

After reading over your five things to do with a new router article, I was poking around in the control panel of my router. One of the things I found among all the settings is a table to set static IP addresses. I’m pretty sure that section is self explanatory in as much as I get that it allows you to give a computer a permanent IP address, but I don’t really understand why? I’ve never used that section before and everything on my home network seems to work fine. Should I be using it? It’s obviously there for some reason, even if I’m not sure what that reason is!

阅读完与路由器有关的五篇文章后 ,我在路由器的控制面板中四处浏览。 我在所有设置中发现的一件事是用于设置静态IP地址的表。 我很确定该部分是不言自明的,因为它允许您为计算机提供永久的IP地址,但是我真的不明白为什么吗? 我以前从未使用过该部分,并且我家庭网络上的所有内容似乎都可以正常工作。 我应该使用它吗? 即使出于某种原因,它显然也在那里,即使我不确定那是什么原因!

Sincerely,

真诚的

IP Curious

IP好奇

DHCP与静态IP分配 (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.

为了帮助您了解静态IP地址的应用,让我们从您(和大多数读者)那里进行的设置开始。 绝大多数现代计算机网络,包括家里由路由器控制的小型网络,都使用DHCP (动态主机配置协议)。 DHCP是一种协议,它自动从可用IP地址池中为新设备分配IP地址,而无需用户或系统管理员的任何干预。 让我们用一个例子来说明DHCP是多么的美妙,它使我们的生活变得多么容易。

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 10.0.0.99. That address would be permanently assigned to your friend’s iPad unless you went in later and manually released the address.

想象一下,一个朋友用他们的iPad来拜访。 他们想进入您的网络并更新iPad上的某些应用程序。 如果没有DHCP,则需要跳到计算机上,登录到路由器的管理面板,然后手动为朋友的设备分配一个可用地址,例如10.0.0.99。 除非您稍后进入并手动释放该地址,否则该地址将被永久分配给您朋友的iPad。

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.

但是,使用DHCP,生活变得更加轻松。 您的朋友访问,他们想跳到您的网络上,因此,您给他们提供Wi-Fi密码即可登录。 将iPad连接到路由器后,路由器的DHCP服务器会检查可用的IP地址列表,并分配一个带有内置失效日期的地址。为您朋友的iPad提供一个地址,将其连接到网络,然后在朋友离开并且不再使用网络时,该地址将返回到池中,以准备将可用地址分配给另一台设备。

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.

所有这些都在幕后发生,并且假设路由器软件中没有严重错误,那么您甚至不需要关注DHCP进程,因为它对您来说是完全不可见的。 对于大多数应用程序,例如将移动设备添加到您的网络,通用计算机使用,视频游戏机等,这是一个令人满意的安排,我们都应该很高兴拥有DHCP,而不必为手动管理我们的麻烦而负担IP分配表。

何时使用静态IP地址 (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.

尽管DHCP确实很棒,并且使我们的生活更轻松,但是在某些情况下,使用手动分配的静态IP地址非常方便。 让我们看一下您想分配静态IP地址以说明这样做的好处的几种情况。

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 //officecomputer/shared_music/ 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.

对于需要一致且准确找到的计算机,您需要在网络上具有可靠的名称解析。 尽管网络协议已经发展了很多年,并且大多数时候使用更抽象的协议(例如SMB(服务器消息块))使用熟悉的// officecomputer / shared_music /样式地址来访问网络上的计算机和共享文件夹, ,对于某些应用程序,它会崩溃。 例如, 在XBMC上设置媒体同步时 ,必须使用媒体源的IP地址而不是SMB名称。

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.

每当您依靠计算机或软件来准确,立即地在网络上定位另一台计算机时(例如我们的XBMC示例–客户端设备需要找到托管资料的媒体服务器),则机会最小。错误,分配静态IP地址是正确的方法。 基于直接IP的解析仍然是网络上最稳定且无错误的通信方法。

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.

您想对您的网络设备强加人性化的编号方案。 对于网络分配(例如将地址分配给您朋友的iPad或笔记本电脑),您可能根本不在乎IP来自可用地址块的哪个位置,因为您实际上并不需要知道(或关心)该IP。 如果您的网络上有使用命令行工具或其他面向IP的应用程序定期访问的设备,则以对人类记忆友好的方案将永久地址分配给这些设备会非常有用。

For example, if left to its own devices our 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:

例如,如果留给自己的设备,我们的路由器将为三个Raspberry Pi XBMC单元分配任何可用地址。 因为我们经常修改这些单元并通过它们的IP地址访问它们,所以将逻辑上的和容易记住的永久地址分配给它们是有意义的:

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

.90单元位于地下室,.91单元位于一楼,.92单元位于二楼。

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.

您有一个明确依赖IP地址的应用程序。 某些应用程序仅允许您提供一个IP地址来引用网络上的其他计算机。 在这种情况下,每次在DHCP表中更改远程计算机的IP地址时都必须更改应用程序中的IP地址会非常烦人。 为远程计算机分配一个永久地址可以避免您频繁更新应用程序的麻烦。 这就是将非常有用的任何计算机分配给永久地址的原因。

智能分配静态IP地址 (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.

在您开始左右分配静态IP地址之前,让我们看一下一些基本的网络卫生技巧,这些技巧可帮助您免除以后的麻烦。

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 10.0.0.0 through 10.255.255.255 or 192.168.0.0 through 192.168.255.255 . Then, within those ranges a smaller pool is reserved for the DHCP server, typically around 252 addresses in a range like 10.0.0.2 through 10.0.0.254. Once you know the general pool, you should use the following rules to assign static IP addresses:

首先,检查路由器上可用的IP池。 您的路由器将有一个总池和一个专门为DHCP分配保留的池。 家用路由器可用的总池通常为10.0.0.0到10.255.255.255或192.168.0.0到192.168.255.255。 然后,在这些范围内,将为DHCP服务器保留一个较小的池,通常在252个地址左右,范围在10.0.0.2至10.0.0.254之类。 知道通用池后,应使用以下规则分配静态IP地址:

  1. 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.

    切勿分配以.0或.255结尾的地址,因为这些地址通常是为网络协议保留的。 这就是上面示例IP地址池以.254结尾的原因。
  2. Never assign an address to the very start of the IP pool, e.g. 10.0.0.1 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.

    永远不要为IP池的最开始分配地址,例如10.0.0.1,因为开始地址始终是为路由器保留的。 即使出于安全考虑更改了路由器的IP地址 ,我们仍然建议不要分配计算机。

  3. Never assign an address outside of the total available pool of private IP addresses. This means if your router’s pool is 10.0.0.0 through 10.255.255.255 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.

    切勿在专用IP地址总可用池之外分配地址。 这意味着,如果路由器的池为10.0.0.0到10.255.255.255,则您分配的每个IP(请牢记前两个规则)都应在该范围内。 鉴于该池中有近1700万个地址,因此我们确定您可以找到自己喜欢的地址。

Some people prefer to only use addresses outside of the DHCP range (e.g. they leave the 10.0.0.2 through 10.0.0.254 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.

有些人只喜欢使用DHCP范围之外的地址(例如,它们完全不影响10.0.0.2至10.0.0.254块),但是我们对此没有足够的信心,无法将其视为一条直截了当的规则。 鉴于家庭用户不可能同时需要252个设备地址,因此,如果您希望将所有内容都保留在10.0.0.x块中,则可以将设备分配给其中一个地址是完全可以的。

翻译自: https://www.howtogeek/184310/ask-htg-should-i-be-setting-static-ip-addresses-on-my-router/

路由器桥接静态ip设置

本文标签: 静态 路由 路由器 器上 桥接