让路由器使用 DHCP(router use DHCP)来决定设备获得的 IP 地址非常方便且直接。我们不必挑选、分配它们,更好的是,试着记住它们。
打印机等设备通常具有基于 Web 的管理,可以在任何地方进行配置和维护。这使得打印机成为静态IP(IPs)的首选。
为什么要为设备分配静态 IP 地址?(Why Assign a Static IP Address to a Device?)
这似乎是更多的工作,但它确实让生活变得更简单(life simpler)、更轻松。如果需要从其他设备访问该设备,则可以使用静态IP 地址(IP address)。想象一下(Imagine),有一个IP 地址(IP address)每天都在变化的Web 服务器。(web server)就像每天 更换电话号码一样。(phone number)
当考虑需要从任何地方访问的其他设备时,会想到智能电视(TVs)、安全系统、家庭自动化(home automation)和摄像系统。
在较小程度上,另一个原因是安全性。一个路由器可以发布数百甚至数千个IP 地址(IP address)。它不关心(t care)它是谁的设备。通过使用静态IP(IPs)和限制可用IP 地址(IP address)的数量,流氓设备更难进入网络。它还可以帮助解决IP 地址(IP address)冲突。
我可以使用哪些 IP 地址?(What IP Addresses Can I Use?)
互联网号码分配机构(Internet Assigned Numbers Authority)( IANA ) 已预留以下 IP 块供私人使用。私人使用(Private use)意味着您只能使用专用网络中的 IP 地址。他们不是为了外面的世界。IANA为私有 IP 定义了以下范围:
- 10.0.0.0 到 10.255.255.255 - 等于 16,777,214 个 IP 地址
- 172.16.0.0 到 172.31.255.255 - 等于 1,048,574 个 IP 地址
- 192.168.0.0 到 192.168.255.255 - 等于 65534 个 IP 地址
如果路由器已经在使用,它有一个范围。坚持这个范围是最容易的。一些路由器预先定义了范围。
制定静态 IP 计划(Make a Static IP Plan)
如果网络连接了十个或更少的设备,则不需要计划。只需(Just)将它们全部放在一个范围内,例如 192.168.2.10 到 192.168.2.19。跳过本节的其余部分。
如果网络有十多个设备,制定计划是明智的。这只是制定计划的一种方式。如果它不适合(t work)你,就改变它。
- 计算(Count)将连接到网络的所有设备。
- (Group)按类型对设备进行分组。例如,可能有 3 部手机、2 台智能电视(TVs)、4 台相机和一台DVR、2台IoT设备(如智能冰箱)和一台打印机。
- (Assign)为每种设备类型(device type)分配IP 地址块并留出增长空间。如果正在使用 192.168.2.0 到 192.168.2.255 范围,则可能会像这样分配块:
- 手机和平板电脑:192.168.2.20 至 192.168.2.29
- 电视:192.168.2.30 至 192.168.2.39
- 摄像机和DVR:192.168.2.40 到 192.168.2.49
- 物联网设备:192.168.2.50 到 192.168.2.59
- 打印机:192.168.2.60 到 192.168.2.69
使用范围的一些最佳实践:
- 以零结尾的数字开始设备类型(device type) IP 范围,以以 9 结尾的数字结束范围(IP range)
- 增量范围以十为单位。任何更少都会变得混乱,并且您可以轻松地超越它们。此外,它还允许在该范围内使用其他相同类型的设备。如果设备数量已经接近 10 台,则使范围覆盖 20 个(range cover 20)IP 地址,例如 192.168.2.40 到 192.168.2.59。
- 无论路由器的IP 地址(IP address)是什么,都将其整个块打开(block open)以添加网络设备,例如其他路由器、交换机、防火墙等。例如,如果路由器使用 192.168.2.1,则保留 192.168.2.2 到 192.168.2.9网络设备。
- 在电子表格中,为设备分配 IP 地址。这将成为设备清单,并且更容易识别网络上的设备。将范围内的第一个 IP 分配给控制器设备是个好主意。例如,DVR 是摄像机的控制器(DVR is the controller of the cameras),因此它的 IP 为 192.168.2.50。
如果您在电子表格上计划它,它可能如下所示:
如何为路由器中的设备分配静态 IP(How to Assign Static IPs to Devices in the Router)
- (Consult)如果您使用Mac或不习惯使用命令提示符,(using the Command Prompt)请参阅我们的文章,了解如何查找路由器的IP 地址(IP address)。选择开始(Start )菜单并搜索CMD 。(. Command Prompt )命令提示符将是最重要的结果,因此选择它。
- 当命令提示符(Command Prompt )窗口打开时,输入命令
ipconfig
并按Enter。
Default Gateway的值是路由器的IP 地址(IP address)。把它写在某处。
- 打开网络浏览器(web browser)并在地址栏中(location bar)输入路由器的IP 地址(IP address),然后按Enter。这将打开路由器的基于 Web 的管理页面(management page)。
分配静态 IP – 华硕路由器(Assign Static IPs – Asus Router)
- 登录华硕路由器,找到LAN按钮,然后选择它。
- 选择DHCP 服务器(DHCP Server )选项卡。该路由器允许在为选定设备分配静态IP(IPs)的同时保持DHCP 模式。(DHCP mode)如果需要,可以将其配置为仅使用静态IP(IPs)。
- 滚动到手动分配(Manual Assignment )部分。在它显示启用手动分配(Enable Manual Assignment)的地方,选择是(Yes)。
- 选择客户端名称(MAC 地址)(Client Name (MAC Address) )下的下拉框,然后在DHCP 列表(DHCP list)周围的手动分配 IP(Manually Assigned IP)中选择一个设备。列出当前连接到路由器的所有设备。要查看您之前连接的设备,请选择Show Offline Client List。
它将在IP 地址(IP Address )字段中显示设备的当前IP 地址。(IP address)这可以保持原样,也可以在此时更改。如果需要,在DNS 服务器(可选)(DNS Server (Optional) )字段中添加DNS 服务器(DNS server)的IP 地址。(IP address)选择加号按钮(plus sign button )将设备添加到手动分配的 IP 设备列表中。对所有需要的设备重复此操作。
为所有所需设备分配静态IP(IPs)后,选择应用(Apply)按钮以设置更改。
分配静态 IP – TrendNet 路由器(Assign Static IPs – TrendNet Router)
- 登录(Log)TrendNet 路由器(TrendNet router)并选择高级选项(Advanced )卡。
- 在左侧菜单中,选择Setup,然后选择LAN Settings。
- 向下滚动到添加 DHCP 保留(Add DHCP Reservations )部分。选中启用(Enable )框,然后输入设备的详细信息以接收静态IP 地址(IP address)。确保详细信息正确,然后选择添加(Add)。
- 刚刚添加的设备将显示在DHCP Reservations Ready Group中。如果一切正确,请选择应用(Apply ),设备将具有静态 IP。
分配静态 IP – Belkin 路由器(Assign Static IPs – Belkin Router)
- 登录(Log)到Belkin 路由器(Belkin router)并选择配置(Configuration)选项卡。然后在连接(Connectivity )下选择 本地网络。( Local Network. )现在选择DHCP 保留(DHCP Reservation )按钮。
- 在DHCP 客户端表(DHCP Client Table)窗口中,显示了当前连接的所有设备。如果是需要静态IP 地址(IP address)的设备,请选中 Select(Select )框,然后选择Add Clients。
- 在同一窗口中,您也可以手动添加客户端。首先(First),输入设备详细信息,然后选择添加(Add )按钮。定义所有需要静态 IP 地址的设备后,选择保存(Save )以提交更改。
在其他路由器上分配静态 IP 怎么样?(What About Assigning Static IPs on Other Routers?)
那里至少有十几家路由器(dozen router)制造商,每个制造商都有几种型号的路由器。太多了,无法涵盖所有这些。不过,通读上面的说明,您会发现其中有一个模式。找出使用LAN的位置,查找名为DHCP Reservation之类的名称,然后继续分配 IP 地址。如果您遇到问题,请告诉我们。我们的一位作家或知识渊博的读者可能会有答案。
Assign a Static IP Address to a Printer or Any Network Device
It’s handy and straightforwаrd to let the router use DHCP to decide what IP addresses devices get. We don’t have to pick them, assign them, and better yet, try to remember them.
Devices like printers often have web-based management, which can be configured and maintained from anywhere. That makes printers a top candidate for static IPs.
Why Assign a Static IP Address to a Device?
It seems like more work, yet it does make life simpler and easier. If the device needs to be accessible from other devices, a static IP address is the way to go. Imagine having a web server where the IP address changes daily. It’s like changing your phone number every day.
When thinking of other devices that need to be accessible from anywhere, smart TVs, security systems, home automation, and camera systems come to mind.
Another reason, to a lesser extent, is security. A router can issue hundreds, if not thousands of IP addresses. It doesn’t care whose device it is. By using static IPs and limiting the number of IP addresses available, rogue devices have a harder time getting on the network. It can also help resolve an IP address conflict.
What IP Addresses Can I Use?
The Internet Assigned Numbers Authority (IANA) has set aside the following blocks of IPs for private use. Private use means you can only use the IP addresses in a private network. They aren’t for the outside world. IANA defines the following ranges for private IPs:
- 10.0.0.0 to 10.255.255.255 – equals 16,777,214 IP addresses
- 172.16.0.0 to 172.31.255.255 – equals 1,048,574 IP addresses
- 192.168.0.0 to 192.168.255.255 – equals 65534 IP addresses
If the router is being used already, it has a range. It’s easiest to stick with that range. Some routers pre-define the range.
Make a Static IP Plan
If the network has ten or fewer devices connected, a plan isn’t necessary. Just put them all in a single range, like 192.168.2.10 to 192.168.2.19. Skip the rest of this section.
If the network has more than ten devices, it’s wise to make a plan. This is just one way to make a plan. If it doesn’t work for you, change it.
- Count all the devices that will connect to the network.
- Group the devices by type. For example, there may be 3 phones, 2 smart TVs, 4 cameras and a DVR, 2 IoT devices like smart fridges, and a printer.
- Assign blocks of IP addresses for each device type and leave room for growth. If the 192.168.2.0 to 192.168.2.255 range is being used, the blocks might be assigned like:
- Phones and tablets: 192.168.2.20 to 192.168.2.29
- TVs: 192.168.2.30 to 192.168.2.39
- Cameras and DVR: 192.168.2.40 to 192.168.2.49
- IoT devices: 192.168.2.50 to 192.168.2.59
- Printers: 192.168.2.60 to 192.168.2.69
Some best practices for using ranges:
- Begin a device type IP range with a number ending in zero and end the range with a number ending in 9
- Increment ranges in tens. Any less can become confusing, and you can easily outgrow them. Plus, it allows for additional devices of the same type in that range. If the number of devices is already close to 10, make the range cover 20 IP addresses, like 192.168.2.40 to 192.168.2.59.
- Whatever the router’s IP address is, leave its entire block open for the addition of networking equipment, like other routers, switches, firewalls, etc. For example, if the router uses 192.168.2.1, then reserve 192.168.2.2 to 192.168.2.9 for networking equipment.
- In a spreadsheet, assign the devices their IP addresses. This becomes an inventory of devices and makes it easier to identify the devices on the network. It’s a good idea to assign the first IP in a range to controller devices. For example, the DVR is the controller of the cameras, so it will have an IP of 192.168.2.50.
If you plan it on a spreadsheet, it may look like this:
How to Assign Static IPs to Devices in the Router
- Consult our article on how to find the IP address of the router if you’re using a Mac or not comfortable using the Command Prompt. Select the Start menu and search for CMD. Command Prompt will be the top result, so select it.
- When the Command Prompt window opens, enter the command <pre>ipconfig</pre> and press Enter.
The value for Default Gateway is the IP address of the router. Write this down somewhere.
- Open a web browser and enter the IP address of the router in the location bar, then press Enter. This will open the router’s web-based management page.
Assign Static IPs – Asus Router
- Login to the Asus router, find the LAN button, and select it.
- Select the DHCP Server tab. This router allows for staying in DHCP mode while assigning static IPs to selected devices. If desired, it can be configured to use only static IPs.
- Scroll to the Manual Assignment section. Where it reads Enable Manual Assignment, select Yes.
- Select the drop-down box under Client Name (MAC Address) and choose a device in the Manually Assigned IP around the DHCP list. All devices currently connected to the router are listed. To see devices that you previously connected, select Show Offline Client List.
It will show the device’s current IP address in the IP Address field. This can be left as is, or it can be changed at this point. Add the IP address of a DNS server in the DNS Server (Optional) field, if needed. Select the plus sign button to add the device to the list of manually assigned IP devices. Repeat this for all the desired devices.
Once all the desired devices have been assigned static IPs, select the Apply button to set the changes.
Assign Static IPs – TrendNet Router
- Log in to the TrendNet router and select the Advanced tab.
- In the left-side menu, select Setup, then select LAN Settings.
- Scroll down to the Add DHCP Reservations section. Check the Enable box, then enter the details of the device to receive a static IP address. Ensure the details are correct and then select Add.
- The device just added will show in the DHCP Reservations Ready Group. If everything is correct, select Apply and the device will have a static IP.
Assign Static IPs – Belkin Router
- Log in to the Belkin router and select the Configuration tab. Then under Connectivity select Local Network. Now select the DHCP Reservation button.
- In the DHCP Client Table window, any devices that are currently connected are shown. If it’s the device that requires a static IP address, check the Select box, then select Add Clients.
- In the same window, you can manually add clients as well. First, enter the device details, then select the Add button. Once all the devices requiring static IP addresses are defined, select Save to commit the changes.
What About Assigning Static IPs on Other Routers?
There are at least a dozen router makers out there, and each has several models of routers. It’s just far too many to cover all of them. Reading through the instructions above, though, you’ll see that there’s a pattern; find out where to work with the LAN, look for something named like DHCP Reservation, then follow through to assign IP addresses. If you’re running into issues, please let us know. One of our writers or knowledgeable readers will likely have the answer.