子网掩码(Subnet masks)用于将 IP 地址分成两个不同的部分:其中一个告诉您计算机或设备(computer or device)的地址,而另一个告诉您它所属的网络。换句话说,子网掩码(subnet masks)用于将网络划分为子网,以便通过网络传输的任何数据都可以正确到达其目的地。您想知道如何更改Windows 10 PC 上的子网掩码吗?(subnet mask)您想了解如何更改本地家庭网络(home network)中所有计算机和设备的子网掩码(subnet mask)吗?阅读并找出:
在更改Windows 10中的(Windows 10)子网掩码之前先阅读此内容(Subnet Mask)
在更改您的 Windows 10 电脑的子网掩码(subnet mask)之前,您应该熟悉什么是IP 地址(IP address)和子网掩码(es and subnet masks),以及如何找到您的 Windows 10 电脑的IP 地址(IP address)。
(On your Windows 10 computer or device, you can change the subnet mask only if you're using a)在 Windows 10 计算机或设备上,只有在使用静态 IP 地址时才能更改子网掩码。如果您是这种情况,或者您还想更改IP 地址(IP address)并设置静态地址,请阅读本指南前三种方法的说明。
如果您使用的是由路由器上的(If you're using a dynamic IP address that's automatically generated by the)DHCP 服务自动生成的动态 IP 地址,则只能从路由器的 Web 界面更改子网掩码。(on your router, you can only change the subnet mask from your router's web interface.)阅读本指南的最后一部分,了解如何在家用路由器(home router)上执行此操作。
您还应该注意,为了能够在Windows 10中更改您的(Windows 10)子网掩码(subnet mask)(和/或IP 地址(IP address)),您必须使用管理员帐户(administrator account)登录。
1. 如何在Windows 10中更改(Windows 10)子网掩码(Subnet Mask),从设置应用程序(Settings app)
设置(Settings)应用程序提供了在 Windows 10 中更改子网掩码(subnet mask)的最简单方法之一。启动它并转到网络和 Internet(Network & Internet)类别。
在网络和 Internet(Network & Internet)中,选择左侧栏中(left sidebar)的Wi-Fi或以太网(Ethernet),具体取决于您要更改子网掩码的(subnet mask)网络适配器(network adapter)的类型。然后,在窗口右侧,单击或点击(click or tap)相应的网络连接(network connection)。
在网络连接页面上(network connection page),向下滚动直到到达IP 设置(IP settings)部分。然后,按下编辑(Edit)按钮。
这将打开一个名为“编辑 IP 设置”("Edit IP settings")的对话框,您可以在其中更改所选网络连接使用的(network connection)IP 地址(IP address)、子网掩码(subnet mask)、网关(gateway)和DNS 服务器(DNS servers),包括Internet Protocol Version 4 (TCP/IPv4)和Internet Protocol Version 6 (TCP/IPv6)。滚动到IPv4或IPv6部分,具体取决于您要为其配置新的子网掩码(subnet mask)。
确定子网掩码(subnet mask)的设置是子网前缀长度(Subnet prefix length),它控制子网的大小。例如,在下面的屏幕截图中,您可以看到,对于我们的网络连接(network connection) IPv4协议,我们使用的“子网前缀长度”("Subnet prefix length")为 24(网络掩码中 1 的位数),这意味着子网掩码(subnet mask)为255.255.255.0。
要更改子网掩码(subnet mask),您必须更改“子网前缀长度”("Subnet prefix length")字段的值。例如,因为我们想要一个子网掩码(subnet mask)255.255.240.0,我们必须将前缀长度(prefix length)设置为 20。如果您在计算子网掩码的(subnet mask)前缀长度(prefix length)方面需要帮助,请查看此在线IP 子网计算器(IP Subnet Calculator)。
单击或点击保存,(Save,)您的子网掩码(subnet mask)会立即更改。
2. 如何在Windows 10中更改(Windows 10)子网掩码(Subnet Mask),从控制面板(Control Panel)
Windows 10 仍然包括旧的控制面板(Control Panel),它还允许您更改网络适配器(network adapter)的子网掩码(subnet mask)。如果您更喜欢使用控制面板(Panel)来执行此任务,请打开它并单击或点击网络和 Internet下的(Network and Internet)“查看网络状态和任务”("View network status and task")链接。
在网络和共享中心(Network and Sharing Center),单击或点击(click or tap)要更改子网掩码(subnet mask)的网络连接(network connection)。
上一个操作打开了该网络连接的(network connection)状态(Status)窗口。在其中,按下属性(Properties)按钮。
在网络连接的“属性(Properties)”窗口中,选择Internet Protocol Version 4 (TCP/IPv4)或Internet Protocol Version 6 (TCP/IPv6),具体取决于您要更改的子网掩码。(subnet mask)如果您想同时更改两者,请对它们中的每一个重复接下来的步骤。
如果要更改用于Internet Protocol Version 4 (TCP/IPv4)子网掩码(subnet mask),请在其属性(Properties)窗口中,在具有相同名称的字段中输入新的子网掩码(subnet mask)。
例如,我们想将子网掩码(subnet mask)更改为 255.255.240.0,如下图所示。
完成所有更改后,单击或点击(click or tap)确定(OK),然后关闭所有打开的窗口。您设置的新子网掩码现已启动并运行。(subnet mask)
3. 如何在Windows 10中更改(Windows 10)子网掩码(Subnet Mask),使用PowerShell
如果您更喜欢使用命令行环境,还可以使用PowerShell在Windows 10中更改子网掩码(subnet mask)。以管理员身份打开 PowerShell并运行以下命令: (Open PowerShell)Get-NetAdapter -physical。此命令向您显示 Windows 10 计算机上安装的所有网络适配器。确定要更改子网掩码(subnet mask)的那个并记下它的ifIndex值。这是可用于在下一个PowerShell命令中选择网络适配器的(network adapter)接口索引号。(interface index)
要更改子网掩码(subnet mask),现在运行以下命令:Set-NetIPAddress -InterfaceIndex [ifIndex value] -PrefixLength [subnet prefix length]。将[ifIndex value]替换为您在上一个命令中标识的接口索引值,并将(interface index)[subnet prefix length]替换为您想要的新子网前缀长度的值。(subnet prefix length)
例如,我们想设置子网掩码 255.255.255.0,所以我们运行这个命令:Set-NetIPAddress -InterfaceIndex 7 -PrefixLength 24。
新的子网掩码(subnet mask)会立即应用,因此您现在可以关闭PowerShell。
4. 如何在使用DHCP的(DHCP)家庭网络(home network)上从路由器接口更改子网掩码(Subnet Mask)
如果您使用DHCP自动为您家中的计算机和设备分配 IP 地址,您可以从路由器的管理界面更改所有它们的(administration interface)子网掩码(subnet mask)。使用 PC 上的网络浏览器(web browser)访问路由器的网络界面。为此,您必须转到路由器的地址并(address and sign)使用您的用户帐户和密码登录(user account and password)。在大多数路由器上,这是 192.168.0.1 或 192.168.1.1,但它可能会有所不同。如果您不知道路由器的IP 地址(IP address),请查看本指南:查找无线路由器本地(wireless router)IP 地址(IP address)的5 种方法。
在路由器的 Web管理界面(admin interface)上,查找名为LAN的高级设置类别。在其中,转到LAN IP设置部分或选项卡(section or tab),然后将子网掩码(Subnet Mask)的值更改为您想要的值。单击(Click)或点击应用(Apply)、保存(Save)或确定(OK)。完成此操作后,新的子网掩码(subnet mask)将应用于网络中使用自动 IP 地址的所有计算机和设备。请注意,您的路由器可能需要重新启动才能应用此更改。
就是这样!
为什么要更改Windows 10 PC 上的子网掩码?(subnet mask)
现在您知道如何更改Windows 10 PC 甚至整个家庭网络上的(home network)子网掩码(subnet mask)了。我们很好奇:你为什么需要这些信息?是为了工作还是为了你的家?此外,如果您有任何要添加到本指南的内容,请随时在下面的专用部分中发表评论。
4 ways to change the Subnet Mask in Windows 10
Subnet masks are used to split IP addresses into two different parts: one of them tells you the computer or device's address, while the other tells you the network which it belongs to. In other words, subnet masks are used to divide networks into subnetworks, so that any data transmitted over a network can reach its destination correctly. Are you wondering how to change the subnet mask on your Windows 10 PCs? Do you want to learn how to change the subnet mask for all the computers and devices in your local home network? Read on and find out:
Read this first before changing the Subnet Mask in Windows 10
Before changing your Windows 10 PC's subnet mask, you should be familiar with what IP addresses and subnet masks are, and how to find what your Windows 10 computer IP address is.
On your Windows 10 computer or device, you can change the subnet mask only if you're using a static IP address. If that's the case for you, or if you want also to change your IP address and set a static one, read the instructions from the first three methods in this guide.
If you're using a dynamic IP address that's automatically generated by the DHCP service on your router, you can only change the subnet mask from your router's web interface. Read the last section of this guide for instructions on how to do that on a home router.
You should also note that to be able to change your subnet mask (and/or IP address) in Windows 10, you must log in using an administrator account.
1. How to change the Subnet Mask in Windows 10, from the Settings app
One of the easiest ways to change the subnet mask in Windows 10 is offered by the Settings app. Launch it and go to the Network & Internet category.
In Network & Internet, select Wi-Fi or Ethernet on the left sidebar, depending on the type of the network adapter for which you want to change the subnet mask. Then, on the right side of the window, click or tap on the corresponding network connection.
On the network connection page, scroll down until you reach the IP settings section. Then, push the Edit button.
This opens a dialog called "Edit IP settings" where you can change the IP address, subnet mask, gateway, and the DNS servers used by the selected network connection, both for the Internet Protocol Version 4 (TCP/IPv4) and the Internet Protocol Version 6 (TCP/IPv6). Scroll to the IPv4 or IPv6 section, depending on which of them you want to configure a new subnet mask.
The setting that determines the subnet mask is the Subnet prefix length, which controls the size of the subnet. For example, in the screenshot below, you can see that, for our network connection IPv4 protocol, we're using a "Subnet prefix length" of 24 (the number of 1 bits in the netmask), which means that the subnet mask is 255.255.255.0.
To change your subnet mask, you must change the value of the "Subnet prefix length" field. For example, because we wanted to have a subnet mask of 255.255.240.0, we had to set the prefix length to 20. If you need help on calculating the prefix length for a subnet mask, check this online IP Subnet Calculator.
Click or tap Save, and your subnet mask is immediately changed.
2. How to change the Subnet Mask in Windows 10, from the Control Panel
Windows 10 still includes the old Control Panel, which also lets you change your network adapter's subnet mask. If you prefer using the Control Panel for this task, open it and click or tap on the "View network status and task" link from under Network and Internet.
In the Network and Sharing Center, click or tap on the network connection for which you want to change the subnet mask.
The previous action opens the Status window of that network connection. In it, push the Properties button.
In the network connection's Properties window, select the select Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol Version 6 (TCP/IPv6), depending on the subnet mask that you want to change. If you want to change both, repeat the next steps for each of them.
If you want to change the subnet mask used for the Internet Protocol Version 4 (TCP/IPv4), in its Properties window, enter the new subnet mask in the field bearing the same name.
For example, we wanted to change our subnet mask to 255.255.240.0, as you can see in the next screenshot.
Once you're done making all the changes, click or tap on OK and then close all the open windows. The new subnet mask that you've set is now up and running.
3. How to change the Subnet Mask in Windows 10, using PowerShell
If you prefer using a command-line environment, you can also change your subnet mask in Windows 10 using PowerShell. Open PowerShell as an admin and run the following command: Get-NetAdapter -physical. This command shows you all the network adapters installed on your Windows 10 computer. Identify the one for which you want to change the subnet mask and note its ifIndex value. That's the interface index number that you can use to select the network adapter in the next PowerShell command.
To change the subnet mask, now run this command: Set-NetIPAddress -InterfaceIndex [ifIndex value] -PrefixLength [subnet prefix length]. Replace [ifIndex value] with the interface index value that you've identified on the previous command, and replace [subnet prefix length] with the value of the new subnet prefix length that you want.
For example, we wanted to set a subnet mask of 255.255.255.0, so we ran this command: Set-NetIPAddress -InterfaceIndex 7 -PrefixLength 24.
The new subnet mask is instantly applied, so you can now close PowerShell.
4. How to change the Subnet Mask from the router's interface, on a home network with DHCP
If you're using DHCP to automatically assign IP addresses to the computers and devices in your home, you can change the subnet mask for all of them from your router's administration interface. Use a web browser on your PC to access the router's web interface. To do that, you must go to the router's address and sign in with your user account and password. On most routers out there, that's 192.168.0.1 or 192.168.1.1, but it can differ. If you don't know the IP address of your router, check this guide: 5 ways to find the local IP address of your wireless router.
On the router's web admin interface, look for an advanced settings category called LAN. In it, go to the LAN IP settings section or tab, and change the value of the Subnet Mask with the one you want. Click or tap on Apply, Save, or OK. Once you do that, the new subnet mask is applied to all the computers and devices from your network that use automatic IP addresses. Note that your router might need to reboot to apply this change.
That was it!
Why did you want to change the subnet mask on your Windows 10 PC?
Now you know how to change the subnet mask on your Windows 10 PC or even on your entire home network. We're curious: why did you need that information? Was it for work or for your home? Also, if you have anything to add to this guide, do not hesitate to comment in the dedicated section below.